2
|
1 /*
|
|
2 *****************************************************************************
|
|
3 **
|
|
4
|
|
5 ** File : stm32_flash.ld
|
|
6 **
|
|
7 ** Abstract : Linker script for STM32F103C8 Device with
|
|
8 ** 64KByte FLASH, 20KByte RAM
|
|
9 **
|
|
10 ** Set heap size, stack size and stack location according
|
|
11 ** to application requirements.
|
|
12 **
|
|
13 ** Set memory bank area and size if external memory is used.
|
|
14 **
|
|
15 ** Target : STMicroelectronics STM32
|
|
16 **
|
|
17 ** Environment : Atollic TrueSTUDIO(R)
|
|
18 **
|
|
19 ** Distribution: The file is distributed as is, without any warranty
|
|
20 ** of any kind.
|
|
21 **
|
|
22 ** (c)Copyright Atollic AB.
|
|
23 ** You may use this file as-is or modify it according to the needs of your
|
|
24 ** project. This file may only be built (assembled or compiled and linked)
|
|
25 ** using the Atollic TrueSTUDIO(R) product. The use of this file together
|
|
26 ** with other tools than Atollic TrueSTUDIO(R) is not permitted.
|
|
27 **
|
|
28 *****************************************************************************
|
|
29 */
|
|
30
|
|
31 /* Entry Point */
|
|
32 ENTRY(Reset_Handler)
|
|
33
|
|
34 /* Highest address of the user mode stack */
|
|
35 _estack = 0x20005000; /* end of RAM */
|
|
36 /* Generate a link error if heap and stack don't fit into RAM */
|
|
37 _Min_Heap_Size = 0x200; /* required amount of heap */
|
|
38 _Min_Stack_Size = 0x400; /* required amount of stack */
|
|
39
|
|
40 /* Specify the memory areas */
|
|
41 MEMORY
|
|
42 {
|
|
43 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
|
|
44 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K
|
|
45 }
|
|
46
|
|
47 /* Define output sections */
|
|
48 SECTIONS
|
|
49 {
|
|
50 /* The startup code goes first into FLASH */
|
|
51 .isr_vector :
|
|
52 {
|
|
53 . = ALIGN(4);
|
|
54 KEEP(*(.isr_vector)) /* Startup code */
|
|
55 . = ALIGN(4);
|
|
56 } >FLASH
|
|
57
|
|
58 /* The program code and other data goes into FLASH */
|
|
59 .text :
|
|
60 {
|
|
61 . = ALIGN(4);
|
|
62 *(.text) /* .text sections (code) */
|
|
63 *(.text*) /* .text* sections (code) */
|
|
64 *(.glue_7) /* glue arm to thumb code */
|
|
65 *(.glue_7t) /* glue thumb to arm code */
|
|
66 *(.eh_frame)
|
|
67
|
|
68 KEEP (*(.init))
|
|
69 KEEP (*(.fini))
|
|
70
|
|
71 . = ALIGN(4);
|
|
72 _etext = .; /* define a global symbols at end of code */
|
|
73 } >FLASH
|
|
74
|
|
75 /* Constant data goes into FLASH */
|
|
76 .rodata :
|
|
77 {
|
|
78 . = ALIGN(4);
|
|
79 *(.rodata) /* .rodata sections (constants, strings, etc.) */
|
|
80 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
|
81 . = ALIGN(4);
|
|
82 } >FLASH
|
|
83
|
|
84 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
|
|
85 .ARM : {
|
|
86 __exidx_start = .;
|
|
87 *(.ARM.exidx*)
|
|
88 __exidx_end = .;
|
|
89 } >FLASH
|
|
90
|
|
91 .preinit_array :
|
|
92 {
|
|
93 PROVIDE_HIDDEN (__preinit_array_start = .);
|
|
94 KEEP (*(.preinit_array*))
|
|
95 PROVIDE_HIDDEN (__preinit_array_end = .);
|
|
96 } >FLASH
|
|
97 .init_array :
|
|
98 {
|
|
99 PROVIDE_HIDDEN (__init_array_start = .);
|
|
100 KEEP (*(SORT(.init_array.*)))
|
|
101 KEEP (*(.init_array*))
|
|
102 PROVIDE_HIDDEN (__init_array_end = .);
|
|
103 } >FLASH
|
|
104 .fini_array :
|
|
105 {
|
|
106 PROVIDE_HIDDEN (__fini_array_start = .);
|
|
107 KEEP (*(SORT(.fini_array.*)))
|
|
108 KEEP (*(.fini_array*))
|
|
109 PROVIDE_HIDDEN (__fini_array_end = .);
|
|
110 } >FLASH
|
|
111
|
|
112 /* used by the startup to initialize data */
|
|
113 _sidata = LOADADDR(.data);
|
|
114
|
|
115 /* Initialized data sections goes into RAM, load LMA copy after code */
|
|
116 .data :
|
|
117 {
|
|
118 . = ALIGN(4);
|
|
119 _sdata = .; /* create a global symbol at data start */
|
|
120 *(.data) /* .data sections */
|
|
121 *(.data*) /* .data* sections */
|
|
122
|
|
123 . = ALIGN(4);
|
|
124 _edata = .; /* define a global symbol at data end */
|
|
125 } >RAM AT> FLASH
|
|
126
|
|
127
|
|
128 /* Uninitialized data section */
|
|
129 . = ALIGN(4);
|
|
130 .bss :
|
|
131 {
|
|
132 /* This is used by the startup in order to initialize the .bss secion */
|
|
133 _sbss = .; /* define a global symbol at bss start */
|
|
134 __bss_start__ = _sbss;
|
|
135 *(.bss)
|
|
136 *(.bss*)
|
|
137 *(COMMON)
|
|
138
|
|
139 . = ALIGN(4);
|
|
140 _ebss = .; /* define a global symbol at bss end */
|
|
141 __bss_end__ = _ebss;
|
|
142 } >RAM
|
|
143
|
|
144 /* User_heap_stack section, used to check that there is enough RAM left */
|
|
145 ._user_heap_stack :
|
|
146 {
|
|
147 . = ALIGN(4);
|
|
148 PROVIDE ( end = . );
|
|
149 PROVIDE ( _end = . );
|
|
150 . = . + _Min_Heap_Size;
|
|
151 . = . + _Min_Stack_Size;
|
|
152 . = ALIGN(4);
|
|
153 } >RAM
|
|
154
|
|
155
|
|
156
|
|
157 /* Remove information from the standard libraries */
|
|
158 /DISCARD/ :
|
|
159 {
|
|
160 libc.a ( * )
|
|
161 libm.a ( * )
|
|
162 libgcc.a ( * )
|
|
163 }
|
|
164
|
|
165 .ARM.attributes 0 : { *(.ARM.attributes) }
|
|
166 }
|
|
167
|
|
168
|