1/*
2 * linker script for ACM32F4xx with GNU ld
3 */
4
5/* describes the location and size of blocks of memory in the target. */
6MEMORY
7{
8    CODE (rx) : ORIGIN = 0x00000000, LENGTH = 512k /* 512KB flash */
9    DATA (rw) : ORIGIN = 0x20000000, LENGTH = 192k /* 192KB sram */
10}
11/* Program Entry, set to mark it as "used" and avoid gc */
12ENTRY(Reset_Handler)
13_system_stack_size = 0x800;
14
15SECTIONS
16{
17    .text :
18    {
19        . = ALIGN(4);
20        _stext = .;
21        KEEP(*(.isr_vector))            /* Startup code */
22        . = ALIGN(4);
23        *(.text)                        /* remaining code */
24        *(.text.*)                      /* remaining code */
25        *(.rodata)                      /* read-only data (constants) */
26        *(.rodata*)
27        *(.glue_7)
28        *(.glue_7t)
29        *(.gnu.linkonce.t*)
30
31        /* section information for finsh shell */
32        . = ALIGN(4);
33        __fsymtab_start = .;
34        KEEP(*(FSymTab))
35        __fsymtab_end = .;
36        . = ALIGN(4);
37        __vsymtab_start = .;
38        KEEP(*(VSymTab))
39        __vsymtab_end = .;
40        . = ALIGN(4);
41
42        /* section information for initial. */
43        . = ALIGN(4);
44        __rt_init_start = .;
45        KEEP(*(SORT(.rti_fn*)))
46        __rt_init_end = .;
47        . = ALIGN(4);
48
49        PROVIDE(__ctors_start__ = .);
50        KEEP (*(SORT(.init_array.*)))
51        KEEP (*(.init_array))
52        PROVIDE(__ctors_end__ = .);
53
54        . = ALIGN(4);
55        _etext = .;
56    } > CODE
57
58    /* .ARM.exidx is sorted, so has to go in its own output section.  */
59    __exidx_start = .;
60    .ARM.exidx :
61    {
62        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
63
64        /* This is used by the startup in order to initialize the .data secion */
65        _sidata = .;
66    } > CODE
67    __exidx_end = .;
68
69    /* .data section which is used for initialized data */
70
71    .data : AT (_sidata)
72    {
73        . = ALIGN(4);
74        /* This is used by the startup in order to initialize the .data secion */
75        _sdata = . ;
76
77        *(.data)
78        *(.data.*)
79        *(.gnu.linkonce.d*)
80
81
82        PROVIDE(__dtors_start__ = .);
83        KEEP(*(SORT(.dtors.*)))
84        KEEP(*(.dtors))
85        PROVIDE(__dtors_end__ = .);
86
87        . = ALIGN(4);
88        /* This is used by the startup in order to initialize the .data secion */
89        _edata = . ;
90    } >DATA
91
92    .stack :
93    {
94        . = ALIGN(8);
95        _sstack = .;
96        . = . + _system_stack_size;
97        . = ALIGN(8);
98        _estack = .;
99    } >DATA
100
101    __bss_start = .;
102    .bss :
103    {
104        . = ALIGN(4);
105        /* This is used by the startup in order to initialize the .bss secion */
106        _sbss = .;
107
108        *(.bss)
109        *(.bss.*)
110        *(COMMON)
111
112        . = ALIGN(4);
113        /* This is used by the startup in order to initialize the .bss secion */
114        _ebss = . ;
115
116        *(.bss.init)
117    } > DATA
118    __bss_end = .;
119
120    _end = .;
121
122    /* Stabs debugging sections.  */
123    .stab          0 : { *(.stab) }
124    .stabstr       0 : { *(.stabstr) }
125    .stab.excl     0 : { *(.stab.excl) }
126    .stab.exclstr  0 : { *(.stab.exclstr) }
127    .stab.index    0 : { *(.stab.index) }
128    .stab.indexstr 0 : { *(.stab.indexstr) }
129    .comment       0 : { *(.comment) }
130    /* DWARF debug sections.
131     * Symbols in the DWARF debugging sections are relative to the beginning
132     * of the section so we begin them at 0.  */
133    /* DWARF 1 */
134    .debug          0 : { *(.debug) }
135    .line           0 : { *(.line) }
136    /* GNU DWARF 1 extensions */
137    .debug_srcinfo  0 : { *(.debug_srcinfo) }
138    .debug_sfnames  0 : { *(.debug_sfnames) }
139    /* DWARF 1.1 and DWARF 2 */
140    .debug_aranges  0 : { *(.debug_aranges) }
141    .debug_pubnames 0 : { *(.debug_pubnames) }
142    /* DWARF 2 */
143    .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
144    .debug_abbrev   0 : { *(.debug_abbrev) }
145    .debug_line     0 : { *(.debug_line) }
146    .debug_frame    0 : { *(.debug_frame) }
147    .debug_str      0 : { *(.debug_str) }
148    .debug_loc      0 : { *(.debug_loc) }
149    .debug_macinfo  0 : { *(.debug_macinfo) }
150    /* SGI/MIPS DWARF 2 extensions */
151    .debug_weaknames 0 : { *(.debug_weaknames) }
152    .debug_funcnames 0 : { *(.debug_funcnames) }
153    .debug_typenames 0 : { *(.debug_typenames) }
154    .debug_varnames  0 : { *(.debug_varnames) }
155}
156
157