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??
Do you really have to?
Most recursive algorithms can be restructured into an iterative approach...
is there any way like using inline assembly in C operating on stack pointer??
I am using ARM7 LPC2148
What do you hope to achieve by that?
I just want to avoid stack overflow while working with recursive functions........
in LPC2148 there is inst in assembly with which we can set stack ptr mov sp, #data
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.
So you intend to fool the compiler by manipulating the stack pointer yourself? What do you think do you have a compiler for, then? To write correct machine code that complies with the computation model/standards you use - of course! In other words: Don't do it.
View all questions in Keil forum