aboutsummaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
Diffstat (limited to 'support')
-rw-r--r--support/doxygen/Doxyfile18
-rwxr-xr-xsupport/doxygen/evil_mangler.awk38
-rw-r--r--support/ld/flash.ld26
-rw-r--r--support/ld/jtag.ld31
-rw-r--r--support/ld/maple/flash.ld24
-rw-r--r--support/ld/maple/jtag.ld24
-rw-r--r--support/ld/maple/ram.ld22
-rw-r--r--support/ld/maple_RET6/flash.ld18
-rw-r--r--support/ld/maple_RET6/jtag.ld18
-rw-r--r--support/ld/maple_RET6/ram.ld17
-rw-r--r--support/ld/maple_mini/flash.ld23
-rw-r--r--support/ld/maple_mini/jtag.ld24
-rw-r--r--support/ld/maple_mini/ram.ld22
-rw-r--r--support/ld/maple_native/flash.ld22
-rw-r--r--support/ld/maple_native/jtag.ld22
-rw-r--r--support/ld/maple_native/ram.ld20
l---------support/ld/olimex_stm32_h1031
-rw-r--r--support/ld/ram.ld25
-rw-r--r--support/ld/stm32/mem/maple_native/maple_native_heap.inc3
-rw-r--r--support/ld/stm32/mem/maple_native/mem-flash.inc7
-rw-r--r--support/ld/stm32/mem/maple_native/mem-jtag.inc7
-rw-r--r--support/ld/stm32/mem/maple_native/mem-ram.inc7
-rw-r--r--support/ld/stm32/mem/sram_112k_flash_1024k/mem-jtag.inc5
-rw-r--r--support/ld/stm32/mem/sram_112k_flash_1024k/mem-ram.inc5
-rw-r--r--support/ld/stm32/mem/sram_20k_flash_128k/mem-flash.inc5
-rw-r--r--support/ld/stm32/mem/sram_20k_flash_128k/mem-jtag.inc5
-rw-r--r--support/ld/stm32/mem/sram_20k_flash_128k/mem-ram.inc5
-rw-r--r--support/ld/stm32/mem/sram_64k_flash_512k/mem-flash.inc5
-rw-r--r--support/ld/stm32/mem/sram_64k_flash_512k/mem-jtag.inc5
-rw-r--r--support/ld/stm32/mem/sram_64k_flash_512k/mem-ram.inc5
-rw-r--r--support/ld/stm32/mem/sram_8k_flash_128k/mem-flash.inc5
-rw-r--r--support/ld/stm32/mem/sram_8k_flash_128k/mem-jtag.inc5
-rw-r--r--support/ld/stm32/mem/sram_8k_flash_128k/mem-ram.inc5
-rw-r--r--support/ld/stm32/series/stm32f1/performance/vector_symbols.inc (renamed from support/ld/stm32/f1/performance/vector_symbols.inc)0
-rw-r--r--support/ld/stm32/series/stm32f1/value/vector_symbols.inc78
-rw-r--r--support/ld/stm32/series/stm32f2/vector_symbols.inc98
-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
-rw-r--r--support/openocd/debug_0.3.cfg75
-rw-r--r--support/openocd/debug_0.4.cfg75
-rw-r--r--support/openocd/flash_0.3.cfg89
-rw-r--r--support/openocd/flash_0.4.cfg95
-rwxr-xr-xsupport/scripts/openocd-wrapper.sh16
51 files changed, 470 insertions, 679 deletions
diff --git a/support/doxygen/Doxyfile b/support/doxygen/Doxyfile
index 67b7692..daeaf38 100644
--- a/support/doxygen/Doxyfile
+++ b/support/doxygen/Doxyfile
@@ -263,7 +263,7 @@ IDL_PROPERTY_SUPPORT = YES
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
-DISTRIBUTE_GROUP_DOC = NO
+DISTRIBUTE_GROUP_DOC = YES
# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
# the same type (for instance a group of public functions) to be put as a
@@ -281,7 +281,7 @@ SUBGROUPING = YES
# be useful for C code in case the coding convention dictates that all compound
# types are typedef'ed and only the typedef is referenced, never the tag name.
-TYPEDEF_HIDES_STRUCT = YES
+TYPEDEF_HIDES_STRUCT = NO
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
# determine which symbols to keep in memory and which to flush to disk.
@@ -537,7 +537,7 @@ LAYOUT_FILE =
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
-QUIET = NO
+QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
@@ -549,7 +549,7 @@ WARNINGS = YES
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
# automatically be disabled.
-WARN_IF_UNDOCUMENTED = YES
+WARN_IF_UNDOCUMENTED = NO
# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some
@@ -690,7 +690,9 @@ INPUT_FILTER =
# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
# is applied to all files.
-FILTER_PATTERNS =
+# Trick Doxygen into thinking series headers are in separate
+# namespaces; see the Evil Mangler source for more information.
+FILTER_PATTERNS = */libmaple/stm32*/include/series/*.h=./support/doxygen/evil_mangler.awk
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will be used to filter the input files when producing source
@@ -1373,11 +1375,15 @@ INCLUDE_FILE_PATTERNS =
# instead of the = operator.
PREDEFINED = __attribute__()= \
+ __deprecated= \
+ __always_inline= \
+ __packed = \
+ __weak = \
__cplusplus \
STM32_MEDIUM_DENSITY \
STM32_HIGH_DENSITY \
STM32_XL_DENSITY \
- __DOXYGEN_PREDEFINED_HACK
+ __DOXYGEN__
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
diff --git a/support/doxygen/evil_mangler.awk b/support/doxygen/evil_mangler.awk
new file mode 100755
index 0000000..b07da72
--- /dev/null
+++ b/support/doxygen/evil_mangler.awk
@@ -0,0 +1,38 @@
+#!/usr/bin/awk -f
+
+# libmaple's own Evil Mangler
+#
+# Input filter hack to trick Doxygen into thinking that a series
+# header is in a separate namespace. This is necessary because Doxygen
+# doesn't know how to cope with two data structures with the same name
+# in different places in the project. (We do that all the time,
+# e.g. for foo_reg_map structs.)
+#
+# E.g., an STM32F1 header gets transformed into:
+#
+# namespace stm32f1 {
+# <contents of header>
+# }
+
+BEGIN {
+ # For extracting series component from header FILENAME.
+ series_regex = "/stm32[flw][0-9]*/";
+ # Holds header FILENAME. Cargo-culted; not sure why it's necessary.
+ f = "";
+ # Holds series component.
+ series = "";
+}
+{
+ if (f != FILENAME) {
+ f = FILENAME;
+ match(f, series_regex);
+ series = substr(f, RSTART + 1, RLENGTH - 2);
+ printf("namespace %s {\n", series);
+ }
+ print;
+}
+END {
+ if (series != "") {
+ print "}"
+ }
+}
diff --git a/support/ld/flash.ld b/support/ld/flash.ld
new file mode 100644
index 0000000..9e250cd
--- /dev/null
+++ b/support/ld/flash.ld
@@ -0,0 +1,26 @@
+/*
+ * libmaple linker script for "Flash" builds.
+ *
+ * A Flash build puts .text (and .rodata) in Flash, and
+ * .data/.bss/heap (of course) in SRAM, but offsets the sections by
+ * enough space to store the Maple bootloader, which lives in low
+ * Flash and uses low memory.
+ */
+
+/*
+ * This pulls in the appropriate MEMORY declaration from the right
+ * subdirectory of stm32/mem/ (the environment must call ld with the
+ * right include directory flags to make this happen). Boards can also
+ * use this file to use any of libmaple's memory-related hooks (like
+ * where the heap should live).
+ */
+INCLUDE mem-flash.inc
+
+/* Provide memory region aliases for common.inc */
+REGION_ALIAS("REGION_TEXT", rom);
+REGION_ALIAS("REGION_DATA", ram);
+REGION_ALIAS("REGION_BSS", ram);
+REGION_ALIAS("REGION_RODATA", rom);
+
+/* Let common.inc handle the real work. */
+INCLUDE common.inc
diff --git a/support/ld/jtag.ld b/support/ld/jtag.ld
new file mode 100644
index 0000000..0612f95
--- /dev/null
+++ b/support/ld/jtag.ld
@@ -0,0 +1,31 @@
+/*
+ * libmaple linker script for "JTAG" builds.
+ *
+ * A "JTAG" build puts .text (and .rodata) in Flash, and
+ * .data/.bss/heap (of course) in SRAM, but links starting at the
+ * Flash and SRAM starting addresses (0x08000000 and 0x20000000
+ * respectively). This will wipe out a Maple bootloader if there's one
+ * on the board, so only use this if you know what you're doing.
+ *
+ * Of course, a "JTAG" build is perfectly usable for upload over SWD,
+ * the system memory bootloader, etc. The name is just a historical
+ * artifact.
+ */
+
+/*
+ * This pulls in the appropriate MEMORY declaration from the right
+ * subdirectory of stm32/mem/ (the environment must call ld with the
+ * right include directory flags to make this happen). Boards can also
+ * use this file to use any of libmaple's memory-related hooks (like
+ * where the heap should live).
+ */
+INCLUDE mem-jtag.inc
+
+/* Provide memory region aliases for common.inc */
+REGION_ALIAS("REGION_TEXT", rom);
+REGION_ALIAS("REGION_DATA", ram);
+REGION_ALIAS("REGION_BSS", ram);
+REGION_ALIAS("REGION_RODATA", rom);
+
+/* Let common.inc handle the real work. */
+INCLUDE common.inc
diff --git a/support/ld/maple/flash.ld b/support/ld/maple/flash.ld
deleted file mode 100644
index 190c187..0000000
--- a/support/ld/maple/flash.ld
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Maple (STM32F103RBT6, medium density) linker script for Flash builds.
- */
-
-/*
- * Define memory spaces.
- */
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
- rom (rx) : ORIGIN = 0x08005000, LENGTH = 108K
-}
-
-REGION_ALIAS("REGION_TEXT", rom);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", rom);
-
-/*
- * Define the rest of the sections
- */
-_FLASH_BUILD = 1;
-
-INCLUDE common.inc
diff --git a/support/ld/maple/jtag.ld b/support/ld/maple/jtag.ld
deleted file mode 100644
index c090988..0000000
--- a/support/ld/maple/jtag.ld
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Maple (STM32F103RBT6, medium density) linker script for JTAG (bare
- * metal, no bootloader) builds.
- */
-
-/*
- * Define memory spaces.
- */
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
- rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K
-}
-
-REGION_ALIAS("REGION_TEXT", rom);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", rom);
-
-/*
- * Define the rest of the sections
- */
-_FLASH_BUILD = 1;
-INCLUDE common.inc
diff --git a/support/ld/maple/ram.ld b/support/ld/maple/ram.ld
deleted file mode 100644
index a5ef621..0000000
--- a/support/ld/maple/ram.ld
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Maple (STM32F103RBT6, medium density) linker script for RAM builds.
- */
-
-/*
- * Define memory spaces.
- */
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
- rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K
-}
-
-REGION_ALIAS("REGION_TEXT", ram);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", ram);
-
-/*
- * Define the rest of the sections
- */
-INCLUDE common.inc
diff --git a/support/ld/maple_RET6/flash.ld b/support/ld/maple_RET6/flash.ld
deleted file mode 100644
index 8b529f8..0000000
--- a/support/ld/maple_RET6/flash.ld
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Maple RET6 Edition (STM32F103RET6, high density) linker script for
- * Flash builds.
- */
-
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
- rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K
-}
-
-REGION_ALIAS("REGION_TEXT", rom);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", rom);
-
-_FLASH_BUILD = 1;
-INCLUDE common.inc
diff --git a/support/ld/maple_RET6/jtag.ld b/support/ld/maple_RET6/jtag.ld
deleted file mode 100644
index 4ac9d76..0000000
--- a/support/ld/maple_RET6/jtag.ld
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Maple RET6 Edition (STM32F103RET6, high density) linker script for
- * JTAG (bare metal, no bootloader) builds.
- */
-
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
- rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K
-}
-
-REGION_ALIAS("REGION_TEXT", rom);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", rom);
-
-_FLASH_BUILD = 1;
-INCLUDE common.inc
diff --git a/support/ld/maple_RET6/ram.ld b/support/ld/maple_RET6/ram.ld
deleted file mode 100644
index 65c3a2c..0000000
--- a/support/ld/maple_RET6/ram.ld
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Maple RET6 Edition (STM32F103RET6, high density) linker script for
- * RAM builds.
- */
-
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
- rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K
-}
-
-REGION_ALIAS("REGION_TEXT", ram);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", ram);
-
-INCLUDE common.inc
diff --git a/support/ld/maple_mini/flash.ld b/support/ld/maple_mini/flash.ld
deleted file mode 100644
index 52d01dc..0000000
--- a/support/ld/maple_mini/flash.ld
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Maple Mini (STM32F103CBT6, medium density) linker script for Flash builds.
- */
-
-/*
- * Define memory spaces.
- */
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
- rom (rx) : ORIGIN = 0x08005000, LENGTH = 108K
-}
-
-REGION_ALIAS("REGION_TEXT", rom);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", rom);
-
-/*
- * Define the rest of the sections
- */
-_FLASH_BUILD = 1;
-INCLUDE common.inc
diff --git a/support/ld/maple_mini/jtag.ld b/support/ld/maple_mini/jtag.ld
deleted file mode 100644
index 28e204f..0000000
--- a/support/ld/maple_mini/jtag.ld
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Maple Mini (STM32F103CBT6, medium density) linker script for JTAG
- * (bare metal, no bootloader) builds.
- */
-
-/*
- * Define memory spaces.
- */
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
- rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K
-}
-
-REGION_ALIAS("REGION_TEXT", rom);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", rom);
-
-/*
- * Define the rest of the sections
- */
-_FLASH_BUILD = 1;
-INCLUDE common.inc
diff --git a/support/ld/maple_mini/ram.ld b/support/ld/maple_mini/ram.ld
deleted file mode 100644
index 5b0111b..0000000
--- a/support/ld/maple_mini/ram.ld
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Maple Mini (STM32F103CBT6, medium density) linker script for RAM builds.
- */
-
-/*
- * Define memory spaces.
- */
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
- rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K
-}
-
-REGION_ALIAS("REGION_TEXT", ram);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", ram);
-
-/*
- * Define the rest of the sections
- */
-INCLUDE common.inc
diff --git a/support/ld/maple_native/flash.ld b/support/ld/maple_native/flash.ld
deleted file mode 100644
index aac5325..0000000
--- a/support/ld/maple_native/flash.ld
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Maple Native (STM32F103ZET6, high density) linker script for Flash builds.
- */
-
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
- rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K
-}
-
-REGION_ALIAS("REGION_TEXT", rom);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", rom);
-
-/* Specify heap boundary addresses on the external SRAM chip */
-_lm_heap_start = 0x60000000;
-_lm_heap_end = 0x60100000;
-
-_FLASH_BUILD = 1;
-INCLUDE common.inc
-
diff --git a/support/ld/maple_native/jtag.ld b/support/ld/maple_native/jtag.ld
deleted file mode 100644
index 412348e..0000000
--- a/support/ld/maple_native/jtag.ld
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Maple Native (STM32F103ZET6, high density) linker script for JTAG
- * (bare metal, no bootloader) builds.
- */
-
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
- rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K
-}
-
-REGION_ALIAS("REGION_TEXT", rom);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", rom);
-
-/* Specify heap boundary addresses on the external SRAM chip */
-_lm_heap_start = 0x60000000;
-_lm_heap_end = 0x60100000;
-
-_FLASH_BUILD = 1;
-INCLUDE common.inc
diff --git a/support/ld/maple_native/ram.ld b/support/ld/maple_native/ram.ld
deleted file mode 100644
index eeec761..0000000
--- a/support/ld/maple_native/ram.ld
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Maple Native (STM32F103ZET6, high density) linker script for RAM builds.
- */
-
-MEMORY
-{
- ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
- rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K
-}
-
-REGION_ALIAS("REGION_TEXT", ram);
-REGION_ALIAS("REGION_DATA", ram);
-REGION_ALIAS("REGION_BSS", ram);
-REGION_ALIAS("REGION_RODATA", ram);
-
-/* Specify heap boundary addresses on the external SRAM chip */
-_lm_heap_start = 0x60000000;
-_lm_heap_end = 0x60100000;
-
-INCLUDE common.inc
diff --git a/support/ld/olimex_stm32_h103 b/support/ld/olimex_stm32_h103
deleted file mode 120000
index 2d8bbed..0000000
--- a/support/ld/olimex_stm32_h103
+++ /dev/null
@@ -1 +0,0 @@
-maple \ No newline at end of file
diff --git a/support/ld/ram.ld b/support/ld/ram.ld
new file mode 100644
index 0000000..34b468e
--- /dev/null
+++ b/support/ld/ram.ld
@@ -0,0 +1,25 @@
+/*
+ * libmaple linker script for RAM builds.
+ *
+ * A Flash build puts .text, .rodata, and .data/.bss/heap (of course)
+ * in SRAM, but offsets the sections by enough space to store the
+ * Maple bootloader, which uses low memory.
+ */
+
+/*
+ * This pulls in the appropriate MEMORY declaration from the right
+ * subdirectory of stm32/mem/ (the environment must call ld with the
+ * right include directory flags to make this happen). Boards can also
+ * use this file to use any of libmaple's memory-related hooks (like
+ * where the heap should live).
+ */
+INCLUDE mem-ram.inc
+
+/* Provide memory region aliases for common.inc */
+REGION_ALIAS("REGION_TEXT", ram);
+REGION_ALIAS("REGION_DATA", ram);
+REGION_ALIAS("REGION_BSS", ram);
+REGION_ALIAS("REGION_RODATA", ram);
+
+/* Let common.inc handle the real work. */
+INCLUDE common.inc
diff --git a/support/ld/stm32/mem/maple_native/maple_native_heap.inc b/support/ld/stm32/mem/maple_native/maple_native_heap.inc
new file mode 100644
index 0000000..34b5a2d
--- /dev/null
+++ b/support/ld/stm32/mem/maple_native/maple_native_heap.inc
@@ -0,0 +1,3 @@
+/* Specify heap boundary addresses on the external SRAM chip */
+_lm_heap_start = 0x60000000;
+_lm_heap_end = 0x60100000;
diff --git a/support/ld/stm32/mem/maple_native/mem-flash.inc b/support/ld/stm32/mem/maple_native/mem-flash.inc
new file mode 100644
index 0000000..bae4f39
--- /dev/null
+++ b/support/ld/stm32/mem/maple_native/mem-flash.inc
@@ -0,0 +1,7 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
+ rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K
+}
+
+INCLUDE maple_native_heap.inc
diff --git a/support/ld/stm32/mem/maple_native/mem-jtag.inc b/support/ld/stm32/mem/maple_native/mem-jtag.inc
new file mode 100644
index 0000000..508ed44
--- /dev/null
+++ b/support/ld/stm32/mem/maple_native/mem-jtag.inc
@@ -0,0 +1,7 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K
+}
+
+INCLUDE maple_native_heap.inc
diff --git a/support/ld/stm32/mem/maple_native/mem-ram.inc b/support/ld/stm32/mem/maple_native/mem-ram.inc
new file mode 100644
index 0000000..6ae11ef
--- /dev/null
+++ b/support/ld/stm32/mem/maple_native/mem-ram.inc
@@ -0,0 +1,7 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
+ rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K
+}
+
+INCLUDE maple_native_heap.inc
diff --git a/support/ld/stm32/mem/sram_112k_flash_1024k/mem-jtag.inc b/support/ld/stm32/mem/sram_112k_flash_1024k/mem-jtag.inc
new file mode 100644
index 0000000..e0d2da1
--- /dev/null
+++ b/support/ld/stm32/mem/sram_112k_flash_1024k/mem-jtag.inc
@@ -0,0 +1,5 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+}
diff --git a/support/ld/stm32/mem/sram_112k_flash_1024k/mem-ram.inc b/support/ld/stm32/mem/sram_112k_flash_1024k/mem-ram.inc
new file mode 100644
index 0000000..d21f17c
--- /dev/null
+++ b/support/ld/stm32/mem/sram_112k_flash_1024k/mem-ram.inc
@@ -0,0 +1,5 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 0K
+}
diff --git a/support/ld/stm32/mem/sram_20k_flash_128k/mem-flash.inc b/support/ld/stm32/mem/sram_20k_flash_128k/mem-flash.inc
new file mode 100644
index 0000000..a9091ca
--- /dev/null
+++ b/support/ld/stm32/mem/sram_20k_flash_128k/mem-flash.inc
@@ -0,0 +1,5 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
+ rom (rx) : ORIGIN = 0x08005000, LENGTH = 108K
+}
diff --git a/support/ld/stm32/mem/sram_20k_flash_128k/mem-jtag.inc b/support/ld/stm32/mem/sram_20k_flash_128k/mem-jtag.inc
new file mode 100644
index 0000000..20fbec0
--- /dev/null
+++ b/support/ld/stm32/mem/sram_20k_flash_128k/mem-jtag.inc
@@ -0,0 +1,5 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+}
diff --git a/support/ld/stm32/mem/sram_20k_flash_128k/mem-ram.inc b/support/ld/stm32/mem/sram_20k_flash_128k/mem-ram.inc
new file mode 100644
index 0000000..f02453b
--- /dev/null
+++ b/support/ld/stm32/mem/sram_20k_flash_128k/mem-ram.inc
@@ -0,0 +1,5 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
+ rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K
+}
diff --git a/support/ld/stm32/mem/sram_64k_flash_512k/mem-flash.inc b/support/ld/stm32/mem/sram_64k_flash_512k/mem-flash.inc
new file mode 100644
index 0000000..ddb8876
--- /dev/null
+++ b/support/ld/stm32/mem/sram_64k_flash_512k/mem-flash.inc
@@ -0,0 +1,5 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
+ rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K
+}
diff --git a/support/ld/stm32/mem/sram_64k_flash_512k/mem-jtag.inc b/support/ld/stm32/mem/sram_64k_flash_512k/mem-jtag.inc
new file mode 100644
index 0000000..d3ed992
--- /dev/null
+++ b/support/ld/stm32/mem/sram_64k_flash_512k/mem-jtag.inc
@@ -0,0 +1,5 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K
+}
diff --git a/support/ld/stm32/mem/sram_64k_flash_512k/mem-ram.inc b/support/ld/stm32/mem/sram_64k_flash_512k/mem-ram.inc
new file mode 100644
index 0000000..360beaf
--- /dev/null
+++ b/support/ld/stm32/mem/sram_64k_flash_512k/mem-ram.inc
@@ -0,0 +1,5 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
+ rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K
+}
diff --git a/support/ld/stm32/mem/sram_8k_flash_128k/mem-flash.inc b/support/ld/stm32/mem/sram_8k_flash_128k/mem-flash.inc
new file mode 100644
index 0000000..19372b7
--- /dev/null
+++ b/support/ld/stm32/mem/sram_8k_flash_128k/mem-flash.inc
@@ -0,0 +1,5 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 8K
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+}
diff --git a/support/ld/stm32/mem/sram_8k_flash_128k/mem-jtag.inc b/support/ld/stm32/mem/sram_8k_flash_128k/mem-jtag.inc
new file mode 100644
index 0000000..19372b7
--- /dev/null
+++ b/support/ld/stm32/mem/sram_8k_flash_128k/mem-jtag.inc
@@ -0,0 +1,5 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 8K
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+}
diff --git a/support/ld/stm32/mem/sram_8k_flash_128k/mem-ram.inc b/support/ld/stm32/mem/sram_8k_flash_128k/mem-ram.inc
new file mode 100644
index 0000000..4063ab4
--- /dev/null
+++ b/support/ld/stm32/mem/sram_8k_flash_128k/mem-ram.inc
@@ -0,0 +1,5 @@
+MEMORY
+{
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 8K
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 0K
+}
diff --git a/support/ld/stm32/f1/performance/vector_symbols.inc b/support/ld/stm32/series/stm32f1/performance/vector_symbols.inc
index f8519bb..f8519bb 100644
--- a/support/ld/stm32/f1/performance/vector_symbols.inc
+++ b/support/ld/stm32/series/stm32f1/performance/vector_symbols.inc
diff --git a/support/ld/stm32/series/stm32f1/value/vector_symbols.inc b/support/ld/stm32/series/stm32f1/value/vector_symbols.inc
new file mode 100644
index 0000000..f8726f9
--- /dev/null
+++ b/support/ld/stm32/series/stm32f1/value/vector_symbols.inc
@@ -0,0 +1,78 @@
+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_tamper)
+EXTERN(__irq_rtc)
+EXTERN(__irq_flash)
+EXTERN(__irq_rcc)
+EXTERN(__irq_exti0)
+EXTERN(__irq_exti1)
+EXTERN(__irq_exti2)
+EXTERN(__irq_exti3)
+EXTERN(__irq_exti4)
+EXTERN(__irq_dma1_channel1)
+EXTERN(__irq_dma1_channel2)
+EXTERN(__irq_dma1_channel3)
+EXTERN(__irq_dma1_channel4)
+EXTERN(__irq_dma1_channel5)
+EXTERN(__irq_dma1_channel6)
+EXTERN(__irq_dma1_channel7)
+EXTERN(__irq_adc1)
+EXTERN(__stm32reservedexception14)
+EXTERN(__stm32reservedexception15)
+EXTERN(__stm32reservedexception16)
+EXTERN(__stm32reservedexception17)
+EXTERN(__irq_exti9_5)
+EXTERN(__irq_tim1_brk)
+EXTERN(__irq_tim1_up)
+EXTERN(__irq_tim1_trg_com)
+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_rtcalarm)
+EXTERN(__irq_cec)
+EXTERN(__irq_tim12)
+EXTERN(__irq_tim13)
+EXTERN(__irq_tim14)
+EXTERN(__stm32reservedexception18)
+EXTERN(__stm32reservedexception19)
+EXTERN(__irq_fsmc)
+EXTERN(__stm32reservedexception20)
+EXTERN(__irq_tim5)
+EXTERN(__irq_spi3)
+EXTERN(__irq_uart4)
+EXTERN(__irq_uart5)
+EXTERN(__irq_tim6)
+EXTERN(__irq_tim7)
+EXTERN(__irq_dma2_channel1)
+EXTERN(__irq_dma2_channel2)
+EXTERN(__irq_dma2_channel3)
+EXTERN(__irq_dma2_channel4_5)
+EXTERN(__irq_dma2_channel5) /* on remap only */
diff --git a/support/ld/stm32/series/stm32f2/vector_symbols.inc b/support/ld/stm32/series/stm32f2/vector_symbols.inc
new file mode 100644
index 0000000..d275ec3
--- /dev/null
+++ b/support/ld/stm32/series/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/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)
diff --git a/support/openocd/debug_0.3.cfg b/support/openocd/debug_0.3.cfg
deleted file mode 100644
index 87d33ae..0000000
--- a/support/openocd/debug_0.3.cfg
+++ /dev/null
@@ -1,75 +0,0 @@
-# script for stm32
-
-interface ft2232
-ft2232_device_desc "Olimex OpenOCD JTAG"
-ft2232_layout olimex-jtag
-ft2232_vid_pid 0x15ba 0x0003
-
-if { [info exists CHIPNAME] } {
- set _CHIPNAME $CHIPNAME
-} else {
- set _CHIPNAME stm32
-}
-
-if { [info exists ENDIAN] } {
- set _ENDIAN $ENDIAN
-} else {
- set _ENDIAN little
-}
-
-# jtag speed speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so ufse F_JTAG = 1MHz
-jtag_khz 1000
-
-jtag_nsrst_delay 100
-jtag_ntrst_delay 100
-
-#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config trst_and_srst
-
-#jtag scan chain
-if { [info exists CPUTAPID ] } {
- set _CPUTAPID $CPUTAPID
-} else {
- # See STM Document RM0008
- # Section 30.6.3
- set _CPUTAPID 0x3ba00477
-}
-
-jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
-
-if { [info exists BSTAPID ] } {
- # FIXME this never gets used to override defaults...
- set _BSTAPID $BSTAPID
-} else {
- # See STM Document RM0008
- # Section 29.6.2
- # Low density devices, Rev A
- set _BSTAPID1 0x06412041
- # Medium density devices, Rev A
- set _BSTAPID2 0x06410041
- # Medium density devices, Rev B and Rev Z
- set _BSTAPID3 0x16410041
- # High density devices, Rev A
- set _BSTAPID4 0x06414041
- # Connectivity line devices, Rev A and Rev Z
- set _BSTAPID5 0x06418041
-}
-jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \
- -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \
- -expected-id $_BSTAPID4 -expected-id $_BSTAPID5
-
-
-set _TARGETNAME $_CHIPNAME.cpu
-target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
-
-$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 0x5000 -work-area-backup 0
-
-flash bank stm32x 0x08000000 0x00020000 0 0 $_TARGETNAME
-
-proc nopforever {} {
- puts "Resetting the chip..."
- reset run
-}
-
-init
-nopforever
diff --git a/support/openocd/debug_0.4.cfg b/support/openocd/debug_0.4.cfg
deleted file mode 100644
index 7d6982a..0000000
--- a/support/openocd/debug_0.4.cfg
+++ /dev/null
@@ -1,75 +0,0 @@
-# script for stm32
-
-interface ft2232
-ft2232_device_desc "Olimex OpenOCD JTAG"
-ft2232_layout olimex-jtag
-ft2232_vid_pid 0x15ba 0x0003
-
-if { [info exists CHIPNAME] } {
- set _CHIPNAME $CHIPNAME
-} else {
- set _CHIPNAME stm32
-}
-
-if { [info exists ENDIAN] } {
- set _ENDIAN $ENDIAN
-} else {
- set _ENDIAN little
-}
-
-# jtag speed speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so ufse F_JTAG = 1MHz
-jtag_khz 1000
-
-jtag_nsrst_delay 100
-jtag_ntrst_delay 100
-
-#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config srst_only
-
-#jtag scan chain
-if { [info exists CPUTAPID ] } {
- set _CPUTAPID $CPUTAPID
-} else {
- # See STM Document RM0008
- # Section 30.6.3
- set _CPUTAPID 0x3ba00477
-}
-
-jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
-
-if { [info exists BSTAPID ] } {
- # FIXME this never gets used to override defaults...
- set _BSTAPID $BSTAPID
-} else {
- # See STM Document RM0008
- # Section 29.6.2
- # Low density devices, Rev A
- set _BSTAPID1 0x06412041
- # Medium density devices, Rev A
- set _BSTAPID2 0x06410041
- # Medium density devices, Rev B and Rev Z
- set _BSTAPID3 0x16410041
- # High density devices, Rev A
- set _BSTAPID4 0x06414041
- # Connectivity line devices, Rev A and Rev Z
- set _BSTAPID5 0x06418041
-}
-jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \
- -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \
- -expected-id $_BSTAPID4 -expected-id $_BSTAPID5
-
-
-set _TARGETNAME $_CHIPNAME.cpu
-target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
-
-$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 0x5000 -work-area-backup 0
-
-flash bank bank0 stm32x 0x08000000 0x00020000 0 0 $_TARGETNAME
-
-proc nopforever {} {
- puts "Resetting the chip... Halting for debugger."
- reset halt
-}
-
-init
-nopforever
diff --git a/support/openocd/flash_0.3.cfg b/support/openocd/flash_0.3.cfg
deleted file mode 100644
index 41c6532..0000000
--- a/support/openocd/flash_0.3.cfg
+++ /dev/null
@@ -1,89 +0,0 @@
-# script for stm32
-
-interface ft2232
-ft2232_device_desc "Olimex OpenOCD JTAG"
-ft2232_layout olimex-jtag
-ft2232_vid_pid 0x15ba 0x0003
-
-if { [info exists CHIPNAME] } {
- set _CHIPNAME $CHIPNAME
-} else {
- set _CHIPNAME stm32
-}
-
-if { [info exists ENDIAN] } {
- set _ENDIAN $ENDIAN
-} else {
- set _ENDIAN little
-}
-
-# jtag speed speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so ufse F_JTAG = 1MHz
-jtag_khz 1000
-
-jtag_nsrst_delay 100
-jtag_ntrst_delay 100
-
-#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config trst_and_srst
-
-#jtag scan chain
-if { [info exists CPUTAPID ] } {
- set _CPUTAPID $CPUTAPID
-} else {
- # See STM Document RM0008
- # Section 30.6.3
- set _CPUTAPID 0x3ba00477
-}
-
-jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
-
-if { [info exists BSTAPID ] } {
- # FIXME this never gets used to override defaults...
- set _BSTAPID $BSTAPID
-} else {
- # See STM Document RM0008
- # Section 29.6.2
- # Low density devices, Rev A
- set _BSTAPID1 0x06412041
- # Medium density devices, Rev A
- set _BSTAPID2 0x06410041
- # Medium density devices, Rev B and Rev Z
- set _BSTAPID3 0x16410041
- # High density devices, Rev A
- set _BSTAPID4 0x06414041
- # Connectivity line devices, Rev A and Rev Z
- set _BSTAPID5 0x06418041
-}
-jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \
- -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \
- -expected-id $_BSTAPID4 -expected-id $_BSTAPID5
-
-
-set _TARGETNAME $_CHIPNAME.cpu
-target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
-
-$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 0x5000 -work-area-backup 0
-# TODO: native
-#$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 0x10000 -work-area-backup 0
-
-flash bank stm32x 0x08000000 0x00020000 0 0 $_TARGETNAME
-
-proc flash_chip {} {
- echo "Halting..."
- halt
- echo "Erasing..."
- flash erase_address 0x08000000 0x20000
- # TODO: native
- #flash erase_address 0x08000000 0x80000
- echo "Flashing image..."
- flash write_bank 0 build/maple.bin 0
- echo "Verifying image..."
- verify_image build/maple.bin 0x08000000 bin
- echo "Checksum verified, resetting chip"
- reset run
- echo "Daemon shutdown"
- shutdown
-}
-
-init
-flash_chip
diff --git a/support/openocd/flash_0.4.cfg b/support/openocd/flash_0.4.cfg
deleted file mode 100644
index 32c06c6..0000000
--- a/support/openocd/flash_0.4.cfg
+++ /dev/null
@@ -1,95 +0,0 @@
-# script for stm32
-
-interface ft2232
-ft2232_device_desc "Olimex OpenOCD JTAG"
-ft2232_layout olimex-jtag
-ft2232_vid_pid 0x15ba 0x0003
-
-if { [info exists CHIPNAME] } {
- set _CHIPNAME $CHIPNAME
-} else {
- set _CHIPNAME stm32
-}
-
-if { [info exists ENDIAN] } {
- set _ENDIAN $ENDIAN
-} else {
- set _ENDIAN little
-}
-
-# jtag speed speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so ufse F_JTAG = 1MHz
-jtag_khz 1000
-
-jtag_nsrst_delay 100
-jtag_ntrst_delay 100
-
-#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config srst_only
-
-#jtag scan chain
-if { [info exists CPUTAPID ] } {
- set _CPUTAPID $CPUTAPID
-} else {
- # See STM Document RM0008
- # Section 30.6.3
- set _CPUTAPID 0x3ba00477
-}
-
-jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
-
-if { [info exists BSTAPID ] } {
- # FIXME this never gets used to override defaults...
- set _BSTAPID $BSTAPID
-} else {
- # See STM Document RM0008
- # Section 29.6.2
- # Low density devices, Rev A
- set _BSTAPID1 0x06412041
- # Medium density devices, Rev A
- set _BSTAPID2 0x06410041
- # Medium density devices, Rev B and Rev Z
- set _BSTAPID3 0x16410041
- # High density devices, Rev A
- set _BSTAPID4 0x06414041
- # Connectivity line devices, Rev A and Rev Z
- set _BSTAPID5 0x06418041
-}
-jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \
- -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \
- -expected-id $_BSTAPID4 -expected-id $_BSTAPID5
-
-
-set _TARGETNAME $_CHIPNAME.cpu
-target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
-
-$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 0x5000 -work-area-backup 0
-# TODO: native
-#$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 0x10000 -work-area-backup 0
-
-flash bank bank0 stm32x 0x08000000 0x00020000 0 0 $_TARGETNAME
-
-proc flash_chip {} {
- echo "Halting..."
- reset halt
-
- echo "Unlocking flash..."
- flash protect 0 0 last off
-
- echo "Erasing..."
- flash erase_address 0x08000000 0x20000
-
- echo "Flashing image..."
- flash write_bank 0 build/maple.bin 0
-
- echo "Verifying image..."
- verify_image build/maple.bin 0x08000000 bin
-
- echo "Checksum verified, resetting chip"
- reset run
-
- echo "Daemon shutdown"
- shutdown
-}
-
-init
-flash_chip
diff --git a/support/scripts/openocd-wrapper.sh b/support/scripts/openocd-wrapper.sh
deleted file mode 100755
index 73be92e..0000000
--- a/support/scripts/openocd-wrapper.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-
-# Helper to decide which openocd script to use. We only support 0.3.x and 0.4.x.
-
-if [ $# -ne 1 ]
-then
- echo "Usage: `basename $0` {flash|debug}"
- exit 1
-fi
-
-OPENOCD_VERSION=`openocd -v 2>&1 | head -n1 | \
- awk '{print $4}' | sed 's/\([0-9]*\.[0-9]*\)\.[0-9]*/\1/'`
-
-CFG_FILE=$1_${OPENOCD_VERSION}.cfg
-
-openocd -f support/openocd/$CFG_FILE