2 *****************************************************************************
4 ** File : stm32_flash.ld
6 ** Abstract : Linker script for STM32F103C8 Device with
7 ** 128KByte FLASH, 20KByte RAM
9 *****************************************************************************
15 /* Highest address of the user mode stack */
16 _estack = 0x20005000; /* end of 20K RAM */
18 /* Generate a link error if heap and stack don't fit into RAM */
19 _Min_Heap_Size = 0; /* required amount of heap */
20 _Min_Stack_Size = 0x400; /* required amount of stack */
22 /* Specify the memory areas */
25 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 127K
26 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
27 MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
30 /* Define output sections */
33 /* The startup code goes first into FLASH */
37 KEEP(*(.isr_vector)) /* Startup code */
41 /* The program code and other data goes into FLASH */
45 *(.text) /* .text sections (code) */
46 *(.text*) /* .text* sections (code) */
47 *(.rodata) /* .rodata sections (constants, strings, etc.) */
48 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
49 *(.glue_7) /* glue arm to thumb code */
50 *(.glue_7t) /* glue thumb to arm code */
57 _etext = .; /* define a global symbols at end of code */
61 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
70 PROVIDE_HIDDEN (__preinit_array_start = .);
71 KEEP (*(.preinit_array*))
72 PROVIDE_HIDDEN (__preinit_array_end = .);
76 PROVIDE_HIDDEN (__init_array_start = .);
77 KEEP (*(SORT(.init_array.*)))
78 KEEP (*(.init_array*))
79 PROVIDE_HIDDEN (__init_array_end = .);
83 PROVIDE_HIDDEN (__fini_array_start = .);
84 KEEP (*(.fini_array*))
85 KEEP (*(SORT(.fini_array.*)))
86 PROVIDE_HIDDEN (__fini_array_end = .);
89 /* used by the startup to initialize data */
92 /* Initialized data sections goes into RAM, load LMA copy after code */
96 _sdata = .; /* create a global symbol at data start */
97 *(.data) /* .data sections */
98 *(.data*) /* .data* sections */
101 _edata = .; /* define a global symbol at data end */
104 /* Uninitialized data section */
108 /* This is used by the startup in order to initialize the .bss secion */
109 _sbss = .; /* define a global symbol at bss start */
110 __bss_start__ = _sbss;
116 _ebss = .; /* define a global symbol at bss end */
120 /* User_heap_stack section, used to check that there is enough RAM left */
125 PROVIDE ( _end = . );
126 . = . + _Min_Heap_Size;
127 . = . + _Min_Stack_Size;
131 /* MEMORY_bank1 section, code must be located here explicitly */
132 /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
135 *(.mb1text) /* .mb1text sections (code) */
136 *(.mb1text*) /* .mb1text* sections (code) */
137 *(.mb1rodata) /* read-only data (constants) */
141 /* Remove information from the standard libraries */
149 .ARM.attributes 0 : { *(.ARM.attributes) }