In the ARM Cortex M4, If the PSP stack pointer is configured, what address space does it point to? Is it the same address space as the MSP (main stack pointer)? Or do we create a new and separate stack for it? And how do we configure the TOP of stack for the PSP pointer?
Hello,
you can use
MSR PSP,Rn
to set PSP from the register Rn and
MRS Rn,PSP
to get PSP value into the register Rn.
MSR/MRS are also applicable to MSP.
Best regards,
Yasuhiko Koumoto.
Thank you yasuhikokoumoto.
As a follow up questions:
How do you set the size of your PSP stack? And for that matter, how would you set the size of the MSP stack? (or does the pointer decrements until it gets to its 8 byte alignment address?
Can and should the PSP stack overlap the MSP stacK?