summaryrefslogtreecommitdiff
path: root/app/ld
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2023-03-05 20:20:45 +0300
committerOxore <oxore@protonmail.com>2023-03-05 20:20:45 +0300
commitea807de65b0485ac58b6eae576209c64d4d5c4e9 (patch)
treeb4264d20e1d700cfd9e0ece9d847a825dd1dfc03 /app/ld
parentdd01e7ed22cea652061f0d12cecf929e04b285e9 (diff)
Split app code and third party libraries
Diffstat (limited to 'app/ld')
-rw-r--r--app/ld/_flash.ld33
-rw-r--r--app/ld/_sram.ld26
-rw-r--r--app/ld/stm32f072x8.ld4
3 files changed, 63 insertions, 0 deletions
diff --git a/app/ld/_flash.ld b/app/ld/_flash.ld
new file mode 100644
index 0000000..ec94ea7
--- /dev/null
+++ b/app/ld/_flash.ld
@@ -0,0 +1,33 @@
+SECTIONS {
+ . = ORIGIN(FLASH);
+ .text : {
+ KEEP(*(.stack))
+ KEEP(*(.vectors))
+ KEEP(*(.vectors*))
+ KEEP(*(.text))
+ . = ALIGN(4);
+ *(.text*)
+ . = ALIGN(4);
+ KEEP(*(.rodata))
+ *(.rodata*)
+ . = ALIGN(4);
+ } >FLASH
+
+ .preinit_array ALIGN(4): {
+ __preinit_array_start = .;
+ KEEP(*(.preinit_array))
+ __preinit_array_end = .;
+ } >FLASH
+
+ .init_array ALIGN(4): {
+ __init_array_start = .;
+ KEEP(*(.init_array))
+ __init_array_end = .;
+ } >FLASH
+
+ .fini_array ALIGN(4): {
+ __fini_array_start = .;
+ KEEP(*(.fini_array))
+ __fini_array_end = .;
+ } >FLASH
+}
diff --git a/app/ld/_sram.ld b/app/ld/_sram.ld
new file mode 100644
index 0000000..4993c63
--- /dev/null
+++ b/app/ld/_sram.ld
@@ -0,0 +1,26 @@
+SECTIONS {
+ __stacktop = ORIGIN(SRAM) + LENGTH(SRAM);
+ __data_load = LOADADDR(.data);
+ . = ORIGIN(SRAM);
+
+ .data ALIGN(4) : {
+ __data_start = .;
+ *(.data)
+ *(.data*)
+ . = ALIGN(4);
+ __data_end = .;
+ } >SRAM AT >FLASH
+
+ .bss ALIGN(4) (NOLOAD) : {
+ __bss_start = .;
+ *(.bss)
+ *(.bss*)
+ . = ALIGN(4);
+ __bss_end = .;
+ *(.noinit)
+ *(.noinit*)
+ } >SRAM
+
+ . = ALIGN(4);
+ __heap_start = .;
+}
diff --git a/app/ld/stm32f072x8.ld b/app/ld/stm32f072x8.ld
new file mode 100644
index 0000000..7600040
--- /dev/null
+++ b/app/ld/stm32f072x8.ld
@@ -0,0 +1,4 @@
+MEMORY {
+ FLASH(rx) : ORIGIN = 0x08000000, LENGTH = 64K
+ SRAM(rwx) : ORIGIN = 0x20000000, LENGTH = 16K
+}