HardFault during erasing Flash in debug mode
Started by 3 years ago●4 replies●latest reply 3 years ago●361 viewsI've written a custom bootloader using C to run on ARM cortex_M4 but I had a HardFault exception when using the debug mode. This exception appears just in debug mode, when I use release mode everithing works.
I've checked that the Flash/Erase code is loaded to RAM before the execution of erase command.
Thanks in advance.
I think you need to tell us a lot more before a good answer is possible.
What processor are you using, with which tools. Can you get a trace to see what caused the hard fault ?
You need to explain exactly how the processor is set up in your code, (ie is it running from RAM, are interrupts enabled etc etc.)
MK
I completely agree with you.
It would be nice if every poster, independent of the aim of the question, ever provided some basic information about what he ( she ) is using, such as the core chip, the development tools with their versions and a clear description of the sequence of events that lead to the fail.
This would accelerate problem solving.
Cheers!
Most likely you still have some access to ROM, perhaps your code reads some constants in ROM (e.g., strings, etc.) Also, there might be still calls (perhaps indirect) to code in ROM.
If you’re having trouble identifying the kind of hard fault, you might take a look at this article. https://interrupt.memfault.com/blog/cortex-m-fault-debug