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