How to Detect the Stack Overflow in the STM32F207Vgt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-12-01 12:08 AM
I am using Stm32f207....i am Suspecting there is stack overflow happening in my code.how to Check it actually?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-12-01 1:30 AM
Although not entirely reliable, the easiest method is to fill the memory with a easily recognizable pattern, run the program and observe in the debugger how far the stack has reached.
A more rigorous method is a static analysis, but that needs to have support from the toolchain, and also it gets complicated as soon as indirect calls (known as function pointers) are called, and/or stack usage changes dynamically e.g when using alloca().
RTOS pose a whole new group of problems in this regard.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-12-01 1:32 AM
is there any Memory Mapping we can use t check it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-12-01 3:16 AM
I don't know what do you mean by Memory Mapping.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-12-01 4:12 AM
You can have your own code check how much of the pattern remains in memory.
You could put the stack at the bottom of memory so it hard faults as you drive it through the floor.
You might be able to use the MPU settings to Mem Fault in a similar manner. Review the chip TRM.
Up vote any posts that you find helpful, it shows what's working..
