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