From c5d73925fcc06ec03fe21b290e2783e3e07ba9f1 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Mon, 2 Mar 2015 23:54:43 -0800 Subject: stm32f4: series-specific linker flags Also refactors STM32F2-F4 linker files into sub-series directories. --- Makefile | 8 +- .../dynamic_efficiency/vector_symbols.inc | 100 +++++++++++++++++++++ .../series/stm32f2-f4/stm32f2/vector_symbols.inc | 98 ++++++++++++++++++++ .../ld/stm32/series/stm32f2-f4/vector_symbols.inc | 98 -------------------- support/make/target-config.mk | 4 +- 5 files changed, 205 insertions(+), 103 deletions(-) create mode 100644 support/ld/stm32/series/stm32f2-f4/dynamic_efficiency/vector_symbols.inc create mode 100644 support/ld/stm32/series/stm32f2-f4/stm32f2/vector_symbols.inc delete mode 100644 support/ld/stm32/series/stm32f2-f4/vector_symbols.inc diff --git a/Makefile b/Makefile index c4ffe26..092ebb4 100644 --- a/Makefile +++ b/Makefile @@ -66,10 +66,10 @@ GLOBAL_CFLAGS := -Os -g3 -gdwarf-2 -nostdlib \ -DBOOTLOADER_$(BOOTLOADER) GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall $(TARGET_FLAGS) GLOBAL_ASFLAGS := -x assembler-with-cpp $(TARGET_FLAGS) -LDFLAGS = $(TARGET_LDFLAGS) $(TOOLCHAIN_LDFLAGS) -mcpu=cortex-m3 -mthumb \ - -Xlinker --gc-sections \ - -Xassembler --march=armv7-m -Wall -# -Xlinker --print-gc-sections \ +LDFLAGS = $(TARGET_LDFLAGS) $(TOOLCHAIN_LDFLAGS) +LDFLAGS += -Xlinker --gc-sections +#LDFLAGS += -Xlinker --print-gc-sections +LDFLAGS += -Xassembler -Wall ## ## Set all submodules here diff --git a/support/ld/stm32/series/stm32f2-f4/dynamic_efficiency/vector_symbols.inc b/support/ld/stm32/series/stm32f2-f4/dynamic_efficiency/vector_symbols.inc new file mode 100644 index 0000000..c013784 --- /dev/null +++ b/support/ld/stm32/series/stm32f2-f4/dynamic_efficiency/vector_symbols.inc @@ -0,0 +1,100 @@ +EXTERN(__msp_init) +EXTERN(__exc_reset) +EXTERN(__exc_nmi) +EXTERN(__exc_hardfault) +EXTERN(__exc_memmanage) +EXTERN(__exc_busfault) +EXTERN(__exc_usagefault) +EXTERN(__stm32reservedexception7) +EXTERN(__stm32reservedexception8) +EXTERN(__stm32reservedexception9) +EXTERN(__stm32reservedexception10) +EXTERN(__exc_svc) +EXTERN(__exc_debug_monitor) +EXTERN(__stm32reservedexception13) +EXTERN(__exc_pendsv) +EXTERN(__exc_systick) + +EXTERN(__irq_wwdg) +EXTERN(__irq_pvd) +EXTERN(__irq_tamp_stamp) +EXTERN(__irq_rtc_wkup) +EXTERN(__irq_flash) +EXTERN(__irq_rcc) +EXTERN(__irq_exti0) +EXTERN(__irq_exti1) +EXTERN(__irq_exti2) +EXTERN(__irq_exti3) +EXTERN(__irq_exti4) +EXTERN(__irq_dma1_stream0) +EXTERN(__irq_dma1_stream1) +EXTERN(__irq_dma1_stream2) +EXTERN(__irq_dma1_stream3) +EXTERN(__irq_dma1_stream4) +EXTERN(__irq_dma1_stream5) +EXTERN(__irq_dma1_stream6) +EXTERN(__irq_adc) +EXTERN(__irq_can1_tx) +EXTERN(__irq_can1_rx0) +EXTERN(__irq_can1_rx1) +EXTERN(__irq_can1_sce) +EXTERN(__irq_exti9_5) +EXTERN(__irq_tim1_brk_tim9) +EXTERN(__irq_tim1_up_tim10) +EXTERN(__irq_tim1_trg_com_tim11) +EXTERN(__irq_tim1_cc) +EXTERN(__irq_tim2) +EXTERN(__irq_tim3) +EXTERN(__irq_tim4) +EXTERN(__irq_i2c1_ev) +EXTERN(__irq_i2c1_er) +EXTERN(__irq_i2c2_ev) +EXTERN(__irq_i2c2_er) +EXTERN(__irq_spi1) +EXTERN(__irq_spi2) +EXTERN(__irq_usart1) +EXTERN(__irq_usart2) +EXTERN(__irq_usart3) +EXTERN(__irq_exti15_10) +EXTERN(__irq_rtc_alarm) +EXTERN(__irq_otg_fs_wkup) +EXTERN(__irq_tim8_brk_tim12) +EXTERN(__irq_tim8_up_tim13) +EXTERN(__irq_tim8_trg_com_tim14) +EXTERN(__irq_tim8_cc) +EXTERN(__irq_dma1_stream7) +EXTERN(__irq_fsmc) +EXTERN(__irq_sdio) +EXTERN(__irq_tim5) +EXTERN(__irq_spi3) +EXTERN(__irq_uart4) +EXTERN(__irq_uart5) +EXTERN(__irq_tim6_dac) +EXTERN(__irq_tim7) +EXTERN(__irq_dma2_stream0) +EXTERN(__irq_dma2_stream1) +EXTERN(__irq_dma2_stream2) +EXTERN(__irq_dma2_stream3) +EXTERN(__irq_dma2_stream4) +EXTERN(__irq_eth) +EXTERN(__irq_eth_wkup) +EXTERN(__irq_can2_tx) +EXTERN(__irq_can2_rx0) +EXTERN(__irq_can2_rx1) +EXTERN(__irq_can2_sce) +EXTERN(__irq_otg_fs) +EXTERN(__irq_dma2_stream5) +EXTERN(__irq_dma2_stream6) +EXTERN(__irq_dma2_stream7) +EXTERN(__irq_usart6) +EXTERN(__irq_i2c3_ev) +EXTERN(__irq_i2c3_er) +EXTERN(__irq_otg_hs_ep1_out) +EXTERN(__irq_otg_hs_ep1_in) +EXTERN(__irq_otg_hs_wkup) +EXTERN(__irq_otg_hs) +EXTERN(__irq_dcmi) +EXTERN(__irq_cryp) +EXTERN(__irq_hash_rng) +EXTERN(__irq_fpu) +EXTERN(__irq_spi4) diff --git a/support/ld/stm32/series/stm32f2-f4/stm32f2/vector_symbols.inc b/support/ld/stm32/series/stm32f2-f4/stm32f2/vector_symbols.inc new file mode 100644 index 0000000..d275ec3 --- /dev/null +++ b/support/ld/stm32/series/stm32f2-f4/stm32f2/vector_symbols.inc @@ -0,0 +1,98 @@ +EXTERN(__msp_init) +EXTERN(__exc_reset) +EXTERN(__exc_nmi) +EXTERN(__exc_hardfault) +EXTERN(__exc_memmanage) +EXTERN(__exc_busfault) +EXTERN(__exc_usagefault) +EXTERN(__stm32reservedexception7) +EXTERN(__stm32reservedexception8) +EXTERN(__stm32reservedexception9) +EXTERN(__stm32reservedexception10) +EXTERN(__exc_svc) +EXTERN(__exc_debug_monitor) +EXTERN(__stm32reservedexception13) +EXTERN(__exc_pendsv) +EXTERN(__exc_systick) + +EXTERN(__irq_wwdg) +EXTERN(__irq_pvd) +EXTERN(__irq_tamp_stamp) +EXTERN(__irq_rtc_wkup) +EXTERN(__irq_flash) +EXTERN(__irq_rcc) +EXTERN(__irq_exti0) +EXTERN(__irq_exti1) +EXTERN(__irq_exti2) +EXTERN(__irq_exti3) +EXTERN(__irq_exti4) +EXTERN(__irq_dma1_stream0) +EXTERN(__irq_dma1_stream1) +EXTERN(__irq_dma1_stream2) +EXTERN(__irq_dma1_stream3) +EXTERN(__irq_dma1_stream4) +EXTERN(__irq_dma1_stream5) +EXTERN(__irq_dma1_stream6) +EXTERN(__irq_adc) +EXTERN(__irq_can1_tx) +EXTERN(__irq_can1_rx0) +EXTERN(__irq_can1_rx1) +EXTERN(__irq_can1_sce) +EXTERN(__irq_exti9_5) +EXTERN(__irq_tim1_brk_tim9) +EXTERN(__irq_tim1_up_tim10) +EXTERN(__irq_tim1_trg_com_tim11) +EXTERN(__irq_tim1_cc) +EXTERN(__irq_tim2) +EXTERN(__irq_tim3) +EXTERN(__irq_tim4) +EXTERN(__irq_i2c1_ev) +EXTERN(__irq_i2c1_er) +EXTERN(__irq_i2c2_ev) +EXTERN(__irq_i2c2_er) +EXTERN(__irq_spi1) +EXTERN(__irq_spi2) +EXTERN(__irq_usart1) +EXTERN(__irq_usart2) +EXTERN(__irq_usart3) +EXTERN(__irq_exti15_10) +EXTERN(__irq_rtc_alarm) +EXTERN(__irq_otg_fs_wkup) +EXTERN(__irq_tim8_brk_tim12) +EXTERN(__irq_tim8_up_tim13) +EXTERN(__irq_tim8_trg_com_tim14) +EXTERN(__irq_tim8_cc) +EXTERN(__irq_dma1_stream7) +EXTERN(__irq_fsmc) +EXTERN(__irq_sdio) +EXTERN(__irq_tim5) +EXTERN(__irq_spi3) +EXTERN(__irq_uart4) +EXTERN(__irq_uart5) +EXTERN(__irq_tim6_dac) +EXTERN(__irq_tim7) +EXTERN(__irq_dma2_stream0) +EXTERN(__irq_dma2_stream1) +EXTERN(__irq_dma2_stream2) +EXTERN(__irq_dma2_stream3) +EXTERN(__irq_dma2_stream4) +EXTERN(__irq_eth) +EXTERN(__irq_eth_wkup) +EXTERN(__irq_can2_tx) +EXTERN(__irq_can2_rx0) +EXTERN(__irq_can2_rx1) +EXTERN(__irq_can2_sce) +EXTERN(__irq_otg_fs) +EXTERN(__irq_dma2_stream5) +EXTERN(__irq_dma2_stream6) +EXTERN(__irq_dma2_stream7) +EXTERN(__irq_usart6) +EXTERN(__irq_i2c3_ev) +EXTERN(__irq_i2c3_er) +EXTERN(__irq_otg_hs_ep1_out) +EXTERN(__irq_otg_hs_ep1_in) +EXTERN(__irq_otg_hs_wkup) +EXTERN(__irq_otg_hs) +EXTERN(__irq_dcmi) +EXTERN(__irq_cryp) +EXTERN(__irq_hash_rng) diff --git a/support/ld/stm32/series/stm32f2-f4/vector_symbols.inc b/support/ld/stm32/series/stm32f2-f4/vector_symbols.inc deleted file mode 100644 index d275ec3..0000000 --- a/support/ld/stm32/series/stm32f2-f4/vector_symbols.inc +++ /dev/null @@ -1,98 +0,0 @@ -EXTERN(__msp_init) -EXTERN(__exc_reset) -EXTERN(__exc_nmi) -EXTERN(__exc_hardfault) -EXTERN(__exc_memmanage) -EXTERN(__exc_busfault) -EXTERN(__exc_usagefault) -EXTERN(__stm32reservedexception7) -EXTERN(__stm32reservedexception8) -EXTERN(__stm32reservedexception9) -EXTERN(__stm32reservedexception10) -EXTERN(__exc_svc) -EXTERN(__exc_debug_monitor) -EXTERN(__stm32reservedexception13) -EXTERN(__exc_pendsv) -EXTERN(__exc_systick) - -EXTERN(__irq_wwdg) -EXTERN(__irq_pvd) -EXTERN(__irq_tamp_stamp) -EXTERN(__irq_rtc_wkup) -EXTERN(__irq_flash) -EXTERN(__irq_rcc) -EXTERN(__irq_exti0) -EXTERN(__irq_exti1) -EXTERN(__irq_exti2) -EXTERN(__irq_exti3) -EXTERN(__irq_exti4) -EXTERN(__irq_dma1_stream0) -EXTERN(__irq_dma1_stream1) -EXTERN(__irq_dma1_stream2) -EXTERN(__irq_dma1_stream3) -EXTERN(__irq_dma1_stream4) -EXTERN(__irq_dma1_stream5) -EXTERN(__irq_dma1_stream6) -EXTERN(__irq_adc) -EXTERN(__irq_can1_tx) -EXTERN(__irq_can1_rx0) -EXTERN(__irq_can1_rx1) -EXTERN(__irq_can1_sce) -EXTERN(__irq_exti9_5) -EXTERN(__irq_tim1_brk_tim9) -EXTERN(__irq_tim1_up_tim10) -EXTERN(__irq_tim1_trg_com_tim11) -EXTERN(__irq_tim1_cc) -EXTERN(__irq_tim2) -EXTERN(__irq_tim3) -EXTERN(__irq_tim4) -EXTERN(__irq_i2c1_ev) -EXTERN(__irq_i2c1_er) -EXTERN(__irq_i2c2_ev) -EXTERN(__irq_i2c2_er) -EXTERN(__irq_spi1) -EXTERN(__irq_spi2) -EXTERN(__irq_usart1) -EXTERN(__irq_usart2) -EXTERN(__irq_usart3) -EXTERN(__irq_exti15_10) -EXTERN(__irq_rtc_alarm) -EXTERN(__irq_otg_fs_wkup) -EXTERN(__irq_tim8_brk_tim12) -EXTERN(__irq_tim8_up_tim13) -EXTERN(__irq_tim8_trg_com_tim14) -EXTERN(__irq_tim8_cc) -EXTERN(__irq_dma1_stream7) -EXTERN(__irq_fsmc) -EXTERN(__irq_sdio) -EXTERN(__irq_tim5) -EXTERN(__irq_spi3) -EXTERN(__irq_uart4) -EXTERN(__irq_uart5) -EXTERN(__irq_tim6_dac) -EXTERN(__irq_tim7) -EXTERN(__irq_dma2_stream0) -EXTERN(__irq_dma2_stream1) -EXTERN(__irq_dma2_stream2) -EXTERN(__irq_dma2_stream3) -EXTERN(__irq_dma2_stream4) -EXTERN(__irq_eth) -EXTERN(__irq_eth_wkup) -EXTERN(__irq_can2_tx) -EXTERN(__irq_can2_rx0) -EXTERN(__irq_can2_rx1) -EXTERN(__irq_can2_sce) -EXTERN(__irq_otg_fs) -EXTERN(__irq_dma2_stream5) -EXTERN(__irq_dma2_stream6) -EXTERN(__irq_dma2_stream7) -EXTERN(__irq_usart6) -EXTERN(__irq_i2c3_ev) -EXTERN(__irq_i2c3_er) -EXTERN(__irq_otg_hs_ep1_out) -EXTERN(__irq_otg_hs_ep1_in) -EXTERN(__irq_otg_hs_wkup) -EXTERN(__irq_otg_hs) -EXTERN(__irq_dcmi) -EXTERN(__irq_cryp) -EXTERN(__irq_hash_rng) diff --git a/support/make/target-config.mk b/support/make/target-config.mk index ac5845d..9f7ce7b 100644 --- a/support/make/target-config.mk +++ b/support/make/target-config.mk @@ -46,16 +46,18 @@ TARGET_FLAGS += -mcpu=cortex-m3 -march=armv7-m LD_SERIES_PATH := $(LD_SERIES_PATH)/$(MCU_F1_LINE) endif ifeq ($(MCU_SERIES), stm32f2) +LD_SERIES_PATH := $(LD_SERIES_PATH)/stm32f2 TARGET_FLAGS += -mcpu=cortex-m3 -march=armv7-m endif ifeq ($(MCU_SERIES), stm32f4) TARGET_FLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 +LD_SERIES_PATH := $(LD_SERIES_PATH)/$(MCU_F4_LINE) endif TARGET_LDFLAGS += -Xlinker -T$(LD_SCRIPT_PATH) \ -L $(LD_SERIES_PATH) \ -L $(LD_MEM_PATH) \ - -L $(LDDIR) + -L $(LDDIR) $(TARGET_FLAGS) -mthumb TARGET_FLAGS += -mthumb -DBOARD_$(BOARD) -DMCU_$(MCU) \ -DERROR_LED_PORT=$(ERROR_LED_PORT) \ -DERROR_LED_PIN=$(ERROR_LED_PIN) \ -- cgit v1.2.3