2017-06-16 06:24 AM
Hi
when an interrupt kicks in, th current context (core registers , pc and so on are saved). Where in a cube generated project, would I find the context save and restore part? Which registers need to be saved? How many cycles does it need?
Solved! Go to Solution.
2017-06-16 09:43 AM
The core saves the registers it needs and this matches the ABI for calling C functions, so not special handling is required to use C functions as interrupt handlers. The value of LR passed to the function, is a magic value which upon return tells the core to recover the original context.
Nominally PC, XPSR, R0, R1, R2, R3, R12 and LR
2017-06-16 07:39 AM
The core does this, review documentation for the Cortex-Mx part in question. Either the ARM TRM or books by Joseph Yiu
2017-06-16 09:43 AM
The core saves the registers it needs and this matches the ABI for calling C functions, so not special handling is required to use C functions as interrupt handlers. The value of LR passed to the function, is a magic value which upon return tells the core to recover the original context.
Nominally PC, XPSR, R0, R1, R2, R3, R12 and LR