1
2
3/*
4 *-------- <<< Use Configuration Wizard in Context Menu >>> -------------------
5 */
6
7/*---------------------- Flash Configuration ----------------------------------
8  <h> Flash Configuration
9    <o0> Flash Base Address <0x0-0xFFFFFFFF:8>
10    <o1> Flash Size (in Bytes) <0x0-0xFFFFFFFF:8>
11  </h>
12  -----------------------------------------------------------------------------*/
13__ROM_BASE = 0x08000000;
14__ROM_SIZE = 0x00040000;
15
16/*--------------------- Embedded RAM Configuration ----------------------------
17  <h> RAM Configuration
18    <o0> RAM Base Address    <0x0-0xFFFFFFFF:8>
19    <o1> RAM Size (in Bytes) <0x0-0xFFFFFFFF:8>
20  </h>
21 -----------------------------------------------------------------------------*/
22__RAM_BASE = 0x30000000;
23__RAM_SIZE = 0x0001C000;
24
25/*--------------------- Stack / Heap Configuration ----------------------------
26  <h> Stack / Heap Configuration
27    <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
28    <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
29  </h>
30  -----------------------------------------------------------------------------*/
31__STACK_SIZE = 0x00001000;
32/*__HEAP_SIZE  = 0x00001000;*/
33
34/*
35 *-------------------- <<< end of configuration section >>> -------------------
36 */
37
38/* ARMv8-M stack sealing:
39   to use ARMv8-M stack sealing set __STACKSEAL_SIZE to 8 otherwise keep 0
40 */
41__STACKSEAL_SIZE = 0;
42
43
44MEMORY
45{
46  FLASH (rx)  : ORIGIN = __ROM_BASE, LENGTH = __ROM_SIZE
47  RAM   (rwx) : ORIGIN = __RAM_BASE, LENGTH = __RAM_SIZE
48}
49
50/* Linker script to place sections and symbol values. Should be used together
51 * with other linker script that defines memory regions FLASH and RAM.
52 * It references following symbols, which must be defined in code:
53 *   Reset_Handler : Entry of reset handler
54 *
55 * It defines following symbols, which code can use without definition:
56 *   __exidx_start
57 *   __exidx_end
58 *   __copy_table_start__
59 *   __copy_table_end__
60 *   __zero_table_start__
61 *   __zero_table_end__
62 *   __etext
63 *   __data_start__
64 *   __preinit_array_start
65 *   __preinit_array_end
66 *   __init_array_start
67 *   __init_array_end
68 *   __fini_array_start
69 *   __fini_array_end
70 *   __data_end__
71 *   __bss_start__
72 *   __bss_end__
73 *   __end__
74 *   end
75 *   __HeapLimit
76 *   __StackLimit
77 *   __StackTop
78 *   __stack
79 *   __StackSeal      (only if ARMv8-M stack sealing is used)
80 */
81ENTRY(Reset_Handler)
82
83SECTIONS
84{
85  .text :
86  {
87    . = ALIGN(4);
88    KEEP(*(.vectors))
89    . = ALIGN(4);
90    *(.text)                        /* remaining code */
91    *(.text.*)                      /* remaining code */
92    *(.rodata)                      /* read-only data (constants) */
93    *(.rodata*)
94    *(.glue_7)
95    *(.glue_7t)
96    *(.gnu.linkonce.t*)
97
98    /* section information for finsh shell */
99    . = ALIGN(4);
100    __fsymtab_start = .;
101    KEEP(*(FSymTab))
102    __fsymtab_end = .;
103
104    . = ALIGN(4);
105    __vsymtab_start = .;
106    KEEP(*(VSymTab))
107    __vsymtab_end = .;
108
109    /* section information for initial. */
110    . = ALIGN(4);
111    __rt_init_start = .;
112    KEEP(*(SORT(.rti_fn*)))
113    __rt_init_end = .;
114
115    . = ALIGN(4);
116
117    PROVIDE(__ctors_start__ = .);
118    KEEP (*(SORT(.init_array.*)))
119    KEEP (*(.init_array))
120    PROVIDE(__ctors_end__ = .);
121
122    . = ALIGN(4);
123
124    _etext = .;
125  } > FLASH
126
127  /*
128   * SG veneers:
129   * All SG veneers are placed in the special output section .gnu.sgstubs. Its start address
130   * must be set, either with the command line option ��--section-start�� or in a linker script,
131   * to indicate where to place these veneers in memory.
132   */
133/*
134  .gnu.sgstubs :
135  {
136    . = ALIGN(32);
137  } > FLASH
138*/
139  .ARM.extab :
140  {
141    *(.ARM.extab* .gnu.linkonce.armextab.*)
142  } > FLASH
143
144  __exidx_start = .;
145  .ARM.exidx :
146  {
147    *(.ARM.exidx* .gnu.linkonce.armexidx.*)
148
149    /* This is used by the startup in order to initialize the .data secion */
150    _sidata = .;
151  } > FLASH
152  __exidx_end = .;
153
154   __etext = ALIGN (4);
155
156  .data : AT (__etext)
157  {
158    . = ALIGN(4);
159    /* This is used by the startup in order to initialize the .data secion */
160     _sdata = . ;
161
162     *(.data)
163     *(.data.*)
164     *(.gnu.linkonce.d*)
165
166     PROVIDE(__dtors_start__ = .);
167     KEEP(*(SORT(.dtors.*)))
168     KEEP(*(.dtors))
169     PROVIDE(__dtors_end__ = .);
170
171     . = ALIGN(4);
172     /* This is used by the startup in order to initialize the .data secion */
173     _edata = . ;
174
175  } > RAM
176
177  /*
178   * Secondary data section, optional
179   *
180   * Remember to add each additional data section
181   * to the .copy.table above to asure proper
182   * initialization during startup.
183   */
184/*
185  __etext2 = ALIGN (4);
186
187  .data2 : AT (__etext2)
188  {
189    . = ALIGN(4);
190    __data2_start__ = .;
191    *(.data2)
192    *(.data2.*)
193    . = ALIGN(4);
194    __data2_end__ = .;
195
196  } > RAM2
197*/
198
199/*
200  .heap (COPY) :
201  {
202    . = ALIGN(8);
203    __end__ = .;
204    PROVIDE(end = .);
205    . = . + __HEAP_SIZE;
206    . = ALIGN(8);
207    __HeapLimit = .;
208  } > RAM
209  */
210
211
212  /* ARMv8-M stack sealing:
213     to use ARMv8-M stack sealing uncomment '.stackseal' section
214   */
215/*
216  .stackseal :
217  {
218    . = ALIGN(8);
219    __StackSeal = .;
220    . = . + 8;
221    . = ALIGN(8);
222  } > RAM
223*/
224
225  .stack :
226  {
227    . = ALIGN(8);
228    _sstack = .;
229    . = . + __STACK_SIZE;
230    . = ALIGN(8);
231    _estack = .;
232  } > RAM
233
234  __bss_start__ = .;
235  .bss :
236  {
237    . = ALIGN(4);
238    _sbss = .;
239
240    *(.bss)
241    *(.bss.*)
242    *(COMMON)
243    . = ALIGN(4);
244     _ebss = . ;
245
246     *(.bss.init)
247  } > RAM
248  __bss_end__ = .;
249
250  /*
251   * Secondary bss section, optional
252   *
253   * Remember to add each additional bss section
254   * to the .zero.table above to asure proper
255   * initialization during startup.
256   */
257/*
258  .bss2 :
259  {
260    . = ALIGN(4);
261    __bss2_start__ = .;
262    *(.bss2)
263    *(.bss2.*)
264    . = ALIGN(4);
265    __bss2_end__ = .;
266  } > RAM2 AT > RAM2
267*/
268}
269