aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/tests/compile-fail/interrupt-not-reexported.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge.aparicio@ferrous-systems.com> 2020-09-02 15:52:17 +0200
committerGravatar Jorge Aparicio <jorge.aparicio@ferrous-systems.com> 2020-09-02 16:43:49 +0200
commit965a6d22eae9cb2c83fc7da06be09dc769b791b5 (patch)
tree0c0991e5dc143b6c9ae625e57e684d66f8a9c9b8 /cortex-m-rt/tests/compile-fail/interrupt-not-reexported.rs
parentd53d096ee7944740ef1264e81886315402dcbea0 (diff)
downloadcortex-m-965a6d22eae9cb2c83fc7da06be09dc769b791b5.tar.gz
cortex-m-965a6d22eae9cb2c83fc7da06be09dc769b791b5.tar.zst
cortex-m-965a6d22eae9cb2c83fc7da06be09dc769b791b5.zip
[ARMv6-M] initialize the LR register
the ARMv6-M Architecture Reference Manual (ARM DDI 0419D) indicates in section B1.5.5 "Reset behavior" that the LR (Link Register) starts in an unknown state when the Reset handler is taken and that its "Value must be initialised by software" So this PR does that: it initializes the LR register to 0xFFFF_FFFF (-1) first thing in the Reset handler (only for v6). The manual doesn't say which value to use so I decided to use the value used by the ARMv7-M (v7 sets LR to 0xFFFF_FFFF before invoking the Reset handler; see its Architecture Manual for details). The values of LR (these are pushed onto the stack in function preludes) are used to unwind the stack (e.g. GDB's `backtrace` or a future `cortex_m_panic_unwind` handler). Having the initial stack frame use a known value on all Cortex-M variants makes it easier to implement `panic_unwind` and avoids virtual unwinders like GDB `backtrace` trying to unwind beyond the `Reset` handler Note that this implementation uses a trampoline that runs before `Reset` to set LR on v6. This is required because the prelude of the `Reset` routine will push LR onto the stack; we want that LR value to be -1. Calling `register::lr::write` from `Reset` would perform the write after LR has been pushed onto the stack and that's too late
Diffstat (limited to 'cortex-m-rt/tests/compile-fail/interrupt-not-reexported.rs')
0 files changed, 0 insertions, 0 deletions