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.

LP-EM-CC1314R10: Strange different behaviour....

Part Number: LP-EM-CC1314R10
Other Parts Discussed in Thread: CC1314R10, SYSCONFIG

Tool/software:

When running my code under nortos, everything looks normal.

When I try to port that code to freertos I get an exception in sprintf(). Since I am using GCC and assume the same libraries for this function

are used in both cases, this seems weird to me. When I step through the code the freertos version steps OK until I hit the sprintf() statement.

void xprint_int(int a) {
//    int len;
    char outbuf[16];
    sprintf(outbuf,"%d",a);
    xprint(outbuf);
}

xprint is just a wrapper for UART_write, and works for pure text in this program.

When the statement is hit the debugger seems to loose contact with the board, and becomes unresponsive.

It is NOT possible to step ito the sprintf statement.

If I "view disassembly" at the sprintf statement I get that, and can step machine instructions. Stepping further I get to siprintf(), sprintf():
stepping further I get to _svfiprintf_r(), _svfprintf_r():

_svfiprintf_r(), _svfprintf_r():
0000c330: E92D4FF0 push.w {r4, r5, r6, r7, r8, r9, r10, r11, r14}
0000c334: 4698 mov r8, r3
0000c336: 898B ldrh r3, [r1, #0xc]
0000c338: B09D sub r13, #0x74 // this is the instructions that causes faultISR.

I cannot imagine that subtracting a register should cause a faultISR

There is no source code, so one has to understand compiler strategy AND arm assembler to figure this out.

What is happening here???

The sprintf tries to sprintf("%d",a) where ais an integer

Gullik

  • Disregard question.

    Freertos lack of experience. I started two more tasks from the main code of rfUartbridge gcc/freertos example using vtaskcreate(). I got three tasks, the original code, my CLI, and a dummy Eth task that just waits a second and blinks a led. All seemed to work but I got very strange behaviour. When I changed from vtaskcreate to pthreadcreate

    everything seems to work as expected, and I do NOT get a trap in sprintf......it is claimed that a task and a thread are the same in freertos, but SIC.

    Every day something to learn.

    Gullik

  • I have now ported my application to FreeRTOS, with only minor issues (including learning).

    I am now trying to show the status of the system from my CLI. In doing that I learn that I should

    call vTaskList(buffer) where buffer should be a resulkt buffer of suitable size.

    However, vTaskList is not defined when compiling, but defined in "task.h" (that is #included)

    What is the procedure to enable this FreeRTOS call in the SDK?

    Gullik

  • Hi Gullik,

    thank you for sharing your first question and resolution.

    To your second question: Which is the error that you are getting?

    Kind regards,
    Theo

  • Well, I cannot compile it...

    /home/webjorn/workspace_v12/rfUARTBridge_LP_EM_CC1314R10_freertos_gcc/Debug/../cmd.c:628: undefined reference to `vTaskList'

    The doc says to pass a writeable buffer of size #tasks x 40 or so, and should provide a string with task info.

    it is defined in ti/simplelink_cc13xx_cc26xx_sdk_8_30_01_01/source/third_party/freertos/include/task.

    void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */

    configUSE_TRACE_FACILITY and configUSE_STATS_FORMATTING_FUNCTIONS must
     * both be defined as 1 for this function to be available.  See the
     * configuration section of the FreeRTOS.org website for more information.

    Where should I put these definitions, I do not want to screw up sysconfig or TI provided sources

    I tried to define them in the source file refering to VtaskList, before the "include tasks.h"

    but that does not do it...

    This is hard to debug, when kernel objects are "hidden" and utilities does not compile....

    So this is probably the wrong choice of RTOS, RSX-11M and VMS was much simpler.....:-)

    Gullik

  • Hi Gullik,

    I traced down the issue and you need to add another global define in the predefined symbols for the compiler to include the function.

    This is because in the c file there is the following condition for the include:

    According to documentation the buffer should be at least 40 bytes large and the function is generally not recommended for production.

    Reference in the FreeRTOS docs: https://www.freertos.org/Documentation/02-Kernel/04-API-references/03-Task-utilities/00-Task-utilities#vtasklist 

    Kind regards,
    Theo

  • Thank you very much Theo,

    works exactly as described....now I can at least see my tasks....

    Regards,

    Gullik