From 349dd5089c918ac632c4b316dae0471decf0db20 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 27 Feb 2023 08:58:01 +1100 Subject: [PATCH] AP_HAL_ChibiOS: replace NO_FASTBOOT with AP_FASTBOOT_ENABLED --- Tools/AP_Bootloader/AP_Bootloader.cpp | 4 ++-- libraries/AP_HAL_ChibiOS/Scheduler.cpp | 2 +- libraries/AP_HAL_ChibiOS/hwdef/common/stm32_util.c | 6 +++--- libraries/AP_HAL_ChibiOS/hwdef/common/stm32_util.h | 4 ++++ libraries/AP_HAL_ChibiOS/hwdef/iomcu/hwdef.dat | 2 +- libraries/AP_HAL_ChibiOS/hwdef/iomcu_f103_8MHz/hwdef.dat | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Tools/AP_Bootloader/AP_Bootloader.cpp b/Tools/AP_Bootloader/AP_Bootloader.cpp index 26743bd9fa..d383905f3a 100644 --- a/Tools/AP_Bootloader/AP_Bootloader.cpp +++ b/Tools/AP_Bootloader/AP_Bootloader.cpp @@ -84,7 +84,7 @@ int main(void) stm32_flash_unprotect_flash(); #endif -#ifndef NO_FASTBOOT +#if AP_FASTBOOT_ENABLED enum rtc_boot_magic m = check_fast_reboot(); bool was_watchdog = stm32_was_watchdog_reset(); if (was_watchdog) { @@ -151,7 +151,7 @@ int main(void) // if we fail to boot properly we want to pause in bootloader to give // a chance to load new app code set_fast_reboot(RTC_BOOT_OFF); -#endif +#endif // AP_FASTBOOT_ENABLED #ifdef HAL_GPIO_PIN_STAY_IN_BOOTLOADER // optional "stay in bootloader" pin diff --git a/libraries/AP_HAL_ChibiOS/Scheduler.cpp b/libraries/AP_HAL_ChibiOS/Scheduler.cpp index 8f0d65abd3..7d4bf11c8f 100644 --- a/libraries/AP_HAL_ChibiOS/Scheduler.cpp +++ b/libraries/AP_HAL_ChibiOS/Scheduler.cpp @@ -285,7 +285,7 @@ void Scheduler::reboot(bool hold_in_bootloader) AP::FS().unmount(); #endif -#if !defined(NO_FASTBOOT) +#if AP_FASTBOOT_ENABLED // setup RTC for fast reboot set_fast_reboot(hold_in_bootloader?RTC_BOOT_HOLD:RTC_BOOT_FAST); #endif diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/stm32_util.c b/libraries/AP_HAL_ChibiOS/hwdef/common/stm32_util.c index f99c3fd1e6..df37a03a63 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/stm32_util.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/stm32_util.c @@ -209,7 +209,7 @@ uint32_t get_fattime() return fattime; } -#if !defined(NO_FASTBOOT) +#if AP_FASTBOOT_ENABLED // get RTC backup registers starting at given idx void get_rtc_backup(uint8_t idx, uint32_t *v, uint8_t n) @@ -272,7 +272,7 @@ void set_fast_reboot(enum rtc_boot_magic v) } } -#else // NO_FASTBOOT +#else // AP_FASTBOOT_ENABLED is not set // set n RTC backup registers starting at given idx void set_rtc_backup(uint8_t idx, const uint32_t *v, uint8_t n) @@ -289,7 +289,7 @@ void get_rtc_backup(uint8_t idx, uint32_t *v, uint8_t n) (void)v; (void)n; } -#endif // NO_FASTBOOT +#endif // AP_FASTBOOT_ENABLED /* enable peripheral power if needed This is done late to prevent diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/stm32_util.h b/libraries/AP_HAL_ChibiOS/hwdef/common/stm32_util.h index d26679e506..1e96ba7475 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/stm32_util.h +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/stm32_util.h @@ -20,6 +20,10 @@ #define AP_WATCHDOG_SAVE_FAULT_ENABLED 1 #endif +#ifndef AP_FASTBOOT_ENABLED +#define AP_FASTBOOT_ENABLED 1 +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/libraries/AP_HAL_ChibiOS/hwdef/iomcu/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/iomcu/hwdef.dat index 82884b2209..a958a4909a 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/iomcu/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/iomcu/hwdef.dat @@ -132,7 +132,7 @@ define DMA_RESERVE_SIZE 0 define SOFTSIG_MAX_SIGNAL_TRANSITIONS 128 define IOMCU_FW TRUE -define NO_FASTBOOT +define AP_FASTBOOT_ENABLED 0 IOMCU_FW 1 MAIN_STACK 0x200 PROCESS_STACK 0x250 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/iomcu_f103_8MHz/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/iomcu_f103_8MHz/hwdef.dat index 20c0d4bcbd..8c825d676d 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/iomcu_f103_8MHz/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/iomcu_f103_8MHz/hwdef.dat @@ -132,7 +132,7 @@ define DMA_RESERVE_SIZE 0 define SOFTSIG_MAX_SIGNAL_TRANSITIONS 128 define IOMCU_FW TRUE -define NO_FASTBOOT +define AP_FASTBOOT_ENABLED 0 IOMCU_FW 1 MAIN_STACK 0x200 PROCESS_STACK 0x250