Problem:- Calling a subroutine that did NOT return to original caller

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

Parents
  • Either you don't execute the RET instruction, or the return value has been corrupted. The return addresses are stored on the (real, hardware, internal) stack. Are you sure they don't get trampled?

    Where does your program go on the RET, if not to the proper spot?

    Does your program actually execute this procedure, or is it already off doing something odd (running wild, stuck in an interrupt handler, etc)?

    Is your program memory space writable? Could the code itself actually get trampled?

Reply
  • Either you don't execute the RET instruction, or the return value has been corrupted. The return addresses are stored on the (real, hardware, internal) stack. Are you sure they don't get trampled?

    Where does your program go on the RET, if not to the proper spot?

    Does your program actually execute this procedure, or is it already off doing something odd (running wild, stuck in an interrupt handler, etc)?

    Is your program memory space writable? Could the code itself actually get trampled?

Children
More questions in this forum