mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-07 05:02:38 +00:00
refactor(core): rename linker script section constants
[no changelog]
This commit is contained in:
parent
2671404e44
commit
7613fe310a
@ -14,12 +14,16 @@ MEMORY {
|
||||
_stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = 0;
|
||||
_confidential_section_start = 0;
|
||||
_confidential_section_end = 0;
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_CCMRAM;
|
||||
|
@ -14,12 +14,16 @@ MEMORY {
|
||||
_stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = 0;
|
||||
_confidential_section_start = 0;
|
||||
_confidential_section_end = 0;
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_CCMRAM;
|
||||
|
@ -13,13 +13,16 @@ _stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
_stack_section_size = SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = 0;
|
||||
_confidential_section_start = 0;
|
||||
_confidential_section_end = 0;
|
||||
|
||||
_codelen = LENGTH(FLASH) - SIZEOF(.vendorheader) - SIZEOF(.header) + SIZEOF(.flash2);
|
||||
_heap_start = ADDR(.heap);
|
||||
|
@ -14,12 +14,16 @@ MEMORY {
|
||||
_stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = 0;
|
||||
_confidential_section_start = 0;
|
||||
_confidential_section_end = 0;
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_CCMRAM;
|
||||
|
@ -14,12 +14,16 @@ MEMORY {
|
||||
_stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = 0;
|
||||
_confidential_section_start = 0;
|
||||
_confidential_section_end = 0;
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_CCMRAM;
|
||||
|
@ -17,17 +17,16 @@ MEMORY {
|
||||
_stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
confidential_lma = LOADADDR(.confidential);
|
||||
confidential_vma = ADDR(.confidential);
|
||||
confidential_size = SIZEOF(.confidential);
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = LOADADDR(.confidential);
|
||||
_confidential_section_start = ADDR(.confidential);
|
||||
_confidential_section_end = ADDR(.confidential) + SIZEOF(.confidential);
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_SRAM1;
|
||||
|
@ -16,17 +16,16 @@ MEMORY {
|
||||
_stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
confidential_lma = LOADADDR(.confidential);
|
||||
confidential_vma = ADDR(.confidential);
|
||||
confidential_size = SIZEOF(.confidential);
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = LOADADDR(.confidential);
|
||||
_confidential_section_start = ADDR(.confidential);
|
||||
_confidential_section_end = ADDR(.confidential) + SIZEOF(.confidential);
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_SRAM1;
|
||||
|
@ -12,17 +12,16 @@ _stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
_stack_section_size = SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
confidential_lma = LOADADDR(.confidential);
|
||||
confidential_vma = ADDR(.confidential);
|
||||
confidential_size = SIZEOF(.confidential);
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = LOADADDR(.confidential);
|
||||
_confidential_section_start = ADDR(.confidential);
|
||||
_confidential_section_end = ADDR(.confidential) + SIZEOF(.confidential);
|
||||
|
||||
_codelen = SIZEOF(.flash) + SIZEOF(.data) + SIZEOF(.confidential);
|
||||
_flash_start = ORIGIN(FLASH);
|
||||
|
@ -19,17 +19,16 @@ ustack_base = ADDR(.udata) + 512;
|
||||
_sustack = ADDR(.udata) + 256;
|
||||
_eustack = ustack_base;
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
confidential_lma = LOADADDR(.confidential);
|
||||
confidential_vma = ADDR(.confidential);
|
||||
confidential_size = SIZEOF(.confidential);
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = LOADADDR(.confidential);
|
||||
_confidential_section_start = ADDR(.confidential);
|
||||
_confidential_section_end = ADDR(.confidential) + SIZEOF(.confidential);
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_SRAM1;
|
||||
|
@ -16,17 +16,16 @@ MEMORY {
|
||||
_stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
confidential_lma = LOADADDR(.confidential);
|
||||
confidential_vma = ADDR(.confidential);
|
||||
confidential_size = SIZEOF(.confidential);
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = LOADADDR(.confidential);
|
||||
_confidential_section_start = ADDR(.confidential);
|
||||
_confidential_section_end = ADDR(.confidential) + SIZEOF(.confidential);
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_SRAM1;
|
||||
|
@ -17,17 +17,16 @@ MEMORY {
|
||||
_stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
confidential_lma = LOADADDR(.confidential);
|
||||
confidential_vma = ADDR(.confidential);
|
||||
confidential_size = SIZEOF(.confidential);
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = LOADADDR(.confidential);
|
||||
_confidential_section_start = ADDR(.confidential);
|
||||
_confidential_section_end = ADDR(.confidential) + SIZEOF(.confidential);
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_SRAM1 + BOOTARGS_SIZE;
|
||||
|
@ -16,18 +16,16 @@ MEMORY {
|
||||
_stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
confidential_lma = LOADADDR(.confidential);
|
||||
confidential_vma = ADDR(.confidential);
|
||||
confidential_size = SIZEOF(.confidential);
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = LOADADDR(.confidential);
|
||||
_confidential_section_start = ADDR(.confidential);
|
||||
_confidential_section_end = ADDR(.confidential) + SIZEOF(.confidential);
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_SRAM1 + BOOTARGS_SIZE;
|
||||
_startup_clear_ram_0_end = MCU_SRAM1 + MCU_SRAM1_SIZE;
|
||||
|
@ -11,17 +11,16 @@ _stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
_stack_section_size = SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
confidential_lma = LOADADDR(.confidential);
|
||||
confidential_vma = ADDR(.confidential);
|
||||
confidential_size = SIZEOF(.confidential);
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = LOADADDR(.confidential);
|
||||
_confidential_section_start = ADDR(.confidential);
|
||||
_confidential_section_end = ADDR(.confidential) + SIZEOF(.confidential);
|
||||
|
||||
_codelen = SIZEOF(.padding) + SIZEOF(.flash) + SIZEOF(.data) + SIZEOF(.confidential);
|
||||
_flash_start = ORIGIN(FLASH);
|
||||
|
@ -20,17 +20,16 @@ ustack_base = ADDR(.udata) + 512;
|
||||
_sustack = ADDR(.udata) + 256;
|
||||
_eustack = ustack_base;
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
confidential_lma = LOADADDR(.confidential);
|
||||
confidential_vma = ADDR(.confidential);
|
||||
confidential_size = SIZEOF(.confidential);
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = LOADADDR(.confidential);
|
||||
_confidential_section_start = ADDR(.confidential);
|
||||
_confidential_section_end = ADDR(.confidential) + SIZEOF(.confidential);
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_SRAM1;
|
||||
|
@ -16,17 +16,16 @@ MEMORY {
|
||||
_stack_section_start = ADDR(.stack);
|
||||
_stack_section_end = ADDR(.stack) + SIZEOF(.stack);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
bss_start = ADDR(.bss);
|
||||
bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
_data_section_loadaddr = LOADADDR(.data);
|
||||
_data_section_start = ADDR(.data);
|
||||
_data_section_end = ADDR(.data) + SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
confidential_lma = LOADADDR(.confidential);
|
||||
confidential_vma = ADDR(.confidential);
|
||||
confidential_size = SIZEOF(.confidential);
|
||||
_bss_section_start = ADDR(.bss);
|
||||
_bss_section_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
_confidential_section_loadaddr = LOADADDR(.confidential);
|
||||
_confidential_section_start = ADDR(.confidential);
|
||||
_confidential_section_end = ADDR(.confidential) + SIZEOF(.confidential);
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
_startup_clear_ram_0_start = MCU_SRAM1;
|
||||
|
@ -38,9 +38,10 @@ reset_handler:
|
||||
bl memset_reg
|
||||
|
||||
// copy data in from flash
|
||||
ldr r0, =data_vma // dst addr
|
||||
ldr r1, =data_lma // src addr
|
||||
ldr r2, =data_size // size in bytes
|
||||
ldr r0, =_data_section_start // dst addr
|
||||
ldr r1, =_data_section_loadaddr // src addr
|
||||
ldr r2, =_data_section_end // size in bytes
|
||||
sub r2, r2, r0
|
||||
bl memcpy
|
||||
|
||||
// setup the stack protector (see build script "-fstack-protector-all")
|
||||
|
@ -15,9 +15,10 @@ reset_handler:
|
||||
bl memset_reg
|
||||
|
||||
// copy data in from flash
|
||||
ldr r0, =data_vma // dst addr
|
||||
ldr r1, =data_lma // src addr
|
||||
ldr r2, =data_size // size in bytes
|
||||
ldr r0, =_data_section_start // dst addr
|
||||
ldr r1, =_data_section_loadaddr // src addr
|
||||
ldr r2, =_data_section_end // size in bytes
|
||||
sub r2, r2, r0
|
||||
bl memcpy
|
||||
|
||||
// setup the stack protector (see build script "-fstack-protector-all") with an unpredictable value
|
||||
|
@ -13,11 +13,12 @@ reset_handler:
|
||||
ldr r0, =_startup_clear_ram_1_start
|
||||
ldr r1, =_startup_clear_ram_1_end
|
||||
bl memset_reg
|
||||
|
||||
|
||||
// copy data in from flash
|
||||
ldr r0, =data_vma // dst addr
|
||||
ldr r1, =data_lma // src addr
|
||||
ldr r2, =data_size // size in bytes
|
||||
ldr r0, =_data_section_start // dst addr
|
||||
ldr r1, =_data_section_loadaddr // src addr
|
||||
ldr r2, =_data_section_end // size in bytes
|
||||
sub r2, r2, r0
|
||||
bl memcpy
|
||||
|
||||
// setup the stack protector (see build script "-fstack-protector-all") with an unpredictable value
|
||||
|
@ -12,16 +12,17 @@ reset_handler:
|
||||
ldr r0, = __stack_chk_guard
|
||||
str r2, [r0]
|
||||
|
||||
ldr r0, =bss_start
|
||||
ldr r0, =_bss_section_start
|
||||
ldr r1, =0
|
||||
ldr r2, =bss_end
|
||||
ldr r2, =_bss_section_end
|
||||
sub r2, r2, r0
|
||||
bl memset
|
||||
|
||||
// copy data in from flash
|
||||
ldr r0, =data_vma // dst addr
|
||||
ldr r1, =data_lma // src addr
|
||||
ldr r2, =data_size // size in bytes
|
||||
ldr r0, =_data_section_start // dst addr
|
||||
ldr r1, =_data_section_loadaddr // src addr
|
||||
ldr r2, =_data_section_end
|
||||
sub r2, r2, r0 // size in bytes
|
||||
bl memcpy
|
||||
|
||||
pop {r0, r1}
|
||||
|
@ -55,15 +55,17 @@ clear_ram:
|
||||
bl memset_reg
|
||||
|
||||
// copy data in from flash
|
||||
ldr r0, =data_vma // dst addr
|
||||
ldr r1, =data_lma // src addr
|
||||
ldr r2, =data_size // size in bytes
|
||||
ldr r0, =_data_section_start // dst addr
|
||||
ldr r1, =_data_section_loadaddr // src addr
|
||||
ldr r2, =_data_section_end // size in bytes
|
||||
sub r2, r2, r0
|
||||
bl memcpy
|
||||
|
||||
// copy confidential data in from flash
|
||||
ldr r0, =confidential_vma // dst addr
|
||||
ldr r1, =confidential_lma // src addr
|
||||
ldr r2, =confidential_size // size in bytes
|
||||
ldr r0, =_confidential_section_start // dst addr
|
||||
ldr r1, =_confidential_section_loadaddr // src addr
|
||||
ldr r2, =_confidential_section_end // size in bytes
|
||||
sub r2, r2, r0
|
||||
bl memcpy
|
||||
|
||||
// setup the stack protector (see build script "-fstack-protector-all") with an unpredictable value
|
||||
|
@ -23,15 +23,17 @@ reset_handler:
|
||||
bl memset_reg
|
||||
|
||||
// copy data in from flash
|
||||
ldr r0, =data_vma // dst addr
|
||||
ldr r1, =data_lma // src addr
|
||||
ldr r2, =data_size // size in bytes
|
||||
ldr r0, =_data_section_start // dst addr
|
||||
ldr r1, =_data_section_loadaddr // src addr
|
||||
ldr r2, =_data_section_end // size in bytes
|
||||
sub r2, r2, r0
|
||||
bl memcpy
|
||||
|
||||
// copy confidential data in from flash
|
||||
ldr r0, =confidential_vma // dst addr
|
||||
ldr r1, =confidential_lma // src addr
|
||||
ldr r2, =confidential_size // size in bytes
|
||||
ldr r0, =_confidential_section_start // dst addr
|
||||
ldr r1, =_confidential_section_loadaddr // src addr
|
||||
ldr r2, =_confidential_section_end // size in bytes
|
||||
sub r2, r2, r0
|
||||
bl memcpy
|
||||
|
||||
// setup the stack protector (see build script "-fstack-protector-all") with an unpredictable value
|
||||
|
@ -23,15 +23,17 @@ reset_handler:
|
||||
bl memset_reg
|
||||
|
||||
// copy data in from flash
|
||||
ldr r0, =data_vma // dst addr
|
||||
ldr r1, =data_lma // src addr
|
||||
ldr r2, =data_size // size in bytes
|
||||
ldr r0, =_data_section_start // dst addr
|
||||
ldr r1, =_data_section_loadaddr // src addr
|
||||
ldr r2, =_data_section_end // size in bytes
|
||||
sub r2, r2, r0
|
||||
bl memcpy
|
||||
|
||||
// copy confidential data in from flash
|
||||
ldr r0, =confidential_vma // dst addr
|
||||
ldr r1, =confidential_lma // src addr
|
||||
ldr r2, =confidential_size // size in bytes
|
||||
ldr r0, =_confidential_section_start // dst addr
|
||||
ldr r1, =_confidential_section_loadaddr // src addr
|
||||
ldr r2, =_confidential_section_end // size in bytes
|
||||
sub r2, r2, r0
|
||||
bl memcpy
|
||||
|
||||
// setup the stack protector (see build script "-fstack-protector-all") with an unpredictable value
|
||||
|
@ -12,22 +12,24 @@ reset_handler:
|
||||
ldr r0, = __stack_chk_guard
|
||||
str r2, [r0]
|
||||
|
||||
ldr r0, =bss_start
|
||||
ldr r0, =_bss_section_start
|
||||
ldr r1, =0
|
||||
ldr r2, =bss_end
|
||||
ldr r2, =_bss_section_end
|
||||
sub r2, r2, r0
|
||||
bl memset
|
||||
|
||||
// copy data in from flash
|
||||
ldr r0, =data_vma
|
||||
ldr r1, =data_lma
|
||||
ldr r2, =data_size
|
||||
ldr r0, =_data_section_start // dst addr
|
||||
ldr r1, =_data_section_loadaddr // src addr
|
||||
ldr r2, =_data_section_end // size in bytes
|
||||
sub r2, r2, r0
|
||||
bl memcpy
|
||||
|
||||
// copy confidential data in from flash
|
||||
ldr r0, =confidential_vma
|
||||
ldr r1, =confidential_lma
|
||||
ldr r2, =confidential_size
|
||||
ldr r0, =_confidential_section_start // dst addr
|
||||
ldr r1, =_confidential_section_loadaddr // src addr
|
||||
ldr r2, =_confidential_section_end // size in bytes
|
||||
sub r2, r2, r0
|
||||
bl memcpy
|
||||
|
||||
pop {r0, r1}
|
||||
|
@ -232,22 +232,24 @@ __attribute((naked, no_stack_protector)) void system_emergency_rescue(
|
||||
// Clear .bss, initialize .data, ...
|
||||
// --------------------------------------------------------------
|
||||
|
||||
"LDR R0, =bss_start \n" // Clear .bss
|
||||
"LDR R0, =_bss_section_start \n" // Clear .bss
|
||||
"MOV R1, #0 \n"
|
||||
"LDR R2, =bss_end \n"
|
||||
"LDR R2, =_bss_section_end \n"
|
||||
"SUB R2, R2, R0 \n"
|
||||
"BL memset \n"
|
||||
|
||||
"LDR R0, =data_vma \n" // Initialize .data
|
||||
"LDR R1, =data_lma \n"
|
||||
"LDR R2, =data_size \n"
|
||||
"LDR R0, =_data_section_start \n" // Initialize .data
|
||||
"LDR R1, =_data_section_loadaddr \n"
|
||||
"LDR R2, =_data_section_end \n"
|
||||
"SUB R2, R2, R0 \n"
|
||||
"BL memcpy \n"
|
||||
|
||||
#ifdef STM32U5
|
||||
"LDR R0, =confidential_vma \n" // Initialize .confidental
|
||||
"LDR R1, =confidential_lma \n"
|
||||
"LDR R2, =confidential_size \n"
|
||||
"BL memcpy \n"
|
||||
"LDR R0, =_confidential_section_start \n" // Initialize .confidental
|
||||
"LDR R1, =_confidential_section_loadaddr \n"
|
||||
"LDR R2, =_confidential_section_end \n"
|
||||
"SUB R2, R2, R0 \n"
|
||||
"BL memcpy \n"
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user