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

How to know stack overflow

I have a question.
How to know maximum stack of my program and stack overflow?
beacause my program can lock when power have unstatable.

Parents
  • Hi,
    The stack behaviour 8051 based core is little bit different from others. Here stack is used for:

    1. Storing return address from function as well as ISR

    2. Saving and Restoring Registers used in interrupt, if no register bank is defined for storing default register bank

    3. Saving and restoring intermideate results

    All local and global variables as well as function arguments will be stored on seperate memory (RAM). Stack will be allocated from idata which is 255 byte long, so there is a very little chance to have overflow in stack. But one can find out manually the stack usage by filling idata with 0xFF and observe the max. usage. There is not way to detect overflow runtime.

    -SP

Reply
  • Hi,
    The stack behaviour 8051 based core is little bit different from others. Here stack is used for:

    1. Storing return address from function as well as ISR

    2. Saving and Restoring Registers used in interrupt, if no register bank is defined for storing default register bank

    3. Saving and restoring intermideate results

    All local and global variables as well as function arguments will be stored on seperate memory (RAM). Stack will be allocated from idata which is 255 byte long, so there is a very little chance to have overflow in stack. But one can find out manually the stack usage by filling idata with 0xFF and observe the max. usage. There is not way to detect overflow runtime.

    -SP

Children