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.

CCS/CC1352R: Bug in System_printf in TI RTOS

Part Number: CC1352R

Tool/software: Code Composer Studio

The blow code does not print the 0 character, but hangs:

#include <string.h>

#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/BIOS.h>
#include <ti/drivers/Board.h>
#include <ti/sysbios/knl/Task.h>
#include <xdc/runtime/Error.h>

Task_Handle taskHandle;

void taskFxn(UArg a, UArg b){
    System_printf("taskFxn started.\n");
    System_printf("-%c-.\n", 0); // <<<<<<<<<<<<<<<<< This line does not work.
    System_printf("taskFxn exited.\n");
    System_flush();
}

int main()
{
    /* Call driver init functions */
    Board_init();

    System_printf("hello world\n");

    Task_Params taskParams;
    Error_Block eb;

    /* Configure pack task. */
    Task_Params_init(&taskParams);
    Error_init(&eb);
    taskParams.stackSize = 512;
    taskParams.priority = 3;
    taskHandle = Task_create(taskFxn, &taskParams, &eb);

    BIOS_start();
    return(0);
}

  • Did you try to increase the stack size? In any case that won't print a zero character which is '0', you are asking it to print NUL- all bits zero - which is non-printable. It should not hang though.

    if you want to print 0x00 as a character you need to use %d.

  • Yes, I know that 0 != '0' and that is does not display anything since 0 is non printable. I wanted to print 0 as a character and then it hangs. The problem came from that I printed from a buffer that can be 0 or something else, thus the background. So, I still think it is a but. It is not related to that stack size.

  • Robert,

    I just tried this and it did not hang. Here is the output after calling the following (note: c was set to 'C'):

           System_printf("-%c-.\n", 0);
           System_printf("-%c-.\n", c);

    What SDK version are you using? Can you attach your .cfg? 

    Todd

  • I am running 3.40.0.2 and the .cfg attached.8371.hello.cfg

  • Thanks.

    I see there is corruption going on in main(). Your system stack is set to 512 in the .cfg (which overrules the linker command files setting). The system stack is used for main (and then reset and used for Hwi and Swis within BIOS_start). The Task_create is blowing the stack because you have HeapTrack enabled in the .cfg. While a helpful debugging tool, it is causing more stack usage when allocating memory. I increased the system stack size to 1024 and see the peak at 520. So some corruption was going on somewhere.

    Can you either increase the system stack size or remove the use of HeapTrack and then try this again?

    Todd