Arm Community
Site
Search
User
Site
Search
User
Groups
Arm Research
DesignStart
Education Hub
Graphics and Gaming
High Performance Computing
Innovation
Multimedia
Open Source Software and Platforms
Physical
Processors
Security
System
Software Tools
TrustZone for Armv8-M
中文社区
Blog
Announcements
Artificial Intelligence
Automotive
Healthcare
HPC
Infrastructure
Innovation
Internet of Things
Machine Learning
Mobile
Smart Homes
Wearables
Forums
All developer forums
IP Product forums
Tool & Software forums
Support
Open a support case
Documentation
Downloads
Training
Arm Approved program
Arm Design Reviews
Community Help
More
Cancel
Developer Community
Tools and Software
Software Tools
Jump...
Cancel
Software Tools
Arm Development Studio forum
Debugging a Usage Fault for an unaligned memory access
Tools, Software and IDEs blog
Forums
Videos & Files
Help
Jump...
Cancel
New
Replies
2 replies
Subscribers
126 subscribers
Views
2748 views
Users
0 members are here
Related
Debugging a Usage Fault for an unaligned memory access
Offline
gamze mazlum
over 7 years ago
Note: This was originally posted on 4th July 2013 at http://forums.arm.com
Hi,
I am experiencing a hard fault in Cortex M3.
After reading some topics in forums and blogs, I added the following code for analyze the problem.
void hard_fault_handler_c(unsigned int * hardfault_args)
{
unsigned int stacked_r0;
unsigned int stacked_r1;
unsigned int stacked_r2;
unsigned int stacked_r3;
unsigned int stacked_r12;
unsigned int stacked_lr;
unsigned int stacked_pc;
unsigned int stacked_psr;
stacked_r0 = ((unsigned long) hardfault_args[0]);
stacked_r1 = ((unsigned long) hardfault_args[1]);
stacked_r2 = ((unsigned long) hardfault_args[2]);
stacked_r3 = ((unsigned long) hardfault_args[3]);
stacked_r12 = ((unsigned long) hardfault_args[4]);
stacked_lr = ((unsigned long) hardfault_args[5]);
stacked_pc = ((unsigned long) hardfault_args[6]);
stacked_psr = ((unsigned long) hardfault_args[7]);
printf ("[Hard fault handler]\n");
printf ("R0 = %x\n", stacked_r0);
printf ("R1 = %x\n", stacked_r1);
printf ("R2 = %x\n", stacked_r2);
printf ("R3 = %x\n", stacked_r3);
printf ("R12 = %x\n", stacked_r12);
printf ("LR = %x\n", stacked_lr);
printf ("PC = %x\n", stacked_pc);
printf ("PSR = %x\n", stacked_psr);
printf ("CFSR = %x\n", (*((volatile unsigned long *)(0xE000ED28))));
printf ("HFSR = %x\n", (*((volatile unsigned long *)(0xE000ED2C))));
while(1);
}
__asm void Hard_Fault_Handler(void)
{
TST LR, #4
ITE EQ
MRSEQ R0, MSP
MRSNE R0, PSP
B hard_fault_handler_c
}
However, I am still not able to figure out which is causing the hard fault.
I need a lot of help, I will be very grateful. I can provide more information if needed.
In attachments, there are register's and fault report's print screens.
Thank you
Regards,
Offline
gamze mazlum
over 7 years ago
Note: This was originally posted on 4th July 2013 at
http://forums.arm.com
In addition, I'm using Keil.
Cancel
Up
0
Down
View discussion
Cancel
Offline
Simon Craske
over 7 years ago
Note: This was originally posted on 4th July 2013 at
http://forums.arm.com
Pelefek,
Try opening a memory window and looking at the 32-bit word at location 0x20007A00 (The address shown by PSP + 24). This value should be the address of the instruction that caused the fault (or the one immediately after it).
hth
s.
Cancel
Up
0
Down
View discussion
Cancel
More questions in this forum
By title
By date
By reply count
By view count
By most asked
By votes
By quality
Descending
Ascending
All recent questions
Unread questions
Questions you've participated in
Questions you've asked
Unanswered questions
Answered questions
Questions with suggested answers
Questions with no replies
Answered
How to view SFRs in DS during debugging?
+1
2878
views
1
reply
Latest
3 months ago
by
Ronan Synnott
Answered
Dual-core debugging in DS
0
5733
views
2
replies
Latest
3 months ago
by
Ivan Savvateev
Answered
DS52020.0 connection to Musca-A/B boards not working
+1
Arm Development Studio
Musca-A
7529
views
4
replies
Latest
3 months ago
by
Daniel Oliveira
Answered
Positioning a function in a Position Independent Executable for ARMV8
+1
8284
views
3
replies
Latest
4 months ago
by
Stephen Theobald
Answered
Link a pure binary file to image with scatter file
0
8248
views
3
replies
Latest
4 months ago
by
Ronan Synnott
<
>
View all questions in Arm Development Studio forum