Remove duplicate block and define the argument of -a using $(shell)

This commit is contained in:
George Oikonomou 2015-11-24 13:08:12 +00:00
parent 1efeda4283
commit e75bdd00e7
2 changed files with 9 additions and 10 deletions

View file

@ -29,7 +29,7 @@ MODULES += core/net core/net/mac \
core/net/llsec
PYTHON = python
BSL_FLAGS += -e -w -v -a $$($(OBJDUMP) -h $*.elf | grep -B1 LOAD | grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | sort -g | head -1)
BSL_FLAGS += -e -w -v
ifdef PORT
BSL_FLAGS += -p $(PORT)
@ -41,5 +41,8 @@ BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
ifeq ($(wildcard $(BSL)), )
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
else
$(PYTHON) $(BSL) $(BSL_FLAGS) $<
$(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h $*.elf | grep -B1 LOAD | \
grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | \
sort -g | head -1))
$(PYTHON) $(BSL) $(BSL_FLAGS) $(BSL_ADDRESS_ARG) $<
endif

View file

@ -36,18 +36,14 @@ MODULES += core/net core/net/mac \
core/net/mac/contikimac \
core/net/llsec
PYTHON = python
BSL_FLAGS += -e -w -v -a $$($(OBJDUMP) -h $*.elf | grep -B1 LOAD | grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | sort -g | head -1)
ifdef PORT
BSL_FLAGS += -p $(PORT)
endif
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
%.upload: %.bin %.elf
ifeq ($(wildcard $(BSL)), )
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
else
$(PYTHON) $(BSL) $(BSL_FLAGS) $<
$(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h $*.elf | grep -B1 LOAD | \
grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | \
sort -g | head -1))
$(PYTHON) $(BSL) $(BSL_FLAGS) $(BSL_ADDRESS_ARG) $<
endif