2021-02-12 06:40 AM
Hi all,
I am working on a project which is based on freertos on stm32l476rg. I have added STM32CubeExpansion_CELLULAR_V5.2.0 into my project and while running I am getting hard fault handler before control comes to main function.
These are the remedies I tried
https://www.segger.com/downloads/application-notes/AN00016 shown in the above picture, I changed the variable 'var' to 1 in runtime in expression window in the stm32cubeide to find the root cause of hard fault handler while stepping out of the breakpoint which I set in the line number 96 in the code.
I checked the fault analyzer also and here I attached fault analyzer window
I am not getting where could be the issue? Please can anybody help me out?
2021-02-12 08:46 AM
You've got to look at the processor registers, and the location of the faulting instructions, and do a disassembly of those.
Before main you have the code in startup.s and SystemInit()
Turn off run-to-main, and step the coding from the Reset_Handler, check that you aren't trying to initialize memory that isn't enabled, ie QSPI, memory beyond scope of FLASH or RAM.
Check you aren't using an FPU instructions before enabling the co-processor.
Check you aren't using a broken or misaligned stack pointer.
2021-02-12 11:17 PM
Thank you for your reply.
I tried as you told. I did step the coding from Reset_Handler. I set a breakpoint at where SystemInit() is called (in the startup.s) and while stepping into the function, the control goes to hard fault handler. I am attaching the snippet of disassembly, Registers and SFRs tab in stm32cubeide.
Still I am unable to solve the issue. can you help me please?