From 47c7acf1b3128a897d5f2d446f7abff5b218b6ef Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 15 Aug 2022 17:00:18 +1000 Subject: [PATCH] AP_HAL_ChibiOS: define HAL_ENABLE_SAVE_PERSISTENT_PARAMS for bootloader in hwdef.h --- libraries/AP_HAL_ChibiOS/Util.h | 2 +- .../AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_ChibiOS/Util.h b/libraries/AP_HAL_ChibiOS/Util.h index 73d189d809..d84a13d214 100644 --- a/libraries/AP_HAL_ChibiOS/Util.h +++ b/libraries/AP_HAL_ChibiOS/Util.h @@ -27,7 +27,7 @@ class ExpandingString; // on F7 and H7 we will try to save key persistent parameters at the // end of the bootloader sector. This enables temperature calibration // data to be saved persistently in the factory -#define HAL_ENABLE_SAVE_PERSISTENT_PARAMS !defined(HAL_BOOTLOADER_BUILD) && !defined(HAL_BUILD_AP_PERIPH) && (defined(STM32F7) || defined(STM32H7)) +#define HAL_ENABLE_SAVE_PERSISTENT_PARAMS (defined(STM32F7) || defined(STM32H7)) #endif class ChibiOS::Util : public AP_HAL::Util { diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index 6131a85734..60b2024f83 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -2989,6 +2989,11 @@ def add_apperiph_defaults(f): #ifndef AP_FENCE_ENABLED #define AP_FENCE_ENABLED 0 #endif + +// periph does not save temperature cals etc: +#ifndef HAL_ENABLE_SAVE_PERSISTENT_PARAMS +#define HAL_ENABLE_SAVE_PERSISTENT_PARAMS 0 +#endif ''') def add_bootloader_defaults(f): @@ -3018,6 +3023,11 @@ def add_bootloader_defaults(f): #endif #define HAL_MAX_CAN_PROTOCOL_DRIVERS 0 + +// bootloader does not save temperature cals etc: +#ifndef HAL_ENABLE_SAVE_PERSISTENT_PARAMS +#define HAL_ENABLE_SAVE_PERSISTENT_PARAMS 0 +#endif ''') def add_iomcu_firmware_defaults(f):