rust-embedded / rust-embedded/cortex-m
Zero frame pointer register in Reset
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1k
- Forks
- 202
- Avg merge
- 6d 2h
- Merged PRs (30d)
- 2
Description
Hi, I'm new to this low level stuff so sorry if I get something wrong.
I've been trying to work out how to do a frame pointer stack walk using r7 for some profiling but I've been having trouble working out when to stop the walk. It works fine until I get to <main>'s frame record, at which point the frame pointer points into the boot RAM which I don't seem to be able to read. Would it be reasonable to zero the frame pointer r7 in <Reset>?
Section 6.2.1.4 of the AAPCS32 states:
The end of the frame record chain is indicated by the address zero in the address for the previous frame.
so I think making this change would conform with that.
Environment
I've been using a Pico 2 with an embassy application to test.
The gdb commands I've been using for walking the stack are:
info registers r7
p/x *((addr + 0*4) as *u32)
and for getting return addresses:
info registers lr
p/x *((addr + 1*4) as *u32)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names but no repository file; locate that reset entry point and inspect how r7 is initialized before main. Check the AAPCS32 frame-record requirement against the existing startup path, then verify that a stack walk terminates at zero without reading boot RAM.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100