From 92571efeed55384d7eb4019df478ef8f1b4fd839 Mon Sep 17 00:00:00 2001 From: Hpsaturn Date: Sun, 8 Dec 2024 18:38:09 +0100 Subject: [PATCH] added coredump check utility only for debug versions --- lib/utils/src/debugUtils.hpp | 25 +++++++++++++++++++++++++ src/main.cpp | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 lib/utils/src/debugUtils.hpp diff --git a/lib/utils/src/debugUtils.hpp b/lib/utils/src/debugUtils.hpp new file mode 100644 index 00000000..8e84c238 --- /dev/null +++ b/lib/utils/src/debugUtils.hpp @@ -0,0 +1,25 @@ +#if CORE_DEBUG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG + +#include "esp_core_dump.h" + +void inline checkCoreDumpPartition() { + esp_core_dump_init(); + esp_core_dump_summary_t *summary = + static_cast(malloc(sizeof(esp_core_dump_summary_t))); + if (summary) { + esp_err_t err = esp_core_dump_get_summary(summary); + if (err == ESP_OK) { + log_i("Getting core dump summary ok."); + + } else { + log_e("Getting core dump summary not ok. Error: %d", (int)err); + log_e("Probably no coredump present yet."); + log_e("esp_core_dump_image_check() = %d", esp_core_dump_image_check()); + } + free(summary); + } +} + +#else +void inline checkCoreDumpPartition() {} +#endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 647e4c0b..35bdc30e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,6 +23,7 @@ #include "gps.hpp" #include "storage.hpp" #include "tft.hpp" +#include "debugUtils.hpp" #ifdef HMC5883L #include "compass.hpp" @@ -81,6 +82,7 @@ void calculateSun() */ void setup() { + checkCoreDumpPartition(); gpsMutex = xSemaphoreCreateMutex(); // Force GPIO0 to internal PullUP during boot (avoid LVGL key read)