Code: Select all
An interrupt occurring during the data-phase of a single word load to the stack pointer
(SP/R13) can cause an erroneous behavior of the device. In addition, returning from the
interrupt results in the load instruction being executed an additional time.
For all the instructions performing an update of the base register, the base register is
erroneously updated on each execution, resulting in the stack pointer being loaded from an
incorrect memory location.
The instructions affected by this limitation are the following:
• LDR SP, [Rn],#imm
• LDR SP, [Rn,#imm]!
• LDR SP, [Rn,#imm]
• LDR SP, [Rn]
• LDR SP, [Rn,Rm]
This is exactly what _port_switch does:
Code: Select all
ldr sp, [r0, #CONTEXT_OFFSET]
There is a workaround:
Code: Select all
Replace LDR SP, [R0] by
LDR R2,[R0]
MOV SP,R2Is this a problem or conditions mentioned in errata cannot be met in ChibiOS?