1/*
2 * linker script for STM32WBXX 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 = 1024k /* 1024KB flash */
9    RAM (rw) : ORIGIN = 0x20000000, LENGTH = 192k  /* 192KB sram */
10}
11ENTRY(Reset_Handler)
12_system_stack_size = 0x400;
13
14SECTIONS
15{
16    .text :
17    {
18        . = ALIGN(4);
19        _stext = .;
20        KEEP(*(.isr_vector))            /* Startup code */
21
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
37        . = ALIGN(4);
38        __vsymtab_start = .;
39        KEEP(*(VSymTab))
40        __vsymtab_end = .;
41
42        /* section information for initial. */
43        . = ALIGN(4);
44        __rt_init_start = .;
45        KEEP(*(SORT(.rti_fn*)))
46        __rt_init_end = .;
47
48        . = ALIGN(4);
49
50        PROVIDE(__ctors_start__ = .);
51        KEEP (*(SORT(.init_array.*)))
52        KEEP (*(.init_array))
53        PROVIDE(__ctors_end__ = .);
54
55        . = ALIGN(4);
56
57        _etext = .;
58    } > ROM = 0
59
60    /* .ARM.exidx is sorted, so has to go in its own output section.  */
61    __exidx_start = .;
62    .ARM.exidx :
63    {
64        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
65
66        /* This is used by the startup in order to initialize the .data secion */
67        _sidata = .;
68    } > ROM
69    __exidx_end = .;
70
71    /* .data section which is used for initialized data */
72
73    .data : AT (_sidata)
74    {
75        . = ALIGN(4);
76        /* This is used by the startup in order to initialize the .data secion */
77        _sdata = . ;
78
79        *(.data)
80        *(.data.*)
81        *(.gnu.linkonce.d*)
82
83        PROVIDE(__dtors_start__ = .);
84        KEEP(*(SORT(.dtors.*)))
85        KEEP(*(.dtors))
86        PROVIDE(__dtors_end__ = .);
87
88        . = ALIGN(4);
89        /* This is used by the startup in order to initialize the .data secion */
90        _edata = . ;
91    } > RAM
92
93    .stack :
94    {
95        . = ALIGN(4);
96        _sstack = .;
97        . = . + _system_stack_size;
98        . = ALIGN(4);
99        _estack = .;
100    } > RAM
101
102    __bss_start = .;
103    .bss :
104    {
105        . = ALIGN(4);
106        /* This is used by the startup in order to initialize the .bss secion */
107        _sbss = .;
108
109        *(.bss)
110        *(.bss.*)
111        *(COMMON)
112
113        . = ALIGN(4);
114        /* This is used by the startup in order to initialize the .bss secion */
115        _ebss = . ;
116
117        *(.bss.init)
118    } > RAM
119    __bss_end = .;
120
121    _end = .;
122
123    /* Stabs debugging sections.  */
124    .stab          0 : { *(.stab) }
125    .stabstr       0 : { *(.stabstr) }
126    .stab.excl     0 : { *(.stab.excl) }
127    .stab.exclstr  0 : { *(.stab.exclstr) }
128    .stab.index    0 : { *(.stab.index) }
129    .stab.indexstr 0 : { *(.stab.indexstr) }
130    .comment       0 : { *(.comment) }
131    /* DWARF debug sections.
132     * Symbols in the DWARF debugging sections are relative to the beginning
133     * of the section so we begin them at 0.  */
134    /* DWARF 1 */
135    .debug          0 : { *(.debug) }
136    .line           0 : { *(.line) }
137    /* GNU DWARF 1 extensions */
138    .debug_srcinfo  0 : { *(.debug_srcinfo) }
139    .debug_sfnames  0 : { *(.debug_sfnames) }
140    /* DWARF 1.1 and DWARF 2 */
141    .debug_aranges  0 : { *(.debug_aranges) }
142    .debug_pubnames 0 : { *(.debug_pubnames) }
143    /* DWARF 2 */
144    .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
145    .debug_abbrev   0 : { *(.debug_abbrev) }
146    .debug_line     0 : { *(.debug_line) }
147    .debug_frame    0 : { *(.debug_frame) }
148    .debug_str      0 : { *(.debug_str) }
149    .debug_loc      0 : { *(.debug_loc) }
150    .debug_macinfo  0 : { *(.debug_macinfo) }
151    /* SGI/MIPS DWARF 2 extensions */
152    .debug_weaknames 0 : { *(.debug_weaknames) }
153    .debug_funcnames 0 : { *(.debug_funcnames) }
154    .debug_typenames 0 : { *(.debug_typenames) }
155    .debug_varnames  0 : { *(.debug_varnames) }
156
157    .ARM.attributes 0       : { *(.ARM.attributes) }
158   MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED
159   MB_MEM1 (NOLOAD)       : { *(MB_MEM1) } >RAM_SHARED
160   MB_MEM2 (NOLOAD)       : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED
161   MB_MEM3 (NOLOAD)       : { _siMB_MEM2 = . ; *(MB_MEM3) ; _siMB_MEM2 = . ; } >RAM_SHARED
162}
163