FREERTOS Default CubeMX Project HardFault
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-31 9: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.
- Labels:
-
DEBUG
-
FreeRTOS
-
STM32F4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-03 3: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-01 10:19 AM
Up please. I need help with this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-01 1: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.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-03 3: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-03 8:44 AM
Thank you a lot!!! Thanks!!! Now it's working.:grinning_face:
