This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

StackOverflow Hook in Keil RTX

Hello,

I m using Keil RTX on STM32F411. My IDE is Keil too.

I have a task to maintain and upgrade previous code where RTX is being used.

I need to debug a Stack Overflow (seen in System and Thread Viewer) and for that I need to identify the first overflow event to dig in that thread.

We can learn about hooks in freeRTOS here: https://www.youtube.com/watch?v=vBoP4Q6rf5g&list=PLnMKNibPkDnFeFV4eBfDQ9e5IrGL_dx1Q&index=20

The idea of having a callback when a Stack Overflow event happens is great.

Can some one give me a Tip, how to implement Hook in RTX or any approach to deal with Stack Overflow in RTX?

Another question is, I see a lot of Stack Overflows in " System and Thread Viewer" but would expect my System to fail totally, but instead the majority (not all) of Threads keep running.

I mean, this code shouldn't be running, one stack overflow would be enough to ruin the application. Is " System and Thread Viewer" info reliable?

br

 

Parents
  • So, I m using RTX on STMF411, compiler 5.06 and MDK5.24 from keil.

    I have Stack Overflow Checking Enabled

    I have Stack usage Watermark Enabled

    When I say the debug info via "System and Thread Viewer" is not realible, I mean that when I have my threads stack set to 400Bytes, I have a max stack usage of ~90% and some overflows, when I change the stack to 1024Bytes, I see my max stack usage again arround  90%, so I dont understand what is going on. That's why I say "System and Thread Viewer" is not realible.

    If you can shed some ligth,  it would be great.

Reply
  • So, I m using RTX on STMF411, compiler 5.06 and MDK5.24 from keil.

    I have Stack Overflow Checking Enabled

    I have Stack usage Watermark Enabled

    When I say the debug info via "System and Thread Viewer" is not realible, I mean that when I have my threads stack set to 400Bytes, I have a max stack usage of ~90% and some overflows, when I change the stack to 1024Bytes, I see my max stack usage again arround  90%, so I dont understand what is going on. That's why I say "System and Thread Viewer" is not realible.

    If you can shed some ligth,  it would be great.

Children