.syntax unified .thumb .text .global start @ STM32F7 flash loader, run from SRAM with the core halted->resumed by the debugger. @ in: r0 = source (SRAM), r1 = destination (flash), r2 = word count, r3 = FLASH base 0x40023C00 @ FLASH_CR must already be PSIZE32|PG. out: r0 = FLASH_SR at the end (0 errors = OK), halts on bkpt. start: loop: ldr r4, [r0], #4 str r4, [r1], #4 dsb sy wait: ldr r5, [r3, #0x0C] @ FLASH_SR tst r5, #0x10000 @ BSY bne wait tst r5, #0xF2 @ any error flag bne done subs r2, r2, #1 bne loop done: mov r0, r5 bkpt #0