aboutsummaryrefslogtreecommitdiffstats
path: root/support/make
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-26 18:24:49 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-26 18:32:57 -0400
commitf005bd3a5c087e3d5559f2858a1e7898a4f92a8d (patch)
tree0701628a68056f7b5f92d5a5af5f281f58e6a71e /support/make
parent761e059962e8f53f3cceef61d65bf2bf3025319a (diff)
parentc6073e4886da4606679bc3e9d770c9cff9390597 (diff)
downloadlibrambutan-f005bd3a5c087e3d5559f2858a1e7898a4f92a8d.tar.gz
librambutan-f005bd3a5c087e3d5559f2858a1e7898a4f92a8d.zip
Merge branch 'wip-family-support'
Merge the long-lived (too long; future changes like these will need to proceed more incrementally) development branch of libmaple, containing experimental STM32F2 and STM32F1 value line support, into master. This required many changes to the structure of the library. The most important structural reorganizations occurred in: - 954f9e5: moves public headers to include directories - 3efa313: uses "series" instead of "family" - c0d60e3: adds board files to the build system, to make it easier to add new boards - 096d86c: adds build logic for targeting different STM32 series (e.g. STM32F1, STM32F2) This last commit in particular (096d86c) is the basis for the repartitioning of libmaple into portable sections, which work on all supported MCUs, and nonportable sections, which are segregated into separate directories and contain all series-specific code. Moving existing STM32F1-only code into libmaple/stm32f1 and wirish/stm32f1, along with adding equivalents under .../stm32f2 directories, was the principal project of this branch. Important API changes occur in several places. Existing code is still expected to work on STM32F1 targets, but there have been many deprecations. A detailed changelog explaining the situation needs to be prepared. F2 and F1 value line support is not complete; the merge is proceeding prematurely in this respect. We've been getting more libmaple patches from the community lately, and I'm worried that the merge conflicts with the old tree structure will become painful to manage. Conflicts: Makefile Resolved Makefile conflicts manually; this required propagating -Xlinker usage into support/make/target-config.mk. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'support/make')
-rw-r--r--support/make/board-includes/VLDiscovery.mk7
-rw-r--r--support/make/board-includes/maple.mk10
-rw-r--r--support/make/board-includes/maple_RET6.mk7
-rw-r--r--support/make/board-includes/maple_mini.mk7
-rw-r--r--support/make/board-includes/maple_native.mk7
-rw-r--r--support/make/board-includes/olimex_stm32_h103.mk7
-rw-r--r--support/make/board-includes/st_stm3220g_eval.mk5
-rw-r--r--support/make/build-rules.mk1
-rw-r--r--support/make/build-templates.mk1
-rw-r--r--support/make/target-config.mk97
10 files changed, 83 insertions, 66 deletions
diff --git a/support/make/board-includes/VLDiscovery.mk b/support/make/board-includes/VLDiscovery.mk
new file mode 100644
index 0000000..76cd85a
--- /dev/null
+++ b/support/make/board-includes/VLDiscovery.mk
@@ -0,0 +1,7 @@
+MCU := STM32F100RB
+PRODUCT_ID := 0003
+ERROR_LED_PORT := GPIOC
+ERROR_LED_PIN := 9
+MCU_SERIES := stm32f1
+MCU_F1_LINE := value
+LD_MEM_DIR := sram_8k_flash_128k
diff --git a/support/make/board-includes/maple.mk b/support/make/board-includes/maple.mk
new file mode 100644
index 0000000..a2943ce
--- /dev/null
+++ b/support/make/board-includes/maple.mk
@@ -0,0 +1,10 @@
+MCU := STM32F103RB
+PRODUCT_ID := 0003
+ERROR_LED_PORT := GPIOA
+ERROR_LED_PIN := 5
+MCU_SERIES := stm32f1
+MCU_F1_LINE := performance
+# This crap is due to ld-script limitations. If you know of a better
+# way to go about this (like some magic ld switches to specify MEMORY
+# at the command line), please tell us!
+LD_MEM_DIR := sram_20k_flash_128k
diff --git a/support/make/board-includes/maple_RET6.mk b/support/make/board-includes/maple_RET6.mk
new file mode 100644
index 0000000..138722f
--- /dev/null
+++ b/support/make/board-includes/maple_RET6.mk
@@ -0,0 +1,7 @@
+MCU := STM32F103RE
+PRODUCT_ID := 0003
+ERROR_LED_PORT := GPIOA
+ERROR_LED_PIN := 5
+MCU_SERIES := stm32f1
+MCU_F1_LINE := performance
+LD_MEM_DIR := sram_64k_flash_512k
diff --git a/support/make/board-includes/maple_mini.mk b/support/make/board-includes/maple_mini.mk
new file mode 100644
index 0000000..b022537
--- /dev/null
+++ b/support/make/board-includes/maple_mini.mk
@@ -0,0 +1,7 @@
+MCU := STM32F103CB
+PRODUCT_ID := 0003
+ERROR_LED_PORT := GPIOB
+ERROR_LED_PIN := 1
+MCU_SERIES := stm32f1
+MCU_F1_LINE := performance
+LD_MEM_DIR := sram_20k_flash_128k
diff --git a/support/make/board-includes/maple_native.mk b/support/make/board-includes/maple_native.mk
new file mode 100644
index 0000000..87e58e3
--- /dev/null
+++ b/support/make/board-includes/maple_native.mk
@@ -0,0 +1,7 @@
+MCU := STM32F103ZE
+PRODUCT_ID := 0003
+ERROR_LED_PORT := GPIOC
+ERROR_LED_PIN := 15
+MCU_SERIES := stm32f1
+MCU_F1_LINE := performance
+LD_MEM_DIR := maple_native # The SRAM chip makes this board special
diff --git a/support/make/board-includes/olimex_stm32_h103.mk b/support/make/board-includes/olimex_stm32_h103.mk
new file mode 100644
index 0000000..a3304a1
--- /dev/null
+++ b/support/make/board-includes/olimex_stm32_h103.mk
@@ -0,0 +1,7 @@
+MCU := STM32F103RB
+PRODUCT_ID := 0003
+ERROR_LED_PORT := GPIOC
+ERROR_LED_PIN := 12
+MCU_SERIES := stm32f1
+MCU_F1_LINE := performance
+LD_MEM_DIR := sram_20k_flash_128k
diff --git a/support/make/board-includes/st_stm3220g_eval.mk b/support/make/board-includes/st_stm3220g_eval.mk
new file mode 100644
index 0000000..8aaefc9
--- /dev/null
+++ b/support/make/board-includes/st_stm3220g_eval.mk
@@ -0,0 +1,5 @@
+MCU := STM32F207IG
+ERROR_LED_PORT := GPIOG
+ERROR_LED_PIN := 6
+MCU_SERIES := stm32f2
+LD_MEM_DIR := sram_112k_flash_1024k
diff --git a/support/make/build-rules.mk b/support/make/build-rules.mk
index 330cdd8..3d541ba 100644
--- a/support/make/build-rules.mk
+++ b/support/make/build-rules.mk
@@ -9,7 +9,6 @@ DISAS := arm-none-eabi-objdump
OBJDUMP := arm-none-eabi-objdump
SIZE := arm-none-eabi-size
DFU := dfu-util
-OPENOCD_WRAPPER := support/scripts/openocd-wrapper.sh
# Suppress annoying output unless V is set
ifndef V
diff --git a/support/make/build-templates.mk b/support/make/build-templates.mk
index fcf83a1..4371f13 100644
--- a/support/make/build-templates.mk
+++ b/support/make/build-templates.mk
@@ -1,6 +1,5 @@
define LIBMAPLE_MODULE_template
dir := $(1)
-LIBMAPLE_INCLUDES += -I$$(dir)
include $$(dir)/rules.mk
endef
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)