2025-06-27 11:20 AM
I trying to debug to find what line in initialization function throw hard fault and cant understand why "jump over" dont work like expected, in some moments jumps not to next row in code, then goes back...
After running normally must start at SCB_EnableICache() line, but starts from main:
Then step by step must goes in that way:
But goes/jumps in this way:
SCB_EnableICache();
SCB_EnableDCache();
MPU_Config();
MX_GPIO_Init();
SystemClock_Config();
And throws hard fault error inside SystemClock_Config function at HAL_Delay(HSE.....
I am not sure if hard fault is fired because there is misconfig in cubeMX (I think not), or there because in some way is missed HAL_Init and other initializations, code cleaning, restarting and other things does not change anything, I have posted about some other problems earlier with initializations and bugs, but now I stuck there and cant work with code at all, cubeMX, cudeIDE, mcu package and everything else is updated to last available versions !
Main problem is what these bugs and problems will fail all the huge project which have investors, our team will not fit in time !!
2025-06-27 11:42 AM
This is usually due to compiler optimization. Try setting -O0. Depending on your IDE you may find a fault analyzer which helps decoding the reason for the fault.
hth
KnarfB
2025-06-27 1:30 PM
What board are you working with? Is SMPS a valid power configuration?
Not using HSE, so there's no reason to delay until it's valid. Code isn't entirely MX-generated, appears to be out of sync.
2025-06-27 2:58 PM
With optimization there can be non-linear code relationships, ie not 1:1 relationship in code/flow of C vs Assembler.
Also there will be granularity in debug data relating code lines, to opcode addresses, perhaps a one-to-many.
You're talking about the STM32N chips
The STM32F74x/5x parts used a Cortex-M7 core which had some single-step issues