"svc 0" instruction in vPortStartFirstTask causes "Break at address "0x0" with no debug information available, or outside of program code."

Hi everyone,
I tried to add FreeRTOS on a NUCLEO STMF411RE. When it calls the “svc 0” instruction in vPortStartFirstTask, my debugger shows “Break at address “0x0” with no debug information available, or outside of program code.”
In my FreeRTOSConfig.h, I have these defines :
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler

I put a breakpoint to vPortSVCHandler but I don’t reach it. I don’t really know what to look at, Does someone have a clue? Tank you very much

Can you inspect the task list in your IDE? Were all your previous calls to xTaskCreate() successful? Can you share your main() code to the point of vTaskStartScheduler()?

Depending on your debug environment it can sometimes appear that starting the scheduler causes a crash without going through the SVC handler, whereas in fact the scheduler successfully started a task, and it was the task that crashed. Try putting a break point on the entry to the task that will run first (which may be the timer task, depending on the configTIMER_TASK_PRIORITY value), then run the code in the debugger rather than stepping through the code in the debugger to see if the breakpoint is hit.

If that doesn’t help you can try determining which instruction caused the fault - although in this case I’m not sure if that will help as it looks like the issue is before you ended up at address 0.

There is indeed something going on with tasks :

I have some wrappers all around, I will provide my flattened main when I have more time, but my intialization program create 3 tasks, but one is not launched :osThreadId_t result = osThreadNew((osThreadFunc_t)main_thread, NULL, &_main_thread_attr); with _main_thread_attr.stack_mem = _main_stack; _main_thread_attr.stack_size = sizeof(_main_stack); _main_thread_attr.cb_size = sizeof(_main_obj); _main_thread_attr.cb_mem = &_main_obj; _main_thread_attr.priority = osPriorityNormal; _main_thread_attr.name = "main";
But there is no “main” task running.

So I assume as the task is not properly created, it causes a crash when it comes to jump to it. I’ll keep you in touch when I have more time, thank you for you help so far!

You might be running out of heap space. Malloc failed hook can help you catch that - FreeRTOS - RTOS hook (callback) functions for task stack overflows, tick interrupts, idle task, daemon task startup, and malloc failure (pvPortMalloc() returning NULL)