vPortStartFirstTask() generates Hard Fault Exception

Hi, i’m working on STM32CubeIDE platform to program STM32F407 Discovery Kit with FreeRTOS. I set the default configuration of FREERTOS and I select TIM1 as Timebase Source as suggested. I want to test a simple blinking LED routine in the default task, but during debug the software generates Hard Fault Exception on osKernalStart() call. The exception is generated here:

void vPortStartFirstTask( void )
__asm volatile(
" ldr r0, =0xE000ED08 \n" /* Use the NVIC offset register to locate the stack. /
" ldr r0, [r0] \n"
" ldr r0, [r0] \n"
" msr msp, r0\n" /
Set the msp back to the start of the stack. /
" cpsie i\n" /
Globally enable interrupts. /
" svc 0\n" /
System call to start first task. */
" nop\n"

I have read in other posts the problem could be solved by adding these lines, but in my version of FreeRTOS and STM32CubeIDE they were already present.
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler

Any suggestions?

Thanks for helping.

Riccardo Palma, Giacomo Melai

Maybe an odd question for you, but are you using CubeIDE v1.4.0? This post may be related.

There is a doc provided by STM which could be helpful:
Developing applications on STM32Cube with RTOS
I guess there are also official Blinky demos for comparison…

Try instruction level single step through vPortStartFirstTask. See if you end up in the correct SVC handler when SVC 0 is executed.

Yes i was using CubeIDE v1.4.0. I have downloaded CubeIDE v1.3.0 and now everything works.
Thanks everybody.