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 overcome stack overflow???

hello
I am using ARM7 LPC2148.
in the program I have to use recursive function. so there are lots of chances of stack overflow. how to avoid this??

Parents
  • is there any way like using inline assembly in C operating on stack pointer??

    No. You can use embedded assembly for that purpose, with serious risks of data corruption unless you know what you are doing:

    __asm void not_a_good_idea_rtos_like_operations(void)
    {
    // instructions involving SP
    }
    

    But what do you hope to achieve by this, actually?
    Better to drop recursion all together, probably.

Reply
  • is there any way like using inline assembly in C operating on stack pointer??

    No. You can use embedded assembly for that purpose, with serious risks of data corruption unless you know what you are doing:

    __asm void not_a_good_idea_rtos_like_operations(void)
    {
    // instructions involving SP
    }
    

    But what do you hope to achieve by this, actually?
    Better to drop recursion all together, probably.

Children
No data