I am using TM4C development board and Uvision 4 IDE. During the context switch routine i need to store PSP value. When i use PSP symbol in the assembly code i have an error "error: A1647E: Bad register name symbol, expected Integer register" but this is not the case when i use SP only (without define explicitly MSP or PSP).
I try to access the CONTROL register and write 2 to switch the stack pointer to PSP (and then i SP which i can use the assembly code will be the PSP) but the control register is not get changed. Could any one help?
Here is my code.
Switch_Context ; 1) Saves R0-R3,R12,LR,PC,PSR CPSID I ; 2) Prevent interrupt during switch PUSH {R4-R11} ; 3) Save remaining regs r4-11 LDR R0, =RunPt ; 4) R0=pointer to RunPt, old thread LDR R1, [R0] ; R1 = RunPt MOV R2, #2 ; MSR CONTROL, R2 STR SP, [R1] ; 5) Save SP into TCB MOV R2, #0 ; MSR CONTROL, R2 . . . BX LR ; 10) restore R0-R3,R12,LR,PC,PSR