ARMv8-M MPS2_AEMv8M FVP, try to manually set XPSR in Privileged Secure state, the exception number cannot be set successfully.

Hi Community,

For test purpose, I try to manually set the XPSR register with exception number 3, in this way

asm(
"ldr r0, =0x21000003 \t\n"
"msr xpsr, r0 \t\n"
);

__builtin_arm_dsb(0xF);
__builtin_arm_isb(0xF);

During the setting, the core is in privileged secure state. After execution, XPSR = 0x21000000, so the bit[8:0] is not successfully set. But if I set XPSR from the debugger, the exception number can be set, any idea? Thanks.

More questions in this forum