FreeRTOS ends in Dummy_Handler()

eduardo1966 wrote on Wednesday, April 10, 2019:

Hi
I have an application that after running for awhile ends in the Dummy_Handler().
(see the attachment, please)
In prvPortStartFirstTask() something seems to go wrong… (most likely it went wrong before)
Any ideas how I could find the cause for this?

thanks

eduardo1966 wrote on Wednesday, April 10, 2019:

I got another crash. A bit different, but more or less the same. (see attachment please)

richarddamon wrote on Wednesday, April 10, 2019:

First thing to note, the stack trace for interupts may not be totally accurate, as the line Signal Handler Called from fffffffd actually indicates that a change of stack usage happened, and it appears this debugger didn’t then follow the other stack frame, but just continued tracing the stack used by the ISR.

Second, this sort of error tends to indicate that some corruption has occured, w,hich is frequently cause by interrupts having wrong priorities, and corrupting the FreeRTOS state. Make sure you have define an appropriate configASSERT function that freezes execution and be using a recent version of FreeRTOS that checks for this.

eduardo1966 wrote on Wednesday, April 10, 2019:

Ahhh stacks… :slight_smile:
The stacks were too small…
Nevertheless a question needs to be answered, how can one get runtime stack usage information?

There is this post:
https://www.freertos.org/FreeRTOS_Support_Forum_Archive/November_2015/freertos_Measuring_Stack_Usage_b5706bb4j.html
But it doesn’t answer the question programmatically, only for a debugger session.

Christmas is not far so… It would be nice to have a function to return the stack current usage and maximum usage to be collected in a monitor task running periodically. There is a pattern written to the stack before starting, 0xA5. It is not 100% (an 0xA5 could have been pushed to the stack…) but it would help. At the end one wants to find if the stack is been used by 10%, 50% or 90%.

eduardo1966 wrote on Wednesday, April 10, 2019:

Christmas seems to be here already:
uxTaskGetStackHighWaterMark() is the function.
https://www.freertos.org/uxTaskGetStackHighWaterMark.html

richarddamon wrote on Wednesday, April 10, 2019:

Also see https://www.freertos.org/uxTaskGetSystemState.html