aboutsummaryrefslogtreecommitdiffstats
path: root/support/ld/stm32
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-06 18:06:48 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-07 03:44:31 -0400
commit5838b447f675444b154bacd205ebf9f47d003b2f (patch)
tree004d9d4871e5d70f248646d65450952b2fa79aff /support/ld/stm32
parent42570013c5266449f7e8512a77fe66b8e852294d (diff)
downloadlibrambutan-5838b447f675444b154bacd205ebf9f47d003b2f.tar.gz
librambutan-5838b447f675444b154bacd205ebf9f47d003b2f.zip
Rework linker scripts.
Having separate linker scripts for all the boards is a bad idea. Most boards really only need to specify MEMORY and the appropriate REGION_ALIASES() so that support/ld/common.inc can do its work. Not having infrastructure for this leads to duplication -- viz. the Maple Mini linker scripts are identical to the Maple's, and the olimex_stm32_h103 linker directory is just a symlink to Maple's. Clearly, the current structure is wrong. To fix it, instead of having per-board subdirectories of support/ld/, add per-MEMORY subdirectories of (new) support/ld/stm32/mem/. The per-board .mk files under support/mk/board-includes/ now reference these directly, and target-config.mk and the Makefile handle this appropriately. We move some other stuff around in target-config.mk to make this all more convenient, and even allow more overriding of the libmaple defaults on a per-board basis. Custom board hacks will be easier now. Unfortunately, lots of duplication under support/ld/stm32/mem/ is necessary, as the LENGTH attribute in a MEMORY region specification doesn't support arithmetic expressions, and ld doesn't seem to have any way to specify MEMORY at the command line (why?!). If we find a better way than this, we should do it. If a board (e.g. Maple Native) _does_ really need special memory-related configuration, you can always put a per-board subdirectory of support/ld/stm32/mem. We do this here to configure the heap. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'support/ld/stm32')
-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
15 files changed, 79 insertions, 0 deletions
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
+}