RT-Thread / RT-Thread/rt-thread

[Cortex-M0] stack pointer is wrong if hardfault happens in ISR

Open
#3,584 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

如果在中断里发生了hardfault,PSP记录的并不是中断栈的位置,会导致打印的hardfault信息错误
https://github.com/RT-Thread/rt-thread/blob/90fb832bf2cd518a8ac408f52fcc941ae0ac3c0b/libcpu/arm/cortex-m0/context_rvds.S#L207

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at libcpu/arm/cortex-m0/context_rvds.S around line 207, where the issue reports that PSP is recorded incorrectly when a hardfault occurs in an ISR. Reproduce or trace an ISR hardfault and compare the recorded stack pointer with the interrupt stack location. Done means the printed hardfault information uses the correct stack location for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.