feat(legacy): pushing 'go to bootloader flag' to bootloader main

pull/1461/head
Ondrej Mikle 3 years ago committed by Pavol Rusnak
parent 0ad63ca245
commit 37306350c0
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -31,6 +31,7 @@
#include "rng.h"
#include "setup.h"
#include "signatures.h"
#include "supervise.h"
#include "usb.h"
#include "util.h"
@ -123,6 +124,12 @@ int main(void) {
mpu_config_bootloader();
register uint32_t go_to_bootloader_flag __asm__("r11");
if (go_to_bootloader_flag == RETURN_TO_BOOTLOADER_FLAG) {
goto bootloader_loop_start;
}
#ifndef APPVER
bool left_pressed = (buttonRead() & BTN_PIN_NO) == 0;
@ -149,6 +156,8 @@ int main(void) {
}
#endif
bootloader_loop_start:
bootloader_loop();
return 0;

@ -32,6 +32,9 @@ reset_handler:
isb
#endif
ldr r0, =_go_to_bootloader_flag_addr // r0 - address of storage for "go to bootloader" flag
ldr r11, [r0] // r11 - keep in register and hope it gets to main
ldr r0, =_ram_start // r0 - point to beginning of SRAM
ldr r1, =_ram_end // r1 - point to byte after the end of SRAM
ldr r2, =0 // r2 - the byte-sized value to be written

Loading…
Cancel
Save