Don't copy .data for NO_FLASH binaries, as it's loaded in-place (#859)

This commit is contained in:
Luke Wren 2022-06-17 15:50:12 +01:00 committed by GitHub
parent babc4a1794
commit bdd9746635
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -225,6 +225,9 @@ _reset_handler:
cmp r0, #0 cmp r0, #0
bne hold_non_core0_in_bootrom bne hold_non_core0_in_bootrom
// In a NO_FLASH binary, don't perform .data copy, since it's loaded
// in-place by the SRAM load. Still need to clear .bss
#if !PICO_NO_FLASH
adr r4, data_cpy_table adr r4, data_cpy_table
// assume there is at least one entry // assume there is at least one entry
@ -235,6 +238,7 @@ _reset_handler:
bl data_cpy bl data_cpy
b 1b b 1b
2: 2:
#endif
// Zero out the BSS // Zero out the BSS
ldr r1, =__bss_start__ ldr r1, =__bss_start__
@ -266,6 +270,7 @@ _exit:
bkpt #0 bkpt #0
b 1b b 1b
#if !PICO_NO_FLASH
data_cpy_loop: data_cpy_loop:
ldm r1!, {r0} ldm r1!, {r0}
stm r2!, {r0} stm r2!, {r0}
@ -273,6 +278,10 @@ data_cpy:
cmp r2, r3 cmp r2, r3
blo data_cpy_loop blo data_cpy_loop
bx lr bx lr
#endif
// Note the data copy table is still included for NO_FLASH builds, even though
// we skip the copy, because it is listed in binary info
.align 2 .align 2
data_cpy_table: data_cpy_table: