Hey everybody.
we are currently running many stability tests and found this issue:
The test below stops working after some seconds. Checking with the debugger, FreeRTOS does not schedule anymore and hangs inside the idle task. We are using an STM32F439xx with the CM3 port. GGC 7.2.
What the code does:
1. Starts a
We are using an STM32F439xx with the CM3 port. GGC 7.2.
main task (prio 8).
2. Starts a watchdog task (prio 10) to provoke task switches.
3. In an infinity loop: Start a test take (prio 8) and delete him.
What seems to happen before the crash (not 100% sure):
1. The test task will be running (happens really rarly, see below).
2. Calls Suspend.
3. Main thread calls Suspend/Delete.
4. Idle task runs for ever without context switches.
vTask1 is called if the counter is:
0x93, 0xAE and y.
y is variable but after y +0xE, the schedular hangs.
Our FreeRTOS config:
~~~
define configUSE
PREEMPTION 1
define configUSEPORT
OPTIMISEDTASK
SELECTION 1
define configUSEIDLE
HOOK 0
define configUSETICK
HOOK 0
configUSETIME_SLICING 0
~~~
~~~
define STACKSIZE configMINIMALSTACK_SIZE * 10
/* Structure that will hold the TCB of the task being created. */
StaticTask_t xTaskBufferMain;
StaticTask_t xTaskWD;
StaticTask_t xTaskBuffer1;
StackType
t xStackMain[ STACKSIZE ];
StackType
t xStackWD[ STACKSIZE ];
StackType
t xStack1[ STACKSIZE ];
void vTask1(void *) {
vTaskSuspend(nullptr);
}
void vWD(void *) {
while (true) {
vTaskDelay(pdMS_TO_TICKS(1));
}
}
void vMain(void *) {
xTaskCreateStatic(vWD, “wd”, STACK_SIZE, NULL, 10, xStackWD, &xTaskWD);
unsigned int i = 0;
while (true) {
TaskHandle
t handle1 = xTaskCreateStatic(vTask1, “task1”, STACKSIZE, NULL, 8, xStack1, &xTaskBuffer1);
vTaskSuspend(handle1);
vTaskDelete(handle1);
++i;
}
}
extern “C” int main(void) {
__enable_irq();
// 4 bits for pre-emption priority 0 bits for subpriority.
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
xTaskCreateStatic(vMain, “main”, STACK_SIZE, NULL, 8, xStackMain,
&xTaskBufferMain);
vTaskStartScheduler();
return 0;
}
~~~
I tried to find the issue but I am out of ideas. Can someone please help?