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.mk97
1 files changed, 33 insertions, 64 deletions
diff --git a/support/make/target-config.mk b/support/make/target-config.mk
index 592e808..278ca3f 100644
--- a/support/make/target-config.mk
+++ b/support/make/target-config.mk
@@ -1,75 +1,44 @@
-# Board-specific configuration values. Flash and SRAM sizes in bytes.
+# TARGET_FLAGS are to be passed while compiling, assembling, linking.
+TARGET_FLAGS :=
+# TARGET_LDFLAGS go to the linker
+TARGET_LDFLAGS :=
-ifeq ($(BOARD), maple)
- MCU := STM32F103RB
- PRODUCT_ID := 0003
- ERROR_LED_PORT := GPIOA
- ERROR_LED_PIN := 5
- DENSITY := STM32_MEDIUM_DENSITY
- FLASH_SIZE := 131072
- SRAM_SIZE := 20480
-endif
+# Configuration derived from $(MEMORY_TARGET)
-ifeq ($(BOARD), maple_native)
- MCU := STM32F103ZE
- PRODUCT_ID := 0003
- ERROR_LED_PORT := GPIOC
- ERROR_LED_PIN := 15
- DENSITY := STM32_HIGH_DENSITY
- FLASH_SIZE := 524288
- SRAM_SIZE := 65536
-endif
+LD_SCRIPT_PATH := $(LDDIR)/$(MEMORY_TARGET).ld
-ifeq ($(BOARD), maple_mini)
- MCU := STM32F103CB
- PRODUCT_ID := 0003
- ERROR_LED_PORT := GPIOB
- ERROR_LED_PIN := 1
- DENSITY := STM32_MEDIUM_DENSITY
- FLASH_SIZE := 131072
- SRAM_SIZE := 20480
+ifeq ($(MEMORY_TARGET), ram)
+VECT_BASE_ADDR := VECT_TAB_RAM
endif
-
-ifeq ($(BOARD), maple_RET6)
- MCU := STM32F103RE
- PRODUCT_ID := 0003
- ERROR_LED_PORT := GPIOA
- ERROR_LED_PIN := 5
- DENSITY := STM32_HIGH_DENSITY
- FLASH_SIZE := 524288
- SRAM_SIZE := 65536
+ifeq ($(MEMORY_TARGET), flash)
+VECT_BASE_ADDR := VECT_TAB_FLASH
endif
-
-ifeq ($(BOARD), olimex_stm32_h103)
- MCU := STM32F103RB
- PRODUCT_ID := 0003
- ERROR_LED_PORT := GPIOC
- ERROR_LED_PIN := 12
- DENSITY := STM32_MEDIUM_DENSITY
- FLASH_SIZE := 131072
- SRAM_SIZE := 20480
+ifeq ($(MEMORY_TARGET), jtag)
+VECT_BASE_ADDR := VECT_TAB_BASE
endif
-# STM32 family-specific configuration values.
+# Pull in the board configuration file here, so it can override the
+# above.
-# NB: these only work for STM32F1 performance line chips, but those
-# are the only ones we support at this time. If you add support for
-# STM32F1 connectivity line MCUs or other STM32 families, this section
-# will need to change.
-LD_FAMILY_PATH := $(LDDIR)/stm32/f1/performance
-LIBMAPLE_MODULE_FAMILY := $(LIBMAPLE_PATH)/stm32f1
+include $(BOARD_INCLUDE_DIR)/$(BOARD).mk
-# Memory target-specific configuration values
+# Configuration derived from $(BOARD).mk
-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
+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
+
+TARGET_LDFLAGS += -Xlinker -T$(LD_SCRIPT_PATH) \
+ -Xlinker -L $(LD_SERIES_PATH) \
+ -Xlinker -L $(LD_MEM_PATH) \
+ -Xlinker -L$(LDDIR)
+TARGET_FLAGS += -DBOARD_$(BOARD) -DMCU_$(MCU) \
+ -DERROR_LED_PORT=$(ERROR_LED_PORT) \
+ -DERROR_LED_PIN=$(ERROR_LED_PIN) \
+ -D$(VECT_BASE_ADDR)
+
+LIBMAPLE_MODULE_SERIES := $(LIBMAPLE_PATH)/$(MCU_SERIES)