]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_GCC_ARM/LPC4330.ld
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_NXP / TARGET_LPC43XX / TOOLCHAIN_GCC_ARM / LPC4330.ld
1 /* Linker script for mbed LPC4330 */
2
3 /* Linker script to configure memory regions. */
4 MEMORY
5 {
6   RAM0 (rwx) : ORIGIN = 0x10000114, LENGTH = (128K - 0x114)
7   RAM1 (rwx) : ORIGIN = 0x10080000, LENGTH = 72K
8
9   RAM_AHB0 (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
10   RAM_AHB1 (rwx) : ORIGIN = 0x20008000, LENGTH = 32K
11
12   SPIFI (rx) : ORIGIN = 0x14000000, LENGTH = 32M
13 }
14
15 /* Linker script to place sections and symbol values. Should be used together
16  * with other linker script that defines memory regions FLASH and RAM.
17  * It references following symbols, which must be defined in code:
18  *   Reset_Handler : Entry of reset handler
19  * 
20  * It defines following symbols, which code can use without definition:
21  *   __exidx_start
22  *   __exidx_end
23  *   __etext
24  *   __data_start__
25  *   __preinit_array_start
26  *   __preinit_array_end
27  *   __init_array_start
28  *   __init_array_end
29  *   __fini_array_start
30  *   __fini_array_end
31  *   __data_end__
32  *   __bss_start__
33  *   __bss_end__
34  *   __end__
35  *   end
36  *   __HeapLimit
37  *   __StackLimit
38  *   __StackTop
39  *   __stack
40  */
41 ENTRY(Reset_Handler)
42
43 SECTIONS
44 {
45     .text :
46     {
47         KEEP(*(.isr_vector))
48         *(.text*)
49
50         KEEP(*(.init))
51         KEEP(*(.fini))
52
53         /* .ctors */
54         *crtbegin.o(.ctors)
55         *crtbegin?.o(.ctors)
56         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
57         *(SORT(.ctors.*))
58         *(.ctors)
59
60         /* .dtors */
61         *crtbegin.o(.dtors)
62         *crtbegin?.o(.dtors)
63         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
64         *(SORT(.dtors.*))
65         *(.dtors)
66
67         *(.rodata*)
68
69         KEEP(*(.eh_frame*))
70     } > SPIFI
71
72     .ARM.extab : 
73     {
74         *(.ARM.extab* .gnu.linkonce.armextab.*)
75     } > SPIFI
76
77     __exidx_start = .;
78     .ARM.exidx :
79     {
80         *(.ARM.exidx* .gnu.linkonce.armexidx.*)
81     } > SPIFI
82     __exidx_end = .;
83
84     __etext = .;
85         
86     .data : AT (__etext)
87     {
88         __data_start__ = .;
89         Image$$RW_IRAM1$$Base = .;
90         *(vtable)
91         *(.data*)
92
93         . = ALIGN(4);
94         /* preinit data */
95         PROVIDE (__preinit_array_start = .);
96         KEEP(*(.preinit_array))
97         PROVIDE (__preinit_array_end = .);
98
99         . = ALIGN(4);
100         /* init data */
101         PROVIDE (__init_array_start = .);
102         KEEP(*(SORT(.init_array.*)))
103         KEEP(*(.init_array))
104         PROVIDE (__init_array_end = .);
105
106
107         . = ALIGN(4);
108         /* finit data */
109         PROVIDE (__fini_array_start = .);
110         KEEP(*(SORT(.fini_array.*)))
111         KEEP(*(.fini_array))
112         PROVIDE (__fini_array_end = .);
113
114         . = ALIGN(4);
115         /* All data end */
116         __data_end__ = .;
117
118     } > RAM0
119
120     
121     .bss :
122     {
123         __bss_start__ = .;
124         *(.bss*)
125         *(COMMON)
126         __bss_end__ = .;
127         Image$$RW_IRAM1$$ZI$$Limit = . ;
128     } > RAM1
129
130     
131     .heap :
132     {
133         __end__ = .;
134         end = __end__;
135         *(.heap*)
136         __HeapLimit = .;
137     } > RAM1
138
139     /* .stack_dummy section doesn't contains any symbols. It is only
140      * used for linker to calculate size of stack sections, and assign
141      * values to stack symbols later */
142     .stack_dummy :
143     {
144         *(.stack)
145     } > RAM1
146
147     /* Set stack top to end of RAM, and stack limit move down by
148      * size of stack_dummy section */
149     __StackTop = ORIGIN(RAM1) + LENGTH(RAM1);
150     __StackLimit = __StackTop - SIZEOF(.stack_dummy);
151     PROVIDE(__stack = __StackTop);
152     
153     /* Check if data + heap + stack exceeds RAM limit */
154     ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
155
156
157     /* Code can explicitly ask for data to be 
158        placed in these higher RAM banks where
159        they will be left uninitialized. 
160     */
161     .AHBSRAM0 (NOLOAD):
162     {
163         Image$$RW_IRAM2$$Base = . ;
164         *(AHBSRAM0)
165         Image$$RW_IRAM2$$ZI$$Limit = .;
166     } > RAM_AHB0
167
168     .AHBSRAM1 (NOLOAD):
169     {
170         Image$$RW_IRAM3$$Base = . ;
171         *(AHBSRAM1)
172         Image$$RW_IRAM3$$ZI$$Limit = .;
173     } > RAM_AHB1
174 }