diff options
| -rw-r--r-- | ports/stm32/mboot/main.c | 4 | ||||
| -rw-r--r-- | ports/stm32/mboot/mboot.h | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index 1420f13fb..62f80a54e 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -1357,7 +1357,7 @@ void stm32_main(uint32_t initial_r0) { } #endif - if ((initial_r0 & 0xffffff00) == 0x70ad0000) { + if ((initial_r0 & 0xffffff00) == MBOOT_INITIAL_R0_KEY) { goto enter_bootloader; } @@ -1401,7 +1401,7 @@ enter_bootloader: mboot_pack_init(); #endif - if ((initial_r0 & 0xffffff80) == 0x70ad0080) { + if ((initial_r0 & 0xffffff80) == MBOOT_INITIAL_R0_KEY_FSLOAD) { mboot_state_change(MBOOT_STATE_FSLOAD_START, 0); int ret = -1; #if MBOOT_FSLOAD diff --git a/ports/stm32/mboot/mboot.h b/ports/stm32/mboot/mboot.h index d8531f19b..336d53682 100644 --- a/ports/stm32/mboot/mboot.h +++ b/ports/stm32/mboot/mboot.h @@ -46,6 +46,10 @@ #define MBOOT_ADDRESS_SPACE_64BIT (0) #endif +// These values are used in initial_r0 to enter mboot programatically. +#define MBOOT_INITIAL_R0_KEY (0x70ad0000) +#define MBOOT_INITIAL_R0_KEY_FSLOAD (MBOOT_INITIAL_R0_KEY | 0x80) + // These are for led_state_all() and can be or'd together. #define MBOOT_LED_STATE_LED0 (0x01) #define MBOOT_LED_STATE_LED1 (0x02) |
