Skip to content

Commit

Permalink
added coredump check utility only for debug versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hpsaturn committed Dec 8, 2024
1 parent eb70b1e commit 92571ef
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/utils/src/debugUtils.hpp
Original file line number Diff line number Diff line change
@@ -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<esp_core_dump_summary_t *>(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
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "gps.hpp"
#include "storage.hpp"
#include "tft.hpp"
#include "debugUtils.hpp"

#ifdef HMC5883L
#include "compass.hpp"
Expand Down Expand Up @@ -81,6 +82,7 @@ void calculateSun()
*/
void setup()
{
checkCoreDumpPartition();
gpsMutex = xSemaphoreCreateMutex();

// Force GPIO0 to internal PullUP during boot (avoid LVGL key read)
Expand Down

0 comments on commit 92571ef

Please sign in to comment.