-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lock
probably needs some kind of barrier
#3
Comments
Done. We have added a compiler barrier. |
japaric
pushed a commit
that referenced
this issue
Sep 10, 2021
andrewgazelka
pushed a commit
to andrewgazelka/cortex-m-rtic
that referenced
this issue
Nov 3, 2021
drop compiler-builtins dependency, add documentation
andrewgazelka
pushed a commit
to andrewgazelka/cortex-m-rtic
that referenced
this issue
Nov 3, 2021
When I currently request GDB to dump a hard fault stack, I see something like this: (gdb) bt #0 UserHardFault_ (ef=0x10001fb8) at /depots/cortex-m-rt/src/lib.rs:537 rtic-rs#1 0x08003fe6 in HardFault () Backtrace stopped: previous frame identical to this frame (corrupt stack?) GDB can't unwind past HardFault since the current implementation of this function overwrites the Link Register (LR) value. This change pushes LR and R0 (to maintain 8-byte stack alignment) to the stack before transferring execution to UserHardFault(). After this change, I see a callstack like this from GDB: (gdb) bt #0 UserHardFault_ (ef=0x10001fb0) at /depots/cortex-m-rt/src/lib.rs:537 rtic-rs#1 0x08003fe8 in HardFault () rtic-rs#2 <signal handler called> rtic-rs#3 0x08002820 in core::ptr::read_volatile (src=0x48001800) at libcore/ptr.rs:472 rtic-rs#4 0x080001a2 in main () at src/07-registers/src/main.rs:14 Notes: * This code uses 8 more stack bytes. * Increases the size of the HardFault handler by 2 narrow instructions or 4 bytes. This could be decreased to 2 bytes by removing the pop since UserHardFault() doesn't currently return but it just looks too odd for me to do as an initial attempt.
andrewgazelka
pushed a commit
to andrewgazelka/cortex-m-rtic
that referenced
this issue
Nov 3, 2021
131: Allow GDB to unwind HardFault callstacks r=therealprof a=adamgreen When I currently request GDB to dump a hard fault stack, I see something like this: ``` (gdb) bt #0 UserHardFault_ (ef=0x10001fb8) at /depots/cortex-m-rt/src/lib.rs:537 rtic-rs#1 0x08003fe6 in HardFault () Backtrace stopped: previous frame identical to this frame (corrupt stack?) ``` GDB can't unwind past HardFault since the current implementation of this function overwrites the Link Register (LR) value. This change pushes LR and R0 (to maintain 8-byte stack alignment) to the stack before transferring execution to UserHardFault(). After this change, I see a callstack like this from GDB: ``` (gdb) bt #0 UserHardFault_ (ef=0x10001fb0) at /depots/cortex-m-rt/src/lib.rs:537 rtic-rs#1 0x08003fe8 in HardFault () rtic-rs#2 <signal handler called> rtic-rs#3 0x08002820 in core::ptr::read_volatile (src=0x48001800) at libcore/ptr.rs:472 rtic-rs#4 0x080001a2 in main () at src/07-registers/src/main.rs:14 ``` Notes: * This code uses 8 more stack bytes. * Increases the size of the HardFault handler by 2 narrow instructions or 4 bytes. This could be decreased to 2 bytes by removing the pop since UserHardFault() doesn't currently return but it just looks too odd for me to do as an initial attempt. Co-authored-by: Adam Green <adamgreen@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Either a compiler, memory or an instruction one or a mixture of them. To prevent the closure code from being executed outside the modified BASEPRI context. This should become more apparent when dealing with non-volatile resources (i.e. not peripherals)
The text was updated successfully, but these errors were encountered: