2021-03-19 04:33 AM
Dear comrades!
I have encountered a problem while debuging my STM32H742VG project.
I am falling into HardFault just after system init and do not know any reason why it is happening.
I am starting my MCU with HSI clock and debugign with a STLink v2 debugger.
Could anyone help me with solving the problem please?
2021-03-19 04:45 AM
Use a Handler that outputs actionable data, and with an understanding of the registers/state inspect the offending code in a disassembly.
Super early check stack alignment and RAM used.
Turn off "run to main" and walk in the code.
2021-03-19 05:00 AM
Thank you - I will try this.
But first I would like to ask you if there is an easier way 'cause I have never tried to solve problems via disassembly.
Maybe a blank-default way to start th MCU? I just think that there is something very simple I am forgeting to turn on at the start...
2021-03-19 05:10 AM
You could walk your code and look for errant pointer. Check malloc/new don't fail, returning NUL pointers.
Check alignment issues.
Check the FPU is enabled.
Check it is linking the right libraries.
2021-03-22 03:26 AM
Well I have looked through the dissassembly and it seems that nothing is written to the flash.
Could it be due to StLink V2 do not support STM32H7 cores?
2021-03-22 05:49 AM
The code does seem oddly placed in memory. It is at the 1MB deep point, and the vector table is some place else.
You'd probably want to review the memory model employed in the project, the scatter file (.SCT) and the map file (.MAP)
Make sure the check box item to download before debug is checked.
If using a debug script, make sure that LOADs the file or you flash it manually prior to debugging
2021-04-28 04:31 AM
I have solved this problem just using the J-Link debugger ^^