Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

make the "linker-script" Cargo feature opt-out #4

Merged
merged 2 commits into from
Apr 12, 2017
Merged

make the "linker-script" Cargo feature opt-out #4

merged 2 commits into from
Apr 12, 2017

Conversation

japaric
Copy link
Member

@japaric japaric commented Apr 12, 2017

No description provided.

@japaric japaric merged commit b6674f7 into master Apr 12, 2017
@japaric japaric deleted the dev branch April 12, 2017 05:27
bors bot added a commit that referenced this pull request Oct 23, 2018
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
#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
#1  0x08003fe8 in HardFault ()
#2  <signal handler called>
#3  0x08002820 in core::ptr::read_volatile (src=0x48001800) at libcore/ptr.rs:472
#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>
rukai pushed a commit to rukai/cortex-m-rt that referenced this pull request May 1, 2021
fix the heap size calculation
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant