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

A question about assigning SP

Hello,
I am trying to set the value of SP as part of my small RTOS. However, I have a little problem:
once I do this

__asm
{
MOV SP, stkptr
}

the address stored in stkptr (its type is unsigned int* ) is converted. If the address of strptr is 0xE2D4, SP get 0xF2D4.
My stack's top is at 0xFC00. I also disable the check for stack underflow/overflow (registers STKUN, STKOV in the A66 file).
What is happening here? Are the DPP registers involved? Can I use memory mapping facilities to solve this issue?
Kind regards,
Tamir Michael

Parents
  • The problem is not that you cannot do it in C. The problem is that hell will quite inevitably break loose if you do. You need considerably tighter control over the CPU registers than C can grant you, for this kind of work. SP (and several other registers) has to be considered as being owned by the C compiler, while you're in a C function.

Reply
  • The problem is not that you cannot do it in C. The problem is that hell will quite inevitably break loose if you do. You need considerably tighter control over the CPU registers than C can grant you, for this kind of work. SP (and several other registers) has to be considered as being owned by the C compiler, while you're in a C function.

Children
No data