Hi all, I am cracking my head to see why Keil's uVision2 has this problem? Calling a subroutine callee on the first time, returned to the original Caller with no problem. Calling it 2nd time and follows, caused a critical fault of NOT returning to original caller's address SP_max: 032 I have a mixture of C & Assembly coding. where Timer interrupts happen under C and most logical functions are done under .A51s. What could be the cause of calling a subroutine which doesn't return to the original caller's address? Please advise. Head scratching, James
"What could be the cause of calling a subroutine which doesn't return to the original caller's address?" Also check those assembly functions, ensuring that every PUSH has a matching POP.
I said "every PUSH has a matching POP" ...and that there is balance in all operations that are equivalent to PUSH/POP from the perspective of adjusting the stack pointer.
Another possibility is that your stack is overflowing, particularly if you are using a significant amount of idata as variable storage. You could try filling the top few bytes of the stack with some known value right at the beginning of your program, check to see if these have been overwritten when your function fails to return. Stefan
View all questions in Keil forum