Fix the .upload target

This commit is contained in:
George Oikonomou 2018-10-14 00:23:43 +01:00
parent 1b85bc6124
commit 6f2f4b4b23
4 changed files with 11 additions and 9 deletions

View File

@ -81,8 +81,10 @@ STACK_SIZE = 0
@$(SIZE) -A $< | egrep "data|bss" | awk '{s+=$$2} END {s=s+$(STACK_SIZE); f=$(RAM_SIZE)-s; printf "[RAM] used %6d, free %6d\n",s,f;}'
@$(SIZE) -A $< | egrep "text|isr_vector" | awk '{s+=$$2} END {f=$(FLASH_SIZE)-s; printf "[Flash] used %6d, free %6d\n",s,f;}'
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3
ifeq ($(BOARD_SUPPORTS_BSL),1)
%.upload: %.bin
%.upload: $(OUT_BIN)
ifeq ($(wildcard $(BSL)), )
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
else
@ -95,5 +97,3 @@ endif
### For the login etc targets
BAUDRATE = 115200
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3

View File

@ -28,11 +28,12 @@ endif
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
%.upload: %.bin %.elf
%.upload: $(OUT_BIN) $(OUT_ELF)
ifeq ($(wildcard $(BSL)), )
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
else
$(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h $*.elf | grep -B1 LOAD | \
$(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h \
$(BUILD_DIR_BOARD)/$*.elf | grep -B1 LOAD | \
grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | \
sort -g | head -1))
$(PYTHON) $(BSL) $(BSL_FLAGS) $(BSL_ADDRESS_ARG) $<

View File

@ -35,11 +35,12 @@ endif
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
%.upload: %.bin %.elf
%.upload: $(OUT_BIN) $(OUT_ELF)
ifeq ($(wildcard $(BSL)), )
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
else
$(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h $*.elf | grep -B1 LOAD | \
$(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h \
$(BUILD_DIR_BOARD)/$*.elf | grep -B1 LOAD | \
grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | \
sort -g | head -1))
$(PYTHON) $(BSL) $(BSL_FLAGS) $(BSL_ADDRESS_ARG) $<

View File

@ -69,9 +69,9 @@ endif
### $$$$ Double escapes $s that need to be passed to the shell - once for when
### make parses UPLOAD_RULE, and once for when the expanded rule is parsed by make.
define UPLOAD_RULE
%.$(MOTE): %.bin %.elf
%.$(MOTE): $(OUT_BIN) $(OUT_ELF)
@echo "Flashing $(MOTE)"
@BSL_ADDRESS=`$(OBJDUMP) -h $$*.elf | grep -B1 LOAD | \
@BSL_ADDRESS=`$(OBJDUMP) -h $(BUILD_DIR_BOARD)/$$*.elf | grep -B1 LOAD | \
grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$$$5}' | \
sort -g | head -1`; \
$(PYTHON) $(BSL) $(BSL_FLAGS) -b $(BSL_SPEED) -a $$$${BSL_ADDRESS} -p $(MOTE) $$<