I have found a crash in Windows port of FreeRTOS in port.c
I have found that pxCurrentTCB is NULL
/* Obtain the state of the task now selected to enter the
Running state. */
pxThreadState = ( ThreadState_t * ) ( *( size_t *) pxCurrentTCB );
Callstack:
> plugin_AeroSIMRC.dll!prvProcessSimulatedInterrupts() Line 496 + 0x5 bytes C
plugin_AeroSIMRC.dll!xPortStartScheduler() Line 362 C
plugin_AeroSIMRC.dll!vTaskStartScheduler() Line 1084 C
The proposed fix:
if(pxCurrentTCB != NULL)
{
/* Obtain the state of the task now selected to enter the
Running state. */
pxThreadState = ( ThreadState_t * ) ( *( size_t *) pxCurrentTCB );
/* pxThreadState->pvThread can be NULL if the task deleted
itself - but a deleted task should never be resumed here. */
configASSERT( pxThreadState->pvThread != NULL );
ResumeThread( pxThreadState->pvThread );
}
Please note that this crash was not immediate. It occurred after one hour of FreeRTOS app run.
I have investigated this problem and it might be a side effect of calling xSemaphoreGiveFromISR() from non FreeRTOS thread. I needed to simulate IRQ from something that cannot belong to FreeRTOS thread chunk.
Last edit: Jaroslav Fojtik 2022-05-11
I moved your question to our support forum - https://forums.freertos.org/t/crash-in-windows-port/15687
Going forward please use FreeRTOS support forums - https://forums.freertos.org/
Thanks.