1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

Change MSC boot mode to use persistence layer and unify with bootloader

Replaced the existing `PERSISTENT_OBJECT_BOOTLOADER_REQUEST` that was bootloader specific, with `PERSISTENT_OBJECT_BOOTMODE_REQUEST` that can be shared by any required boot mode based on it's contents. Currently supports bootloader and MSC, but is extensible for additional future needs. The previous hardcoded memory address usage for MSC boot was removed.
This commit is contained in:
Bruce Luckcuck 2019-01-12 17:53:24 -05:00
parent 5c5520ecf4
commit 065ce24d4d
7 changed files with 26 additions and 25 deletions

View file

@ -41,7 +41,7 @@ void systemReset(void)
void systemResetToBootloader(void)
{
persistentObjectWrite(PERSISTENT_OBJECT_BOOTLOADER_REQUEST, BOOTLOADER_REQUEST_COOKIE);
persistentObjectWrite(PERSISTENT_OBJECT_BOOTMODE_REQUEST, BOOTLOADER_REQUEST_COOKIE);
__disable_irq();
NVIC_SystemReset();
@ -56,13 +56,12 @@ typedef struct isrVector_s {
void checkForBootLoaderRequest(void)
{
uint32_t bootloaderRequest = persistentObjectRead(PERSISTENT_OBJECT_BOOTLOADER_REQUEST);
persistentObjectWrite(PERSISTENT_OBJECT_BOOTLOADER_REQUEST, 0);
uint32_t bootloaderRequest = persistentObjectRead(PERSISTENT_OBJECT_BOOTMODE_REQUEST);
if (bootloaderRequest != BOOTLOADER_REQUEST_COOKIE) {
return;
}
persistentObjectWrite(PERSISTENT_OBJECT_BOOTMODE_REQUEST, 0);
extern isrVector_t system_isr_vector_table_base;