C166: How to check a User-Stack overflow
Information in this knowledgebase article applies to:
Are there ways to determine a user stack overflow during runtime? Why does the compiler/linker not warn me when the memory space needed for my local variables is bigger than the user stack area defined in the startup file.
Unlike for the system stack, C166 based microcontrollers do not have hardware protection mechanisms for the user stack. The user stack is a software implemented stack using R0 as a stack pointer.
During development, you can check the required user stack stack
size as described in the C166 manual in chapter User
Stack Size with a debugger (e.g. ULINK2).
The C166 Compiler cannot calculate the stack usage of your application program because it does not detect the actual program flow and can not know about the interrupt capabilities of your target system. The stack size is usually defined in the startup file but in applications with a real-time OS (e.g. RTX166-tiny), the user stack is defined per task. Therfore, the C166 Compiler does not even know the memory area and size which is reserved for the user stack.
Last Reviewed: Monday, November 26, 2012
of your data.