]> git.donarmstrong.com Git - qmk_firmware.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/STM32F401XE.ld
Merge commit '1fe4406f374291ab2e86e95a97341fd9c475fcb8'
[qmk_firmware.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F4 / TARGET_NUCLEO_F401RE / TOOLCHAIN_GCC_ARM / STM32F401XE.ld
1 /* Linker script to configure memory regions. */
2 MEMORY
3
4   FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
5   RAM (rwx)  : ORIGIN = 0x20000194, LENGTH = 96k - 0x194
6 }
7
8 /* Linker script to place sections and symbol values. Should be used together
9  * with other linker script that defines memory regions FLASH and RAM.
10  * It references following symbols, which must be defined in code:
11  *   Reset_Handler : Entry of reset handler
12  * 
13  * It defines following symbols, which code can use without definition:
14  *   __exidx_start
15  *   __exidx_end
16  *   __etext
17  *   __data_start__
18  *   __preinit_array_start
19  *   __preinit_array_end
20  *   __init_array_start
21  *   __init_array_end
22  *   __fini_array_start
23  *   __fini_array_end
24  *   __data_end__
25  *   __bss_start__
26  *   __bss_end__
27  *   __end__
28  *   end
29  *   __HeapLimit
30  *   __StackLimit
31  *   __StackTop
32  *   __stack
33  *   _estack
34  */
35 ENTRY(Reset_Handler)
36
37 SECTIONS
38 {
39     .text :
40     {
41         KEEP(*(.isr_vector))
42         *(.text*)
43         KEEP(*(.init))
44         KEEP(*(.fini))
45
46         /* .ctors */
47         *crtbegin.o(.ctors)
48         *crtbegin?.o(.ctors)
49         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
50         *(SORT(.ctors.*))
51         *(.ctors)
52
53         /* .dtors */
54         *crtbegin.o(.dtors)
55         *crtbegin?.o(.dtors)
56         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
57         *(SORT(.dtors.*))
58         *(.dtors)
59
60         *(.rodata*)
61
62         KEEP(*(.eh_frame*))
63     } > FLASH
64
65     .ARM.extab :
66     {
67         *(.ARM.extab* .gnu.linkonce.armextab.*)
68     } > FLASH
69
70     __exidx_start = .;
71     .ARM.exidx :
72     {
73         *(.ARM.exidx* .gnu.linkonce.armexidx.*)
74     } > FLASH
75     __exidx_end = .;
76
77     __etext = .;
78     _sidata = .;
79
80     .data : AT (__etext)
81     {
82         __data_start__ = .;
83         _sdata = .;
84         *(vtable)
85         *(.data*)
86
87         . = ALIGN(4);
88         /* preinit data */
89         PROVIDE_HIDDEN (__preinit_array_start = .);
90         KEEP(*(.preinit_array))
91         PROVIDE_HIDDEN (__preinit_array_end = .);
92
93         . = ALIGN(4);
94         /* init data */
95         PROVIDE_HIDDEN (__init_array_start = .);
96         KEEP(*(SORT(.init_array.*)))
97         KEEP(*(.init_array))
98         PROVIDE_HIDDEN (__init_array_end = .);
99
100
101         . = ALIGN(4);
102         /* finit data */
103         PROVIDE_HIDDEN (__fini_array_start = .);
104         KEEP(*(SORT(.fini_array.*)))
105         KEEP(*(.fini_array))
106         PROVIDE_HIDDEN (__fini_array_end = .);
107
108         KEEP(*(.jcr*))
109         . = ALIGN(4);
110         /* All data end */
111         __data_end__ = .;
112         _edata = .;
113
114     } > RAM
115
116     .bss :
117     {
118         . = ALIGN(4);
119         __bss_start__ = .;
120         _sbss = .;
121         *(.bss*)
122         *(COMMON)
123         . = ALIGN(4);
124         __bss_end__ = .;
125         _ebss = .;
126     } > RAM
127
128     .heap (COPY):
129     {
130         __end__ = .;
131         end = __end__;
132         *(.heap*)
133         __HeapLimit = .;
134     } > RAM
135
136     /* .stack_dummy section doesn't contains any symbols. It is only
137      * used for linker to calculate size of stack sections, and assign
138      * values to stack symbols later */
139     .stack_dummy (COPY):
140     {
141         *(.stack*)
142     } > RAM
143
144     /* Set stack top to end of RAM, and stack limit move down by
145      * size of stack_dummy section */
146     __StackTop = ORIGIN(RAM) + LENGTH(RAM);
147     _estack = __StackTop;
148     __StackLimit = __StackTop - SIZEOF(.stack_dummy);
149     PROVIDE(__stack = __StackTop);
150
151     /* Check if data + heap + stack exceeds RAM limit */
152     ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
153 }