hi
i am getting Hardfault when finit(NULL) function is executed in LPC43xx Coretex M4 Flash file system without RTOS. I am using SD card driver as SDIO43xx.c from standard drivers.
why it goes to Hardfault?. i am using FS_CM3.lib to the project. please provide example project if you have already done.
Thanks and regards Chakravarthi
infocenter.arm.com/.../index.jsp
http://www.keil.com/appnotes/files/apnt209.pdf
www.freertos.org/Debugging-Hard-Faults-On-Cortex-M-Microcontrollers.html
blog.feabhas.com/.../
community.nxp.com/.../306244
etc, etc, ...
Check you have a sufficiently large stack allocation in startup_xxx.s, this can frequently cause faults. Check heap if code uses malloc()
Use a hard fault handler like those from Joseph Yiu to be able to quickly pinpoint what instructions and registers are faulting. Look for invalid memory access, wild pointers, executing bad code, etc.
www.elsevier.com/.../978-0-12-408082-9
My spin on the Hard Fault Handler in Keil
community.st.com/.../8095
i am getting Forced Hard fault whenever finit(null) function is executed. i have gone through different posts that they executed the same function successfully but i am not getting hard fault. so,if you have done same code successfully then give me with project configuration options and correct keil memory settings for RAM and ROM
Sorry, not using your part/configuration. Try debugging it, the Hard Fault is a gross failure, the processor provides specific details about what/where it fails. Understanding how to decipher that will be a good learning experience.
If the CALL causes the fault make sure you aren't linking in 32-bit code. Check if the NULL pointer is an issue, or if some variable or structure contains uninitialized junk.
It is however FAILING on your build, so you're best place to actually debug the reason in your specific circumstances. Try stepping into the assembler code to refine the point of failure better, or review the processor state from the Hard Fault Handler.
hi sir,
i have used the hard fault handler as you given above links. i have got the memory location of instruction[LDR R0,[R5,#0x04] . but this instruction is written in Library file provided by Keil MDK [FS_CM3.lib]. i am unable to study the code part of library. i am getting USAGE FAULT [INVSTATE bit is set to 1] . after getting memory location of above instrction [LDR] it is located in function MCI_init. so, is there anyone who faced same problem.??
>>is there anyone who faced same problem??
Developers frequently have similar problems, the chances that someone has an identical set of issues to you would tend to be much smaller. You will need to debug using the resources you have, working backward from the point of failure.
The salient issue here would be the content of R5 and where that came from, which is likely a parameter or structure passed in. This could be an uninitialized structure, heap or stack, or the incorrect target cpu or memory sizes passed to the linker.
i am using FS_CM3.lib file in my project.so,i dont't have source code to know what value is loaded into R5 register. i have used memorymap file to know the function address at which Hardfault is occuring.so i hope you understand and give me any useful information to identify the bug.
Perhaps your code consists of more than finit(NULL) ? Or needs too.
The fact you don't have source isn't immediately relevant, what is reported in R5 would be of immediate interest, as a) it might tell you why it faulted, and b) might provide some insight into where it came from. For example if it were like 0x64636241 it could be ASCII in a buffer, of 0xCDCDCDCD some space purposefully initialize to trap bad pointers.
You are the one sitting in front of your computer with the debugger running, you are the one capable of looking at the disassembly, and content of memory and registers. You are the only one with the code and board in this condition, and there is inadequate project specifics for the issue to be replicated.
Hello Chakravarthi,
From the "finit(NULL)", I guess you are trying to use the earlier version of the filesystem, RL-FlashFS.
I recommend starting with an RTOS and the newer File System Component. There is one example for an SD Card and MCB4300 in the Pack Installer: http://www.keil.com/support/man/docs/uv4/uv4_ca_packinstaller.htm
The example is titled "File System Demo", and these newer examples are maintained. In MDKv5.22 or later, you also have access to the Event Recorder to get a lot more debug information from the middleware libraries.
Thanks, Zack
hi Havens,
i have installed the pack from Pack installer and executed the project (C:\Keil_v5\ARM\Pack\Keil\LPC4300_DFP\2.7.0\Boards\Keil\MCB4300\Middleware\FileSystem\File_Demo) but it is giving Media Error without SD Card and With SD card. Actually ,fmount function should return No Media without SD card but it is giving Media Error for all types of errors and why i am getting Media Error even though i have configured the SD card properly??.
is there any fault with Commands defined the RTOS flash file system. can you help me at function fmount("M0:") why it is giving FSmedia Error ?
Now,i am using Keil MDK Plus v5.22 with Licence.
So you're now using a different File System Component, and a different MDK version - and getting a different result.
Sounds like it's time for a new thread - with appropriately adjusted title.
You can always put links between the two threads for reference ...