cc2538: upload: Support .bin not starting at beginning of flash
Depending on the linker script, the generated .bin file may start beyond the beginning of the flash memory. However, no target address was passed to cc2538-bsl.py by the upload make target, so it used the beginning of the flash memory in all cases. The load address of the lowest loadable output section is now passed to cc2538-bsl.py. The start address of the .text output section or the address of the _text symbol could have been used too, but this would not have been compatible with all the possible custom linker scripts. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
This commit is contained in:
parent
ee3ee049e4
commit
cbcf1262d6
|
@ -30,9 +30,9 @@ MODULES += core/net core/net/mac \
|
||||||
|
|
||||||
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
|
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
|
||||||
|
|
||||||
%.upload: %.bin
|
%.upload: %.bin %.elf
|
||||||
ifeq ($(wildcard $(BSL)), )
|
ifeq ($(wildcard $(BSL)), )
|
||||||
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
|
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
|
||||||
else
|
else
|
||||||
python $(BSL) -e -w -v $<
|
python $(BSL) -e -w -v -a $$($(OBJDUMP) -h $*.elf | sed -n '/\<LOAD\>/{g;1!p;};h' | awk '{print "0x" $$5}' | sort -g | head -1) $<
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -38,9 +38,9 @@ MODULES += core/net core/net/mac \
|
||||||
|
|
||||||
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
|
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
|
||||||
|
|
||||||
%.upload: %.bin
|
%.upload: %.bin %.elf
|
||||||
ifeq ($(wildcard $(BSL)), )
|
ifeq ($(wildcard $(BSL)), )
|
||||||
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
|
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
|
||||||
else
|
else
|
||||||
$(PYTHON) $(BSL) $(BSL_FLAGS) $<
|
$(PYTHON) $(BSL) $(BSL_FLAGS) -a $$($(OBJDUMP) -h $*.elf | sed -n '/\<LOAD\>/{g;1!p;};h' | awk '{print "0x" $$5}' | sort -g | head -1) $<
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue