mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-09-09 23:54:32 +00:00
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>
47 lines
1.2 KiB
Makefile
47 lines
1.2 KiB
Makefile
# Remote platform makefile
|
|
|
|
ifndef CONTIKI
|
|
$(error CONTIKI not defined! You must specify where CONTIKI resides!)
|
|
endif
|
|
|
|
PYTHON = python
|
|
BSL_FLAGS += -e -w -v -b 115200
|
|
|
|
ifdef PORT
|
|
BSL_FLAGS += -p $(PORT)
|
|
endif
|
|
|
|
CONTIKI_TARGET_DIRS = . dev
|
|
|
|
CONTIKI_TARGET_SOURCEFILES += leds.c leds-arch.c
|
|
CONTIKI_TARGET_SOURCEFILES += contiki-main.c
|
|
CONTIKI_TARGET_SOURCEFILES += sensors.c remote-sensors.c
|
|
CONTIKI_TARGET_SOURCEFILES += button-sensor.c antenna-sw.c
|
|
CONTIKI_TARGET_SOURCEFILES += phidget-sensor.c tmp102.c
|
|
|
|
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
|
|
|
CLEAN += *.remote
|
|
|
|
### Unless the example dictates otherwise, build with code size optimisations
|
|
ifndef SMALL
|
|
SMALL = 1
|
|
endif
|
|
|
|
### Define the CPU directory
|
|
CONTIKI_CPU=$(CONTIKI)/cpu/cc2538
|
|
include $(CONTIKI_CPU)/Makefile.cc2538
|
|
|
|
MODULES += core/net core/net/mac \
|
|
core/net/mac/contikimac \
|
|
core/net/llsec
|
|
|
|
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) -a $$($(OBJDUMP) -h $*.elf | sed -n '/\<LOAD\>/{g;1!p;};h' | awk '{print "0x" $$5}' | sort -g | head -1) $<
|
|
endif
|