From 611e0ff7684818949f7f18546b540ff55de9b8ce Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 26 Mar 2023 14:53:34 +0200 Subject: Enable malloc error and stack overflow error detection in FreeRTOS. Count them and display them in the SystemInfo app. --- src/recoveryLoader.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/recoveryLoader.cpp') diff --git a/src/recoveryLoader.cpp b/src/recoveryLoader.cpp index d6f8d49b..0a4aa622 100644 --- a/src/recoveryLoader.cpp +++ b/src/recoveryLoader.cpp @@ -139,6 +139,18 @@ void DisplayProgressBar(uint8_t percent, uint16_t color) { } } +int mallocFailedCount = 0; +int stackOverflowCount = 0; +extern "C" { +void vApplicationMallocFailedHook() { + mallocFailedCount++; +} + +void vApplicationStackOverflowHook(TaskHandle_t /*xTask*/, char */*pcTaskName*/) { + stackOverflowCount++; +} +} + int main(void) { TaskHandle_t taskHandle; RefreshWatchdog(); -- cgit v1.2.3-70-g09d2