Hello, I use RTX166 on my system (20 tasks). How can i check Task Stack busy level to prevent a possible stack overflow? Operating system manual say: "Register R0 is stack pointer" I will check Run-time R0 value to find max value. but I think is much better to use a Source Code Analyzer like: http://www.absint.com/stackanalyzer but it doesn't work with Keil. Can you suggest me a stack analyzer for my system? Best Regards
Mike, your post is dangerous. It should have been: This will give you an idea of maximum stack usage but usually a rare situation will use more. I have see a stack overflow problem in a product that showed up on average once every 3 months. Erik
I should probably have used a disclaimer like "Use my advice at your own risk" :-) OK, I really meant 'an indication of stack usage'. I'll try to be more careful next time. But to be fair, maybe if the developers of the product you mentioned used the techneque I suggested then there wouldn't be any stack overflows there at all? Cheers! - mike
Mike, your statement was totally correct, it just happens that I have seen, more than once, this technique applied to establish "max needed stack size" without ANY calculation of the worst case. In many instances, you can run the product for days without encountering worst case. Worst case (which happens "once a month") is: int a (the stack hungriest of those at priority 3) interrupting int b (the stack hungriest of those at priority 2) that interrupted int c (the stack hungriest of those at priority 1) that interrupted int d (the stack hungriest of those at priority 0) This, I believe, has been the most common of the things that "failed once a month" I have been asked to look at. When I see some post that - in any way - can be misapplied and cause a problem I have seen, I have this annoying habit of emphasizing. Erik