-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[libcpu][cortex-m4]Added HardFault_Handler to save floating point registers #10618
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -237,14 +237,28 @@ HardFault_Handler: | |||||
| MRS r0, psp ; get fault context from thread. | ||||||
| _get_sp_done | ||||||
|
|
||||||
| #if defined ( __ARMVFP__ ) | ||||||
| TST lr, #0x10 ; if(!EXC_RETURN[4]) | ||||||
| BNE skip_push_fpu | ||||||
| VSTMDB r0!, {d8 - d15} ; push FPU register s16~s31 | ||||||
|
||||||
| VSTMDB r0!, {d8 - d15} ; push FPU register s16~s31 | |
| VSTMDB r0!, {d8 - d15} ; push FPU registers d8-d15 (corresponds to s16~s31 in single precision mode) |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -236,10 +236,21 @@ HardFault_Handler PROC | |||||||||
| MRSEQ r0, msp ; [2]=0 ==> Z=1, get fault context from handler. | ||||||||||
| MRSNE r0, psp ; [2]=1 ==> Z=0, get fault context from thread. | ||||||||||
|
|
||||||||||
| IF {FPU} != "SoftVFP" | ||||||||||
| TST lr, #0x10 ; if(!EXC_RETURN[4]) | ||||||||||
| VSTMFDEQ r0!, {d8 - d15} ; push FPU register s16~s31 | ||||||||||
|
||||||||||
| VSTMFDEQ r0!, {d8 - d15} ; push FPU register s16~s31 | |
| VSTMFDEQ r0!, {d8 - d15} ; push FPU register d8~d15 (corresponds to s16~s31 in single precision mode) |
Copilot
AI
Aug 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VSTMFDEQ instruction uses full descending stack mode, but this is inconsistent with the STMFD instructions used elsewhere. Consider using VSTMDBEQ for consistency with decrement before operation mode.
| VSTMFDEQ r0!, {d8 - d15} ; push FPU register s16~s31 | |
| VSTMDBEQ r0!, {d8 - d15} ; push FPU register s16~s31 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment incorrectly states 's16~s31' but the instruction saves double precision registers d8-d15. The comment should be corrected to 'd8-d15' or explain that these correspond to s16-s31 in single precision mode.