From aea8733e4f3eda8f69dd674b7851e7d46df4ba8a Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Tue, 11 Jun 2019 19:35:43 +0200 Subject: [PATCH 1/2] STM32H7 - Allow targets to override linker script. --- make/mcu/STM32H7.mk | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/make/mcu/STM32H7.mk b/make/mcu/STM32H7.mk index 5572b563e9..db2cd584b3 100644 --- a/make/mcu/STM32H7.mk +++ b/make/mcu/STM32H7.mk @@ -162,22 +162,22 @@ DEVICE_FLAGS = -DUSE_HAL_DRIVER -DUSE_DMA_RAM # H750xB : 128K FLASH, 1M RAM # ifeq ($(TARGET),$(filter $(TARGET),$(H743xI_TARGETS))) -DEVICE_FLAGS += -DSTM32H743xx -LD_SCRIPT = $(LINKER_DIR)/stm32_flash_h743_2m.ld -STARTUP_SRC = startup_stm32h743xx.s -TARGET_FLASH := 2048 +DEVICE_FLAGS += -DSTM32H743xx +DEFAULT_LD_SCRIPT = $(LINKER_DIR)/stm32_flash_h743_2m.ld +STARTUP_SRC = startup_stm32h743xx.s +TARGET_FLASH := 2048 else ifeq ($(TARGET),$(filter $(TARGET),$(H750xB_TARGETS))) -DEVICE_FLAGS += -DSTM32H750xx -LD_SCRIPT = $(LINKER_DIR)/stm32_flash_h750_128k.ld -STARTUP_SRC = startup_stm32h743xx.s -TARGET_FLASH := 128 +DEVICE_FLAGS += -DSTM32H750xx +DEFAULT_LD_SCRIPT = $(LINKER_DIR)/stm32_flash_h750_128k.ld +STARTUP_SRC = startup_stm32h743xx.s +TARGET_FLASH := 128 ifeq ($(EXST),yes) -FIRMWARE_SIZE := 448 +FIRMWARE_SIZE := 448 # TARGET_FLASH now becomes the amount of RAM memory that is occupied by the firmware # and the maximum size of the data stored on the external storage device. -TARGET_FLASH := FIRMWARE_SIZE -LD_SCRIPT = $(LINKER_DIR)/stm32_flash_h750_exst.ld +TARGET_FLASH := FIRMWARE_SIZE +DEFAULT_LD_SCRIPT = $(LINKER_DIR)/stm32_flash_h750_exst.ld endif ifneq ($(DEBUG),GDB) @@ -192,6 +192,10 @@ else $(error Unknown MCU for H7 target) endif +ifeq ($(LD_SCRIPT),) +LD_SCRIPT = $(DEFAULT_LD_SCRIPT) +endif + ifneq ($(FIRMWARE_SIZE),) DEVICE_FLAGS += -DFIRMWARE_SIZE=$(FIRMWARE_SIZE) endif From 0c7b161c3277ec6d32b62943dced34159a2b9a7c Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Tue, 11 Jun 2019 22:56:16 +0200 Subject: [PATCH 2/2] STM32H750 - Allow targets to override TARGET_FLASH. --- make/mcu/STM32H7.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/make/mcu/STM32H7.mk b/make/mcu/STM32H7.mk index db2cd584b3..a79f2d41e3 100644 --- a/make/mcu/STM32H7.mk +++ b/make/mcu/STM32H7.mk @@ -170,7 +170,11 @@ else ifeq ($(TARGET),$(filter $(TARGET),$(H750xB_TARGETS))) DEVICE_FLAGS += -DSTM32H750xx DEFAULT_LD_SCRIPT = $(LINKER_DIR)/stm32_flash_h750_128k.ld STARTUP_SRC = startup_stm32h743xx.s -TARGET_FLASH := 128 +DEFAULT_TARGET_FLASH := 128 + +ifeq ($(TARGET_FLASH),) +TARGET_FLASH := $(DEFAULT_TARGET_FLASH) +endif ifeq ($(EXST),yes) FIRMWARE_SIZE := 448