From 871486527b3b02947b9dde7d5fe39d7592825127 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Wed, 7 Aug 2019 15:22:34 +0200 Subject: [PATCH] EXST - Allow targets to specify VMA offset. The hex file must have the correct address in order for it to be uploaded via flashing tools (configurator). However, the objcopy tool only appears to support an INCREMENT address, so the increment is determined by subtracting the load address from the flash address. For the current SPRacing H7 boards, the bootloader DFU descriptor string has a start address of 0x9000000 for the external flash, the firmware partition begins at offset 0x07CE0000, required resulting flash address is 0x97CE0000. --- Makefile | 6 ++++-- src/main/target/SPRACINGH7EXTREME/target.mk | 3 +++ src/main/target/SPRACINGH7NANO/target.mk | 2 ++ src/main/target/SPRACINGH7ZERO/target.mk | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index daf4aaf65..0c6212e38 100644 --- a/Makefile +++ b/Makefile @@ -349,8 +349,10 @@ $(TARGET_BIN): $(TARGET_UNPATCHED_BIN) $(OBJCOPY) $(TARGET_ELF) $(TARGET_EXST_ELF) --update-section .exst_hash=$(TARGET_EXST_HASH_SECTION_FILE) $(TARGET_HEX): $(TARGET_BIN) - @echo "Creating EXST HEX from patched EXST ELF $(TARGET_HEX)" "$(STDOUT)" - $(V1) $(OBJCOPY) -O ihex --set-start 0x8000000 $(TARGET_EXST_ELF) $@ + $(if $(EXST_ADJUST_VMA),,$(error "EXST_ADJUST_VMA not specified")) + + @echo "Creating EXST HEX from patched EXST ELF $(TARGET_HEX), VMA Adjust $(EXST_ADJUST_VMA)" "$(STDOUT)" + $(V1) $(OBJCOPY) -O ihex --adjust-vma $(EXST_ADJUST_VMA) $(TARGET_EXST_ELF) $@ endif diff --git a/src/main/target/SPRACINGH7EXTREME/target.mk b/src/main/target/SPRACINGH7EXTREME/target.mk index 28025721b..6530f82a3 100644 --- a/src/main/target/SPRACINGH7EXTREME/target.mk +++ b/src/main/target/SPRACINGH7EXTREME/target.mk @@ -5,6 +5,9 @@ HSE_VALUE = 8000000 FEATURES += VCP ONBOARDFLASH SDCARD_SDIO EXST = yes +# flash address 0x97CE0000 - code_ram address (0x24010000) = 0x73CD0000 +EXST_ADJUST_VMA = 0x73CD0000 + TARGET_SRC += \ drivers/bus_quadspi_hal.c \ diff --git a/src/main/target/SPRACINGH7NANO/target.mk b/src/main/target/SPRACINGH7NANO/target.mk index 3560f6f40..68a9f25b0 100644 --- a/src/main/target/SPRACINGH7NANO/target.mk +++ b/src/main/target/SPRACINGH7NANO/target.mk @@ -3,6 +3,8 @@ H750xB_TARGETS += $(TARGET) HSE_VALUE = 8000000 EXST = yes +# flash address 0x97CE0000 - code_ram address (0x24010000) = 0x73CD0000 +EXST_ADJUST_VMA = 0x73CD0000 FEATURES += VCP ONBOARDFLASH diff --git a/src/main/target/SPRACINGH7ZERO/target.mk b/src/main/target/SPRACINGH7ZERO/target.mk index 8296e1d01..5b6cb7ccb 100644 --- a/src/main/target/SPRACINGH7ZERO/target.mk +++ b/src/main/target/SPRACINGH7ZERO/target.mk @@ -3,6 +3,8 @@ H750xB_TARGETS += $(TARGET) HSE_VALUE = 8000000 EXST = yes +# flash address 0x97CE0000 - code_ram address (0x24010000) = 0x73CD0000 +EXST_ADJUST_VMA = 0x73CD0000 FEATURES += VCP ONBOARDFLASH SDCARD_SDIO