This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problem adding FreeRTOS Software Timers to MQTT Client example

Other Parts Discussed in Thread: CC3200, CC3200SDK

I am attempting to add a FreeRTOS Software Timer to send out a periodic message about system status in the MQTT Client example. 

To start, I update the configUSE_TIMERS define in FreeRTOSConfig.h to the value of 1. I then re-built my oslib project and verified that a timers.obj file was created. 

I preceded to add the required include and other components to main.c to introduce a timer into the project. 

#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "timers.h"
#include "portmacro.h"

TimerHandle_t Msg_Timer;

void MsgTimerCallback( TimerHandle_t pxTimer )
{

...

}

Msg_Timer = xTimerCreate("MsgTimer", (100 * 1000), pdTRUE, NULL, MsgTimerCallback);

xTimerStart(Msg_Timer, 0);

When building the project, the linker complains about unresolved symbols, xTimerCreate and xTimerGenericCommand. 

Has anyone else encountered this problem?

Thanks,

Scott

Details:

Code Composer Studio V6.1.0.00104

TI Compiler V5.2.5

SDK: CC3200 1.1.0

  • Scott, Please allow me to check and get back.-/Praneet
  • Greetings Helio and Praneet,

    Per your suggestion Helio, I changed the include to "timers.c", and it does indeed resolve the xTimerCreate and xTimerGenericCommand define issue. However, it introduced an additional undefined function "vQueueWaitForMessageRestricted". I have added #include "queue.h" in an attempt to correct this issue, but that did not fix the problem.

    Interesting the FreeRTOS manual still calls out #include "timers.h" not the c file.
  • Scott,

    Suggest you post these queries on a Free-RTOS forum.

    And, for your requirement of sending out a periodic message about system status, you could use CC3200's DriverLib APIs to start a periodic timer and take the required actions every time it expires - Please take references from the sample application @ 'cc3200-sdk\example\timer' for more details.

    -/Praneet
  • Information on including software timers in a FreeRTOS application is provided on the following link:

    http://www.freertos.org/Configuring-a-real-time-RTOS-application-to-use-software-timers.html

    As you will see, you have to set configUSE_TIMERS to 1 in FreeRTOSConfig.h and add the FreeRTOS/Source/timers.c source file to your project - that is - build that source file with your project to make the API available.  Then to use a timer in a different source file you #include "FreeRTOS.h" followed by "#include "timers.h".

    > However, it introduced an additional undefined function "vQueueWaitForMessageRestricted"

    That sounds like a version number mismatch.  Each FreeRTOS source file includes a version number at the top - is the version number in your timers.c source file the same as the version number in your other FreeRTOS source files?  I suspect not.  From memory vQueueWaitForMessageRestricted() is a relatively new function that was added to improve our tickless low power support.  http://www.FreeRTOS.org/History.txt

  • Good Day Richard,

    I reviewed each of the FreeRTOS file contained in TI CC3200 SDK  (..\CC3200SDK_1.1.0\cc3200-sdk\third_party\FreeRTOS). The heading comment in each of the .c & .h files contained the following: 

    "FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd."

    Therefore, all appears in alignment.

    However, I noted in History.txt that you had introduced a helper macro "pdMS_TO_TICKS" in V8.0.1. This macro does not appear to be present in the FreeRTOS code base provide in the CC3200 SDK provided by TI. 

    Thank you,

    Scott