aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32f1/stm32f1.ld
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-10-04 10:14:16 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-10-11 10:50:51 -0400
commit75fa74313c178034b80f7c1e3ad0a7b55c34a3d6 (patch)
treee161e1440dbe8de4a248a75a00457a238743c5a6 /src/stm32f1/stm32f1.ld
parent215b4c5a1ef9faf261fea0989051f7dc540a74df (diff)
downloadkutter-75fa74313c178034b80f7c1e3ad0a7b55c34a3d6.tar.gz
kutter-75fa74313c178034b80f7c1e3ad0a7b55c34a3d6.tar.xz
kutter-75fa74313c178034b80f7c1e3ad0a7b55c34a3d6.zip
stm32f1: Add support for building with bootloader support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32f1/stm32f1.ld')
-rw-r--r--src/stm32f1/stm32f1.ld113
1 files changed, 113 insertions, 0 deletions
diff --git a/src/stm32f1/stm32f1.ld b/src/stm32f1/stm32f1.ld
new file mode 100644
index 00000000..e13d7c46
--- /dev/null
+++ b/src/stm32f1/stm32f1.ld
@@ -0,0 +1,113 @@
+/* Cortex-M linker script
+
+ This file is taken from lib/cmsis-stm32f1/source/stm32f1.ld . It
+ has been modified to support a bootloader offset.
+*/
+
+ENTRY(Reset_Handler)
+
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000 + FLASH_START, LENGTH = 64K - FLASH_START
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
+}
+
+/* highest address of the user mode stack */
+_estack = 0x20005000;
+
+SECTIONS
+{
+ /* Interrupt vector table */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector))
+ . = ALIGN(4);
+ } >FLASH
+
+ /* Program code and constant data */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text)
+ *(.text*)
+ *(.rodata)
+ *(.rodata*)
+ KEEP (*(.init))
+ KEEP (*(.fini))
+ . = ALIGN(4);
+ _etext = .;
+ } >FLASH
+
+ /* Exception handling */
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ /* Static constructor initialization (C++) */
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+
+ /* Initialized data, needs to be handled by startup code */
+ _sidata = .;
+ .data : AT (_sidata)
+ {
+ . = ALIGN(4);
+ _sdata = . ;
+ _data = . ;
+ *(.data)
+ *(.data*)
+ *(.RAMtext)
+ . = ALIGN(4);
+ _edata = . ;
+ } >RAM
+
+ /* Uninitialized data */
+ .bss (NOLOAD) :
+ {
+ . = ALIGN(4);
+ _sbss = .;
+ __bss_start__ = .;
+ _bss = .;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4);
+ _ebss = .;
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* Pointers to end of data for dynamic memory management */
+ PROVIDE (end = _ebss);
+ PROVIDE (_end = _ebss);
+
+ /* Remove debugging from standard libraries */
+ /DISCARD/ :
+ {
+ libc.a (*)
+ libm.a (*)
+ libgcc.a (*)
+ }
+}