1/* 2 * Arm SCP/MCP Software 3 * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 .syntax unified 9 10 .text 11 12/* 13 * noreturn void mod_bootloader_boot( 14 * uint8_t *destination, 15 * const uint8_t *source, 16 * uint32_t size, 17 * uint32_t *vtor); 18 */ 19 .thumb 20 .thumb_func 21 .global mod_bootloader_boot 22 .type mod_bootloader_boot, %function 23mod_bootloader_boot: 24 movs r4, r0 /* Save the destination - it soon points to the vector table */ 25 261: 27 ldrb r5, [r1], #1 /* Load next byte from source */ 28 strb r5, [r0], #1 /* Store next byte at destination */ 29 30 subs r2, #1 /* Decrement the size, which we use as the counter... */ 31 bne 1b /* ... until it reaches zero */ 32 33 str r4, [r3] /* Store vector table address in SCB->VTOR (if it exists) */ 34 35 ldr r0, [r4] /* Grab new stack pointer from vector table... */ 36 msr msp, r0 /* ... and update the main stack pointer with it */ 37 38 ldr r0, [r4, #4] /* Load the reset address from the vector table... */ 39 bx r0 /* ... and take a leap of faith */ 40 41 .pool 42