2 *****************************************************************************
5 ** File : LinkerScript.ld
7 ** Abstract : Linker script for STM32F103C8Tx Device with
8 ** 64KByte FLASH, 20KByte RAM
10 ** Set heap size, stack size and stack location according
11 ** to application requirements.
13 ** Set memory bank area and size if external memory is used.
15 ** Target : STMicroelectronics STM32
18 ** Distribution: The file is distributed as is, without any warranty
22 ** You may use this file as-is or modify it according to the needs of your
23 ** project. Distribution of this file (unmodified or modified) is not
24 ** permitted. Ac6 permit registered System Workbench for MCU users the
25 ** rights to distribute the assembled, compiled & linked contents of this
26 ** file as part of an application binary file, provided that it is built
27 ** using the System Workbench for MCU toolchain.
29 *****************************************************************************
35 /* Highest address of the user mode stack */
36 _estack = 0x20005000; /* end of RAM */
37 /* Generate a link error if heap and stack don't fit into RAM */
38 _Min_Heap_Size = 0x200; /* required amount of heap */
39 _Min_Stack_Size = 0x400; /* required amount of stack */
41 /* Specify the memory areas */
44 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
45 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K
48 /* Define output sections */
51 /* The startup code goes first into FLASH */
55 KEEP(*(.isr_vector)) /* Startup code */
59 /* The program code and other data goes into FLASH */
63 *(.text) /* .text sections (code) */
64 *(.text*) /* .text* sections (code) */
65 *(.glue_7) /* glue arm to thumb code */
66 *(.glue_7t) /* glue thumb to arm code */
73 _etext = .; /* define a global symbols at end of code */
76 /* Constant data goes into FLASH */
80 *(.rodata) /* .rodata sections (constants, strings, etc.) */
81 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
85 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
94 PROVIDE_HIDDEN (__preinit_array_start = .);
95 KEEP (*(.preinit_array*))
96 PROVIDE_HIDDEN (__preinit_array_end = .);
100 PROVIDE_HIDDEN (__init_array_start = .);
101 KEEP (*(SORT(.init_array.*)))
102 KEEP (*(.init_array*))
103 PROVIDE_HIDDEN (__init_array_end = .);
107 PROVIDE_HIDDEN (__fini_array_start = .);
108 KEEP (*(SORT(.fini_array.*)))
109 KEEP (*(.fini_array*))
110 PROVIDE_HIDDEN (__fini_array_end = .);
113 /* used by the startup to initialize data */
114 _sidata = LOADADDR(.data);
116 /* Initialized data sections goes into RAM, load LMA copy after code */
120 _sdata = .; /* create a global symbol at data start */
121 *(.data) /* .data sections */
122 *(.data*) /* .data* sections */
125 _edata = .; /* define a global symbol at data end */
129 /* Uninitialized data section */
133 /* This is used by the startup in order to initialize the .bss secion */
134 _sbss = .; /* define a global symbol at bss start */
135 __bss_start__ = _sbss;
141 _ebss = .; /* define a global symbol at bss end */
145 /* User_heap_stack section, used to check that there is enough RAM left */
150 PROVIDE ( _end = . );
151 . = . + _Min_Heap_Size;
152 . = . + _Min_Stack_Size;
158 /* Remove information from the standard libraries */
166 .ARM.attributes 0 : { *(.ARM.attributes) }