]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC82X/TARGET_SSCI824/TOOLCHAIN_GCC_ARM/LPC824.ld
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_NXP / TARGET_LPC82X / TARGET_SSCI824 / TOOLCHAIN_GCC_ARM / LPC824.ld
1 /* Linker script for mbed LPC824-GCC-ARM based on LPC1114-GCC-ARM-LPC1114.ld */
2
3 /* Linker script to configure memory regions. */
4 MEMORY
5 {
6   /* Define each memory region */
7   FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x8000 /* 32K bytes */
8   RAM (rwx) : ORIGIN = 0x10000000+0xC0, LENGTH = 0x2000-0xC0 /* 8K bytes */
9
10
11 }
12
13 /* Linker script to place sections and symbol values. Should be used together
14  * with other linker script that defines memory regions FLASH and RAM.
15  * It references following symbols, which must be defined in code:
16  *   Reset_Handler : Entry of reset handler
17  * 
18  * It defines following symbols, which code can use without definition:
19  *   __exidx_start
20  *   __exidx_end
21  *   __etext
22  *   __data_start__
23  *   __preinit_array_start
24  *   __preinit_array_end
25  *   __init_array_start
26  *   __init_array_end
27  *   __fini_array_start
28  *   __fini_array_end
29  *   __data_end__
30  *   __bss_start__
31  *   __bss_end__
32  *   __end__
33  *   end
34  *   __HeapLimit
35  *   __StackLimit
36  *   __StackTop
37  *   __stack
38  */
39 ENTRY(Reset_Handler)
40
41 SECTIONS
42 {
43     .text :
44     {
45         KEEP(*(.isr_vector))
46                 *(.text.Reset_Handler)
47         *(.text.SystemInit)
48                 . = 0x200;
49         *(.text*)
50
51         KEEP(*(.init))
52         KEEP(*(.fini))
53
54         /* .ctors */
55         *crtbegin.o(.ctors)
56         *crtbegin?.o(.ctors)
57         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
58         *(SORT(.ctors.*))
59         *(.ctors)
60
61         /* .dtors */
62         *crtbegin.o(.dtors)
63         *crtbegin?.o(.dtors)
64         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
65         *(SORT(.dtors.*))
66         *(.dtors)
67
68         *(.rodata*)
69
70         KEEP(*(.eh_frame*))
71     } > FLASH
72
73     .ARM.extab : 
74     {
75         *(.ARM.extab* .gnu.linkonce.armextab.*)
76     } > FLASH
77
78     __exidx_start = .;
79     .ARM.exidx :
80     {
81         *(.ARM.exidx* .gnu.linkonce.armexidx.*)
82     } > FLASH
83     __exidx_end = .;
84
85     __etext = .;
86         
87     .data : AT (__etext)
88     {
89         __data_start__ = .;
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     } > RAM
119
120     .bss :
121     {
122         __bss_start__ = .;
123         *(.bss*)
124         *(COMMON)
125         __bss_end__ = .;
126     } > RAM
127     
128     .heap :
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 :
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     __StackLimit = __StackTop - SIZEOF(.stack_dummy);
148     PROVIDE(__stack = __StackTop);
149     
150     /* Check if data + heap + stack exceeds RAM limit */
151     ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
152 }