Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FreeRTOS - vTaskList undefined reference

I am trying to use vTaskList function to monitor tasks being used. In order to use vTaskList, I configure the macro below.

#define configUSE_TRACE_FACILITY        1
#define configUSE_STATS_FORMATTING_FUNCTIONS 1

and below is task code to display task list.

  void TASK_LIST()
    {
        signed char pWriteBuffer[2048];
        for(;;)
        {
            vTaskList(pWriteBuffer);
            printf("task_name   task_state  priority   stack  tasK_num\n");
            printf("%s\n", pWriteBuffer);
        }
        vTaskDelete(NULL);
        return;
    }

However, the error just showed up for undefined reference

What caused this error?

Thank you.

Ps. For my original situation, there is no macro for configUSE_STATS_FORMATTING_FUNCTIONS in FreeRTOSConfig.h. so I add it manually.

Now I am searching building command to build whole project enter image description here

like image 774
黃銘賢 Avatar asked Aug 17 '26 01:08

黃銘賢


1 Answers

It looks from code source as it depends on FreeRTOS kernel version...

I checked several demo applications for your particular version, e.g. this one, and also code source for tasks.c. And it should be enough to set those two macros which you mentioned. So, the actual reason of linking error looks like not related to configuration itself. Check if tasks.c source file is rebuilt after configuration change (if not, dependencies in project are not handled properly). Double check also that those defines are real "1" - digit (not "l" (small "L" letter) or "I" (capital "I" letter), which can be easily confused with "1" depending on used font).

UPDATE

Since you are using Eclipse IDE, take a look at this official guidance of how to setup project. Here you can find demo project for Eclipse for your version of FreeRTOS, check Makefile in particular, I guess your auto-generated Makefile missing lines like:

$(RTOS_SOURCE_DIR)/tasks.c \

PS

For v9.0.0 it should be enough to enable configurations as you did. But v10.0.0 there is also dependency on configSUPPORT_DYNAMIC_ALLOCATION: if in project's FreeRTOSConfig.h it's defined to something other than default ("1") - vTaskList will be excluded. This dependency, however, is neither mentioned in include header file task.h nor in online documentation.

like image 165
pmod Avatar answered Aug 21 '26 15:08

pmod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!