2020-08-31 09:52 AM
Hi, I'm trying to execute a default CubeMX project for STM32F407 Disco with FreeRTOS. However, when I debug, it crashes with Hard Fault Handler, at the point of this function:
prvPortStartFirstTask();
So I can't start the system. I don't know why, if it's all by default.
Solved! Go to Solution.
2020-09-03 03:59 AM
I've the same error. I tried to debug, what should be the problem, and I found the location of error in port.c prvPortStartFirstTask() function. Unfortunately it is an assembler function. I think so it is a stack problem,:
__asm volatile(
" ldr r0, =0xE000ED08 " /* Use the NVIC offset register to locate the stack. */
" ldr r0, [r0] "
" ldr r0, [r0] "
" msr msp, r0 " /* Set the msp back to the start of the stack. */
" mov r0, #0 " /* Clear the bit that indicates the FPU is in use, see comment above. */
" msr control, r0 "
" cpsie i " /* Globally enable interrupts. */
" cpsie f "
" dsb "
" isb "
" svc 0 " /* System call to start first task. */
" nop "
);
my fw version is 1.25.0. I tried with 1.24.0 also.
And finally I found this:
and that is the solution.
2020-09-01 10:19 AM
Up please. I need help with this.
2020-09-01 01:30 PM
>>So I can't start the system. I don't know why, if it's all by default.
Look at the processor registers and disassembly at the fault, not the C code.
Understand specifically what it is objecting too.
Use a Hard Fault handler that can output actionable data.
Most likely an address or function pointer that is incorrect.
Check task structure initialization.
Check stack pointer addresses and alignments.
2020-09-03 03:59 AM
I've the same error. I tried to debug, what should be the problem, and I found the location of error in port.c prvPortStartFirstTask() function. Unfortunately it is an assembler function. I think so it is a stack problem,:
__asm volatile(
" ldr r0, =0xE000ED08 " /* Use the NVIC offset register to locate the stack. */
" ldr r0, [r0] "
" ldr r0, [r0] "
" msr msp, r0 " /* Set the msp back to the start of the stack. */
" mov r0, #0 " /* Clear the bit that indicates the FPU is in use, see comment above. */
" msr control, r0 "
" cpsie i " /* Globally enable interrupts. */
" cpsie f "
" dsb "
" isb "
" svc 0 " /* System call to start first task. */
" nop "
);
my fw version is 1.25.0. I tried with 1.24.0 also.
And finally I found this:
and that is the solution.
2020-09-03 08:44 AM
Thank you a lot!!! Thanks!!! Now it's working.:grinning_face: