1ENTRY(Reset_Handler)
2
3/* Highest address of the user mode stack */
4_estack = 0x20020000;    /* end of 128K RAM on AHB bus*/
5
6/* Generate a link error if heap and stack don't fit into RAM */
7_Min_Heap_Size = 0;      /* required amount of heap  */
8_Min_Stack_Size = 0x400; /* required amount of stack */
9
10/* Specify the memory areas */
11MEMORY
12{
13  FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 1024K
14  RAM (rwx)       : ORIGIN = 0x20000000, LENGTH = 128K
15  CCM (rwx)       : ORIGIN = 0x10000000, LENGTH = 64K
16}
17
18SECTIONS
19{
20  .isr_vector :
21  {
22    . = ALIGN(4);
23    KEEP(*(.isr_vector))
24    . = ALIGN(4);
25  } >RAM
26
27  .text :
28  {
29    . = ALIGN(4);
30    *(.text)           /* .text sections (code) */
31    *(.text*)          /* .text* sections (code) */
32    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
33    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
34    *(.glue_7)         /* glue arm to thumb code */
35    *(.glue_7t)        /* glue thumb to arm code */
36	*(.eh_frame)
37
38    KEEP (*(.init))
39    KEEP (*(.fini))
40
41    . = ALIGN(4);
42    _etext = .;        /* define a global symbols at end of code */
43    _exit = .;
44  } >RAM
45
46
47   .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
48    .ARM : {
49    __exidx_start = .;
50      *(.ARM.exidx*)
51      __exidx_end = .;
52    } >RAM
53
54  .preinit_array     :
55  {
56    PROVIDE_HIDDEN (__preinit_array_start = .);
57    KEEP (*(.preinit_array*))
58    PROVIDE_HIDDEN (__preinit_array_end = .);
59  } >RAM
60  .init_array :
61  {
62    PROVIDE_HIDDEN (__init_array_start = .);
63    KEEP (*(SORT(.init_array.*)))
64    KEEP (*(.init_array*))
65    PROVIDE_HIDDEN (__init_array_end = .);
66  } >RAM
67  .fini_array :
68  {
69    PROVIDE_HIDDEN (__fini_array_start = .);
70    KEEP (*(.fini_array*))
71    KEEP (*(SORT(.fini_array.*)))
72    PROVIDE_HIDDEN (__fini_array_end = .);
73  } >RAM
74
75  /* used by the startup to initialize data */
76  _sidata = .;
77
78  /* Initialized data sections goes into RAM, load LMA copy after code */
79  .data : AT ( _sidata )
80  {
81    . = ALIGN(4);
82    _sdata = .;        /* create a global symbol at data start */
83    *(.data)           /* .data sections */
84    *(.data*)          /* .data* sections */
85
86    . = ALIGN(4);
87    _edata = .;        /* define a global symbol at data end */
88  } >RAM
89
90  /* Uninitialized data section */
91  . = ALIGN(4);
92  .bss :
93  {
94    /* This is used by the startup in order to initialize the .bss secion */
95    _sbss = .;         /* define a global symbol at bss start */
96    __bss_start__ = _sbss;
97    *(.bss)
98    *(.bss*)
99    *(COMMON)
100
101    . = ALIGN(4);
102    _ebss = .;         /* define a global symbol at bss end */
103    __bss_end__ = _ebss;
104  } >RAM
105
106  /* User_heap_stack section, used to check that there is enough RAM left */
107  ._user_heap_stack :
108  {
109    . = ALIGN(4);
110    PROVIDE ( end = . );
111    PROVIDE ( _end = . );
112    . = . + _Min_Heap_Size;
113    . = . + _Min_Stack_Size;
114    . = ALIGN(4);
115  } >RAM
116}
117