XMC 4500 EXC_RETURN value issue

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Figured this issue out and thought I'd post here if anyone else runs into the problem. On Step AB boards and below, each interrupt is wrapped in an veneer function. This causes an interrupt to invoke the veneer and then the veneer invokes your function. In most cases, this is transparent, but if you're attempting to read EXC_RETURN values from lr (e.g., determine PSP or MSP), you're going to get strange behavior.

The work around that I used is below....

#if UC_STEP <= STEP_AB

ldmia sp, {r2, r3} /* r2 = unused, r3 = EXC_RETURN */
tst r3, #0x4
ITE NE
mrsne r1, psp
bxeq lr

#else

tst lr, #0x4
ITE NE
mrsne r1, psp
bxeq lr

#endif
0 Likes
0 Replies