[SOLVED] FreeRTOS task missing or incorrectly shows stack overflow

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

  • [SOLVED] FreeRTOS task missing or incorrectly shows stack overflow

    Hi Guys - I'm not sure if this is a Segger problem, but maybe you've seen this before...
    I'm using MCUXpresso from NXP on a Kinetis K64 (Cortex-M4F).
    FreeRTOS 9.0.0 and ARM GCC tools of 1Q2017.
    #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 // Note: 1 causes FreeRTOS Eclipse plug-in to crash...
    #define configTASK_RETURN_ADDRESS 0 // place 0 task return address on stack to help FreeRTOS-aware debugger (GDB unwind thread stack)
    #define configCHECK_FOR_STACK_OVERFLOW 2 // FreeRTOS vTaskSwitchContext checks for stack overflow => void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName );
    FreeRTOS Task Aware Debugger for GDB version 1.0.2 (201702241004)
    J-Link V6.14

    When I pause the application in the debugger, sometimes the MainLoop task is missing.
    When visible MainLoop always erroneously shows stack overflow (verified all OK using uxTaskGetStackHighWaterMark, after I nearly had a heart attack).
    [img]http://www.nadler.com/backups/FreeRTOSawareDebugger_stackOverflow_bug.PNG[/img]
    Any ideas?
    Thanks!
    Best Regards, Dave

    PS: I checked that no optimization was used (Arne pointed out this caused trouble in past).
  • OK, problem is solved by adjusting FreeRTOS configuration; no idea why this is required:
    #define configUSE_TRACE_FACILITY 1 // without this, FreeRTOS-aware debug task list can miss tasks and show bogus stack overflows
  • Hello Dave,

    the "Task List" in your screen shot has nothing to do with our task awareness feature.

    Our feature only helps the Eclipse IDE to build up its pretty tree view of tasks. The task list results from a different plugin.
    Probably this plugin gets confused if the structure of the task control block, which depends on various configuration settings, is different from what it expects.

    Best regards
    Arne
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.