diff --git a/libraries/AP_HAL_ChibiOS/Util.cpp b/libraries/AP_HAL_ChibiOS/Util.cpp index 432106167d..9342293ff6 100644 --- a/libraries/AP_HAL_ChibiOS/Util.cpp +++ b/libraries/AP_HAL_ChibiOS/Util.cpp @@ -304,7 +304,7 @@ bool Util::was_watchdog_reset() const return stm32_was_watchdog_reset(); } -#if CH_DBG_ENABLE_STACK_CHECK == TRUE && !defined(HAL_BOOTLOADER_BUILD) +#if CH_DBG_ENABLE_STACK_CHECK == TRUE /* display stack usage as text buffer for @SYS/threads.txt */ @@ -343,4 +343,5 @@ size_t Util::thread_info(char *buf, size_t bufsize) return total; } -#endif +#endif // CH_DBG_ENABLE_STACK_CHECK == TRUE + diff --git a/libraries/AP_HAL_ChibiOS/Util.h b/libraries/AP_HAL_ChibiOS/Util.h index c716bb3159..f4143e4219 100644 --- a/libraries/AP_HAL_ChibiOS/Util.h +++ b/libraries/AP_HAL_ChibiOS/Util.h @@ -65,8 +65,10 @@ public: // return true if the reason for the reboot was a watchdog reset bool was_watchdog_reset() const override; +#if CH_DBG_ENABLE_STACK_CHECK == TRUE // request information on running threads size_t thread_info(char *buf, size_t bufsize) override; +#endif private: #ifdef HAL_PWM_ALARM diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index d7fef3a746..ff895c3ac2 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -773,10 +773,16 @@ def write_mcu_config(f): #define CH_CFG_USE_MEMCORE FALSE #define HAL_USE_I2C FALSE #define HAL_USE_PWM FALSE +#define CH_DBG_ENABLE_STACK_CHECK FALSE ''') if env_vars.get('ROMFS_UNCOMPRESSED', False): f.write('#define HAL_ROMFS_UNCOMPRESSED\n') + if 'AP_PERIPH' in env_vars: + f.write(''' +#define CH_DBG_ENABLE_STACK_CHECK FALSE +''') + def write_ldscript(fname): '''write ldscript.ld for this board'''