aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George2019-03-04 22:26:55 +1100
committerDamien George2019-03-04 22:26:55 +1100
commitc8bbf2c170760625862666ea2e7556cee4b26c46 (patch)
treeec42bdb36a5a91d67f5951ad32f0578ac6b7f399
parent2d644ac45530bac21785fddbd9efa3466204ff26 (diff)
stm32/Makefile: Allow a board to specify its linker sections for FW.
A board can now use the make variables TEXT0_SECTIONS and TEXT1_SECTIONS to specify the linker sections that should go in its firmware. Defaults are provided which give the existing behaviour.
-rw-r--r--ports/stm32/Makefile11
1 files changed, 8 insertions, 3 deletions
diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile
index 1a75bf050..03c791533 100644
--- a/ports/stm32/Makefile
+++ b/ports/stm32/Makefile
@@ -490,6 +490,8 @@ TEXT0_ADDR ?= 0x08000000
ifeq ($(TEXT1_ADDR),)
# No TEXT1_ADDR given so put all firmware at TEXT0_ADDR location
+TEXT0_SECTIONS ?= .isr_vector .text .data
+
deploy-stlink: $(BUILD)/firmware.dfu
$(ECHO) "Writing $(BUILD)/firmware.bin to the board via ST-LINK"
$(Q)$(STFLASH) write $(BUILD)/firmware.bin $(TEXT0_ADDR)
@@ -500,12 +502,15 @@ deploy-openocd: $(BUILD)/firmware.dfu
$(BUILD)/firmware.dfu: $(BUILD)/firmware.elf
$(ECHO) "Create $@"
- $(Q)$(OBJCOPY) -O binary -j .isr_vector -j .text -j .data $^ $(BUILD)/firmware.bin
+ $(Q)$(OBJCOPY) -O binary $(addprefix -j ,$(TEXT0_SECTIONS)) $^ $(BUILD)/firmware.bin
$(Q)$(PYTHON) $(DFU) -b $(TEXT0_ADDR):$(BUILD)/firmware.bin $@
else
# TEXT0_ADDR and TEXT1_ADDR are specified so split firmware between these locations
+TEXT0_SECTIONS ?= .isr_vector
+TEXT1_SECTIONS ?= .text .data
+
deploy-stlink: $(BUILD)/firmware.dfu
$(ECHO) "Writing $(BUILD)/firmware0.bin to the board via ST-LINK"
$(Q)$(STFLASH) write $(BUILD)/firmware0.bin $(TEXT0_ADDR)
@@ -518,8 +523,8 @@ deploy-openocd: $(BUILD)/firmware.dfu
$(BUILD)/firmware.dfu: $(BUILD)/firmware.elf
$(ECHO) "GEN $@"
- $(Q)$(OBJCOPY) -O binary -j .isr_vector $^ $(BUILD)/firmware0.bin
- $(Q)$(OBJCOPY) -O binary -j .text -j .data $^ $(BUILD)/firmware1.bin
+ $(Q)$(OBJCOPY) -O binary $(addprefix -j ,$(TEXT0_SECTIONS)) $^ $(BUILD)/firmware0.bin
+ $(Q)$(OBJCOPY) -O binary $(addprefix -j ,$(TEXT1_SECTIONS)) $^ $(BUILD)/firmware1.bin
$(Q)$(PYTHON) $(DFU) -b $(TEXT0_ADDR):$(BUILD)/firmware0.bin -b $(TEXT1_ADDR):$(BUILD)/firmware1.bin $@
endif