]> git.gir.st - tmk_keyboard.git/blob - keyboard/infinity/mbed-infinity/infinity.ld
Merge commit '22b6e15a179031afb7c3534cf7b109b0668b602c'
[tmk_keyboard.git] / keyboard / infinity / mbed-infinity / infinity.ld
1 /*
2 * Linker script for Massdrop Infinity
3 * Infinity has bootloader in top 4KB sector of flash and app should be placed after the area.
4 *
5 * based on mbed.org K20 ARM GCC linker script file: MK20D5.ld
6 */
7
8 MEMORY
9 {
10 /* Infinity blootloader uses 4KB */
11 FLASH (rx) : ORIGIN = 4K, LENGTH = 128K - 4K
12 RAM (rwx) : ORIGIN = 0x1FFFE0F8, LENGTH = 16K - 0xF8
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_init : 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 __vector_table = .;
48 KEEP(*(.isr_vector))
49 *(.text.Reset_Handler)
50 *(.text.System_Init)
51 . = ALIGN(4);
52
53 *(.text*)
54
55 KEEP(*(.init))
56 KEEP(*(.fini))
57
58 /* .ctors */
59 *crtbegin.o(.ctors)
60 *crtbegin?.o(.ctors)
61 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
62 *(SORT(.ctors.*))
63 *(.ctors)
64
65 /* .dtors */
66 *crtbegin.o(.dtors)
67 *crtbegin?.o(.dtors)
68 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
69 *(SORT(.dtors.*))
70 *(.dtors)
71
72 *(.rodata*)
73
74 KEEP(*(.eh_frame*))
75 } > FLASH
76
77 .ARM.extab :
78 {
79 *(.ARM.extab* .gnu.linkonce.armextab.*)
80 } > FLASH
81
82 __exidx_start = .;
83 .ARM.exidx :
84 {
85 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
86 } > FLASH
87 __exidx_end = .;
88
89 __etext = .;
90
91 .data : AT (__etext)
92 {
93 __data_start__ = .;
94 *(vtable)
95 *(.data*)
96
97 . = ALIGN(4);
98 /* preinit data */
99 PROVIDE_HIDDEN (__preinit_array_start = .);
100 KEEP(*(.preinit_array))
101 PROVIDE_HIDDEN (__preinit_array_end = .);
102
103 . = ALIGN(4);
104 /* init data */
105 PROVIDE_HIDDEN (__init_array_start = .);
106 KEEP(*(SORT(.init_array.*)))
107 KEEP(*(.init_array))
108 PROVIDE_HIDDEN (__init_array_end = .);
109
110
111 . = ALIGN(4);
112 /* finit data */
113 PROVIDE_HIDDEN (__fini_array_start = .);
114 KEEP(*(SORT(.fini_array.*)))
115 KEEP(*(.fini_array))
116 PROVIDE_HIDDEN (__fini_array_end = .);
117
118 . = ALIGN(4);
119 /* All data end */
120 __data_end__ = .;
121
122 } > RAM
123
124 .bss :
125 {
126 __bss_start__ = .;
127 *(.bss*)
128 *(COMMON)
129 __bss_end__ = .;
130 } > RAM
131
132 .heap :
133 {
134 __end__ = .;
135 end = __end__;
136 *(.heap*)
137 __HeapLimit = .;
138 } > RAM
139
140 /* .stack_dummy section doesn't contains any symbols. It is only
141 * used for linker to calculate size of stack sections, and assign
142 * values to stack symbols later */
143 .stack_dummy :
144 {
145 *(.stack)
146 } > RAM
147
148 /* Set stack top to end of RAM, and stack limit move down by
149 * size of stack_dummy section */
150 __StackTop = ORIGIN(RAM) + LENGTH(RAM);
151 __StackLimit = __StackTop - SIZEOF(.stack_dummy);
152 PROVIDE(__stack = __StackTop);
153
154 /* Check if data + heap + stack exceeds RAM limit */
155 ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
156 }
Imprint / Impressum