Skip to content

Commit bdd9746

Browse files
authored
Don't copy .data for NO_FLASH binaries, as it's loaded in-place (raspberrypi#859)
1 parent babc4a1 commit bdd9746

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/rp2_common/pico_standard_link/crt0.S

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ _reset_handler:
225225
cmp r0, #0
226226
bne hold_non_core0_in_bootrom
227227

228+
// In a NO_FLASH binary, don't perform .data copy, since it's loaded
229+
// in-place by the SRAM load. Still need to clear .bss
230+
#if !PICO_NO_FLASH
228231
adr r4, data_cpy_table
229232

230233
// assume there is at least one entry
@@ -235,6 +238,7 @@ _reset_handler:
235238
bl data_cpy
236239
b 1b
237240
2:
241+
#endif
238242

239243
// Zero out the BSS
240244
ldr r1, =__bss_start__
@@ -266,13 +270,18 @@ _exit:
266270
bkpt #0
267271
b 1b
268272

273+
#if !PICO_NO_FLASH
269274
data_cpy_loop:
270275
ldm r1!, {r0}
271276
stm r2!, {r0}
272277
data_cpy:
273278
cmp r2, r3
274279
blo data_cpy_loop
275280
bx lr
281+
#endif
282+
283+
// Note the data copy table is still included for NO_FLASH builds, even though
284+
// we skip the copy, because it is listed in binary info
276285

277286
.align 2
278287
data_cpy_table:

0 commit comments

Comments
 (0)