|
@@ -1,258 +0,0 @@
|
1
|
|
-/* Based on GCC ARM embedded samples.
|
2
|
|
- Defines the following symbols for use by code:
|
3
|
|
- __exidx_start
|
4
|
|
- __exidx_end
|
5
|
|
- __etext
|
6
|
|
- __data_start__
|
7
|
|
- __preinit_array_start
|
8
|
|
- __preinit_array_end
|
9
|
|
- __init_array_start
|
10
|
|
- __init_array_end
|
11
|
|
- __fini_array_start
|
12
|
|
- __fini_array_end
|
13
|
|
- __data_end__
|
14
|
|
- __bss_start__
|
15
|
|
- __bss_end__
|
16
|
|
- __end__
|
17
|
|
- end
|
18
|
|
- __HeapLimit
|
19
|
|
- __StackLimit
|
20
|
|
- __StackTop
|
21
|
|
- __stack (== StackTop)
|
22
|
|
-*/
|
23
|
|
-
|
24
|
|
-/*
|
25
|
|
- * TODO: Hard-code 360k, which is the size I see on my machine with
|
26
|
|
- * 'sta' mode and debug printf.
|
27
|
|
- * There must be a better way to determine the size dynamically somehow.
|
28
|
|
- */
|
29
|
|
-MEMORY
|
30
|
|
-{
|
31
|
|
- FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 360k
|
32
|
|
- RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k
|
33
|
|
- SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
|
34
|
|
- SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
|
35
|
|
-}
|
36
|
|
-
|
37
|
|
-ENTRY(_entry_point)
|
38
|
|
-
|
39
|
|
-SECTIONS
|
40
|
|
-{
|
41
|
|
- /* Second stage bootloader is prepended to the image. It must be 256 bytes big
|
42
|
|
- and checksummed. It is usually built by the boot_stage2 target
|
43
|
|
- in the Raspberry Pi Pico SDK
|
44
|
|
- */
|
45
|
|
-
|
46
|
|
- .flash_begin : {
|
47
|
|
- __flash_binary_start = .;
|
48
|
|
- } > FLASH
|
49
|
|
-
|
50
|
|
- .boot2 : {
|
51
|
|
- __boot2_start__ = .;
|
52
|
|
- KEEP (*(.boot2))
|
53
|
|
- __boot2_end__ = .;
|
54
|
|
- } > FLASH
|
55
|
|
-
|
56
|
|
- ASSERT(__boot2_end__ - __boot2_start__ == 256,
|
57
|
|
- "ERROR: Pico second stage bootloader must be 256 bytes in size")
|
58
|
|
-
|
59
|
|
- /* The second stage will always enter the image at the start of .text.
|
60
|
|
- The debugger will use the ELF entry point, which is the _entry_point
|
61
|
|
- symbol if present, otherwise defaults to start of .text.
|
62
|
|
- This can be used to transfer control back to the bootrom on debugger
|
63
|
|
- launches only, to perform proper flash setup.
|
64
|
|
- */
|
65
|
|
-
|
66
|
|
- .flashtext : {
|
67
|
|
- __logical_binary_start = .;
|
68
|
|
- KEEP (*(.vectors))
|
69
|
|
- KEEP (*(.binary_info_header))
|
70
|
|
- __binary_info_header_end = .;
|
71
|
|
- KEEP (*(.reset))
|
72
|
|
- }
|
73
|
|
-
|
74
|
|
- .rodata : {
|
75
|
|
- /* segments not marked as .flashdata are instead pulled into .data (in RAM) to avoid accidental flash accesses */
|
76
|
|
- *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*)))
|
77
|
|
- . = ALIGN(4);
|
78
|
|
- } > FLASH
|
79
|
|
-
|
80
|
|
- .ARM.extab :
|
81
|
|
- {
|
82
|
|
- *(.ARM.extab* .gnu.linkonce.armextab.*)
|
83
|
|
- } > FLASH
|
84
|
|
-
|
85
|
|
- __exidx_start = .;
|
86
|
|
- .ARM.exidx :
|
87
|
|
- {
|
88
|
|
- *(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
89
|
|
- } > FLASH
|
90
|
|
- __exidx_end = .;
|
91
|
|
-
|
92
|
|
- /* Machine inspectable binary information */
|
93
|
|
- . = ALIGN(4);
|
94
|
|
- __binary_info_start = .;
|
95
|
|
- .binary_info :
|
96
|
|
- {
|
97
|
|
- KEEP(*(.binary_info.keep.*))
|
98
|
|
- *(.binary_info.*)
|
99
|
|
- } > FLASH
|
100
|
|
- __binary_info_end = .;
|
101
|
|
- . = ALIGN(4);
|
102
|
|
-
|
103
|
|
- /* Vector table goes first in RAM, to avoid large alignment hole */
|
104
|
|
- .ram_vector_table (COPY): {
|
105
|
|
- *(.ram_vector_table)
|
106
|
|
- } > RAM
|
107
|
|
-
|
108
|
|
- .text : {
|
109
|
|
- __ram_text_start__ = .;
|
110
|
|
- *(.init)
|
111
|
|
- *(.text*)
|
112
|
|
- *(.fini)
|
113
|
|
- /* Pull all c'tors into .text */
|
114
|
|
- *crtbegin.o(.ctors)
|
115
|
|
- *crtbegin?.o(.ctors)
|
116
|
|
- *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
117
|
|
- *(SORT(.ctors.*))
|
118
|
|
- *(.ctors)
|
119
|
|
- /* Followed by destructors */
|
120
|
|
- *crtbegin.o(.dtors)
|
121
|
|
- *crtbegin?.o(.dtors)
|
122
|
|
- *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
123
|
|
- *(SORT(.dtors.*))
|
124
|
|
- *(.dtors)
|
125
|
|
-
|
126
|
|
- *(.eh_frame*)
|
127
|
|
- . = ALIGN(4);
|
128
|
|
- __ram_text_end__ = .;
|
129
|
|
- } > RAM AT> FLASH
|
130
|
|
- __ram_text_source__ = LOADADDR(.text);
|
131
|
|
-
|
132
|
|
-
|
133
|
|
- .data : {
|
134
|
|
- __data_start__ = .;
|
135
|
|
- *(vtable)
|
136
|
|
-
|
137
|
|
- *(.time_critical*)
|
138
|
|
-
|
139
|
|
- . = ALIGN(4);
|
140
|
|
- *(.rodata*)
|
141
|
|
- . = ALIGN(4);
|
142
|
|
-
|
143
|
|
- *(.data*)
|
144
|
|
-
|
145
|
|
- . = ALIGN(4);
|
146
|
|
- *(.after_data.*)
|
147
|
|
- . = ALIGN(4);
|
148
|
|
- /* preinit data */
|
149
|
|
- PROVIDE_HIDDEN (__mutex_array_start = .);
|
150
|
|
- KEEP(*(SORT(.mutex_array.*)))
|
151
|
|
- KEEP(*(.mutex_array))
|
152
|
|
- PROVIDE_HIDDEN (__mutex_array_end = .);
|
153
|
|
-
|
154
|
|
- . = ALIGN(4);
|
155
|
|
- /* preinit data */
|
156
|
|
- PROVIDE_HIDDEN (__preinit_array_start = .);
|
157
|
|
- KEEP(*(SORT(.preinit_array.*)))
|
158
|
|
- KEEP(*(.preinit_array))
|
159
|
|
- PROVIDE_HIDDEN (__preinit_array_end = .);
|
160
|
|
-
|
161
|
|
- . = ALIGN(4);
|
162
|
|
- /* init data */
|
163
|
|
- PROVIDE_HIDDEN (__init_array_start = .);
|
164
|
|
- KEEP(*(SORT(.init_array.*)))
|
165
|
|
- KEEP(*(.init_array))
|
166
|
|
- PROVIDE_HIDDEN (__init_array_end = .);
|
167
|
|
-
|
168
|
|
- . = ALIGN(4);
|
169
|
|
- /* finit data */
|
170
|
|
- PROVIDE_HIDDEN (__fini_array_start = .);
|
171
|
|
- *(SORT(.fini_array.*))
|
172
|
|
- *(.fini_array)
|
173
|
|
- PROVIDE_HIDDEN (__fini_array_end = .);
|
174
|
|
-
|
175
|
|
- *(.jcr)
|
176
|
|
- . = ALIGN(4);
|
177
|
|
- /* All data end */
|
178
|
|
- __data_end__ = .;
|
179
|
|
- } > RAM AT> FLASH
|
180
|
|
- /* __etext is the name of the .data init source pointer (...) */
|
181
|
|
- __etext = LOADADDR(.data);
|
182
|
|
-
|
183
|
|
- .uninitialized_data (COPY): {
|
184
|
|
- . = ALIGN(4);
|
185
|
|
- *(.uninitialized_data*)
|
186
|
|
- } > RAM
|
187
|
|
-
|
188
|
|
- /* Start and end symbols must be word-aligned */
|
189
|
|
- .scratch_x : {
|
190
|
|
- __scratch_x_start__ = .;
|
191
|
|
- *(.scratch_x.*)
|
192
|
|
- . = ALIGN(4);
|
193
|
|
- __scratch_x_end__ = .;
|
194
|
|
- } > SCRATCH_X AT > FLASH
|
195
|
|
- __scratch_x_source__ = LOADADDR(.scratch_x);
|
196
|
|
-
|
197
|
|
- .scratch_y : {
|
198
|
|
- __scratch_y_start__ = .;
|
199
|
|
- *(.scratch_y.*)
|
200
|
|
- . = ALIGN(4);
|
201
|
|
- __scratch_y_end__ = .;
|
202
|
|
- } > SCRATCH_Y AT > FLASH
|
203
|
|
- __scratch_y_source__ = LOADADDR(.scratch_y);
|
204
|
|
-
|
205
|
|
- .bss : {
|
206
|
|
- . = ALIGN(4);
|
207
|
|
- __bss_start__ = .;
|
208
|
|
- *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*)))
|
209
|
|
- *(COMMON)
|
210
|
|
- . = ALIGN(4);
|
211
|
|
- __bss_end__ = .;
|
212
|
|
- } > RAM
|
213
|
|
-
|
214
|
|
- .heap (COPY):
|
215
|
|
- {
|
216
|
|
- __end__ = .;
|
217
|
|
- end = __end__;
|
218
|
|
- *(.heap*)
|
219
|
|
- __HeapLimit = .;
|
220
|
|
- } > RAM
|
221
|
|
-
|
222
|
|
- /* .stack*_dummy section doesn't contains any symbols. It is only
|
223
|
|
- * used for linker to calculate size of stack sections, and assign
|
224
|
|
- * values to stack symbols later
|
225
|
|
- *
|
226
|
|
- * stack1 section may be empty/missing if platform_launch_core1 is not used */
|
227
|
|
-
|
228
|
|
- /* by default we put core 0 stack at the end of scratch Y, so that if core 1
|
229
|
|
- * stack is not used then all of SCRATCH_X is free.
|
230
|
|
- */
|
231
|
|
- .stack1_dummy (COPY):
|
232
|
|
- {
|
233
|
|
- *(.stack1*)
|
234
|
|
- } > SCRATCH_X
|
235
|
|
- .stack_dummy (COPY):
|
236
|
|
- {
|
237
|
|
- *(.stack*)
|
238
|
|
- } > SCRATCH_Y
|
239
|
|
-
|
240
|
|
- .flash_end : {
|
241
|
|
- __flash_binary_end = .;
|
242
|
|
- } > FLASH
|
243
|
|
-
|
244
|
|
- /* stack limit is poorly named, but historically is maximum heap ptr */
|
245
|
|
- __StackLimit = ORIGIN(RAM) + LENGTH(RAM);
|
246
|
|
- __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X);
|
247
|
|
- __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y);
|
248
|
|
- __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy);
|
249
|
|
- __StackBottom = __StackTop - SIZEOF(.stack_dummy);
|
250
|
|
- PROVIDE(__stack = __StackTop);
|
251
|
|
-
|
252
|
|
- /* Check if data + heap + stack exceeds RAM limit */
|
253
|
|
- ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed")
|
254
|
|
-
|
255
|
|
- ASSERT( __binary_info_header_end - __logical_binary_start <= 256, "Binary info must be in first 256 bytes of the binary")
|
256
|
|
- /* todo assert on extra code */
|
257
|
|
-}
|
258
|
|
-
|