From a28bf358d125c37407142d4a2f1feca8ef2a1c0f Mon Sep 17 00:00:00 2001 From: bugobliterator Date: Wed, 27 Oct 2021 12:12:03 +0530 Subject: [PATCH] HAL_ChibiOS: skip compiling last_crash_dump if bootloader and GCS disabled --- libraries/AP_HAL_ChibiOS/Util.cpp | 4 +++- libraries/AP_HAL_ChibiOS/Util.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/Util.cpp b/libraries/AP_HAL_ChibiOS/Util.cpp index 2f3f2d8acc..5e3d83f1df 100644 --- a/libraries/AP_HAL_ChibiOS/Util.cpp +++ b/libraries/AP_HAL_ChibiOS/Util.cpp @@ -699,9 +699,10 @@ void Util::log_stack_info(void) #endif } -#if defined(HAL_CRASH_DUMP_FLASHPAGE) +#if defined(HAL_CRASH_DUMP_FLASHPAGE) && !defined(HAL_BOOTLOADER_BUILD) void Util::last_crash_dump(ExpandingString &str) const { +#if HAL_GCS_ENABLED // get dump size uint32_t size = stm32_crash_dump_size(); char* dump_start = (char*)stm32_flash_getpageaddr(HAL_CRASH_DUMP_FLASHPAGE); @@ -715,5 +716,6 @@ void Util::last_crash_dump(ExpandingString &str) const size = stm32_flash_getpagesize(HAL_CRASH_DUMP_FLASHPAGE); } str.append(dump_start, size); +#endif } #endif diff --git a/libraries/AP_HAL_ChibiOS/Util.h b/libraries/AP_HAL_ChibiOS/Util.h index 284d4e0540..d79bef270f 100644 --- a/libraries/AP_HAL_ChibiOS/Util.h +++ b/libraries/AP_HAL_ChibiOS/Util.h @@ -136,7 +136,7 @@ private: // log info on stack usage void log_stack_info(void) override; -#if defined(HAL_CRASH_DUMP_FLASHPAGE) +#if defined(HAL_CRASH_DUMP_FLASHPAGE) && !defined(HAL_BOOTLOADER_BUILD) // get last crash dump void last_crash_dump(ExpandingString &str) const override; #endif