aboutsummaryrefslogtreecommitdiffstats
path: root/support/make/target-config.mk
diff options
context:
space:
mode:
Diffstat (limited to 'support/make/target-config.mk')
-rw-r--r--support/make/target-config.mk51
1 files changed, 27 insertions, 24 deletions
diff --git a/support/make/target-config.mk b/support/make/target-config.mk
index a04ca38..ea5dfd9 100644
--- a/support/make/target-config.mk
+++ b/support/make/target-config.mk
@@ -1,39 +1,42 @@
# TARGET_FLAGS are to be passed while compiling, assembling, linking.
-
TARGET_FLAGS :=
+# TARGET_LDFLAGS go to the linker
+TARGET_LDFLAGS :=
-# Board-specific configuration values. Punt these to board-specific
-# include files.
+# Configuration derived from $(MEMORY_TARGET)
-include $(BOARD_INCLUDE_DIR)/$(BOARD).mk
+LD_SCRIPT_PATH := $(LDDIR)/$(MEMORY_TARGET).ld
-TARGET_FLAGS += -DBOARD_$(BOARD) -DMCU_$(MCU) \
- -DERROR_LED_PORT=$(ERROR_LED_PORT) \
- -DERROR_LED_PIN=$(ERROR_LED_PIN)
+ifeq ($(MEMORY_TARGET), ram)
+VECT_BASE_ADDR := VECT_TAB_RAM
+endif
+ifeq ($(MEMORY_TARGET), flash)
+VECT_BASE_ADDR := VECT_TAB_FLASH
+endif
+ifeq ($(MEMORY_TARGET), jtag)
+VECT_BASE_ADDR := VECT_TAB_BASE
+endif
+
+# Pull in the board configuration file here, so it can override the
+# above.
+
+include $(BOARD_INCLUDE_DIR)/$(BOARD).mk
-# STM32 series-specific configuration values.
+# Configuration derived from $(BOARD).mk
LD_SERIES_PATH := $(LDDIR)/stm32/series/$(MCU_SERIES)
+LD_MEM_PATH := $(LDDIR)/stm32/mem/$(LD_MEM_DIR)
ifeq ($(MCU_SERIES), stm32f1)
# Due to the Balkanization on F1, we need to specify the line when
# making linker decisions.
LD_SERIES_PATH := $(LD_SERIES_PATH)/$(MCU_F1_LINE)
endif
-LIBMAPLE_MODULE_SERIES := $(LIBMAPLE_PATH)/$(MCU_SERIES)
-
-# Memory target-specific configuration values
-ifeq ($(MEMORY_TARGET), ram)
- LDSCRIPT := $(BOARD)/ram.ld
- VECT_BASE_ADDR := VECT_TAB_RAM
-endif
-ifeq ($(MEMORY_TARGET), flash)
- LDSCRIPT := $(BOARD)/flash.ld
- VECT_BASE_ADDR := VECT_TAB_FLASH
-endif
-ifeq ($(MEMORY_TARGET), jtag)
- LDSCRIPT := $(BOARD)/jtag.ld
- VECT_BASE_ADDR := VECT_TAB_BASE
-endif
+TARGET_LDFLAGS += -T$(LD_SCRIPT_PATH) -L $(LD_SERIES_PATH) \
+ -L $(LD_MEM_PATH) -L$(LDDIR)
+TARGET_FLAGS += -DBOARD_$(BOARD) -DMCU_$(MCU) \
+ -DERROR_LED_PORT=$(ERROR_LED_PORT) \
+ -DERROR_LED_PIN=$(ERROR_LED_PIN) \
+ -D$(VECT_BASE_ADDR)
-TARGET_FLAGS += -D$(VECT_BASE_ADDR)
+LIBMAPLE_MODULE_SERIES := $(LIBMAPLE_PATH)/$(MCU_SERIES)