[ABANDONED] RTT - Corrupt mutex with FreeRTOS

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] RTT - Corrupt mutex with FreeRTOS

    Hi

    So I start to play with RTT on a very simple program with 4 task on FreeRTOS

    Each task is very simple. Basically it displays the task name and toggle a led

    (dbg_printf_write function just add some data before using SEGGER_RTT_printf)

    C Source Code

    1. void start_generic_task(void *argument)
    2. {
    3. osMutexAcquire(mutex_rttHandle, osWaitForever);
    4. dbg_printf_write(DBG_CODE_GENERIC_TASK, DBG_SEV_INFO, "Start task: %s", osThreadGetName(osThreadGetId()));
    5. osMutexRelease(mutex_rttHandle);
    6. for(;;)
    7. {
    8. osDelay(500);
    9. LL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin);
    10. }
    11. }
    Display All

    When the last task try to release the mutex, I got stuck on an assert :cursing:
    After some research I found that the cullprit was the va_start inside SEGGER_RTT_printf.
    edit: I add a mutex just to be sure

    For some unknown reason, on the last printf call, the va_start function modify some data use by the mutex and so the assert function catch it!

    Is there something special to do when using with RTT and FreeRTOS ?

    The post was edited 1 time, last by Brice_38_FR ().

  • So I change my stack size for this task (all other were 512words) but this one was 128 words (so 512bytes)

    I thought it was enough because the task didn't do a thing.

    But the va_start must use some stack ? is there a way to know how much ?