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.

System_printf and printf() on CC2650 sensorTag

Other Parts Discussed in Thread: CC2650

Hi,

Can anyone help me on how to use printf or system_printf() for CC2650 sensorTag 2 on IAR embedded workbench using XDS110 debugger?

Thank you 

  • You should use System_printf() as it is lighter weight than printf() and it allows you to configure how/where the output goes.
    I believe all of the TI-RTOS examples wire up the System module to direct its output to a character handler provided by SysMin, which places the characters into a static ring buffer.
    By default, the static ring buffer of characters is flushed to the workbench console when the application exits.
    You can force the accumulated characters to be flushed to the console manually at any time by calling System_flush().
    If you want the System_printf() output to always be sent to the console without having to manually call System_flush() you should wire up the System module to use the SysStd provider rather than SysMin.
    This can be done in your .cfg file by changing the System.SupportProxy to point to SysStd:

    var SysStd = xdc.useModule("xdc.runtime.SysStd");
    var System = xdc.useModule("xdc.runtime.System");
    System.SupportProxy = SysStd;

    Alan
  • Hi Alan,

    Thank you.

    in appBLE.cfg, I have added below lines

    var SysStd = xdc.useModule("xdc.runtime.SysStd");
    var System = xdc.useModule("xdc.runtime.System");
    System.SupportProxy = SysStd;



    in main

    #include <xdc/runtime/System.h>

    int main()
    {e2e.ti.com/.../470509
    System_printf("system_printf");
    }

    I am not able to see them on IAR I/O terminal.
    should I add System_flush() or SysStd_flush() after System_print()
  • No need to add SysStd_flush().

    In the "General Options/Library Configuration" settings for your project, make sure you have the "Semihosted" and "Via semihosting" buttons selected these tell the debugger to cooperate with the console output mechanism the TI-RTOS application is using.

    In the debugger plugins options for your project, make sure you have the "TI-RTOS" plugin checked.

    Alan
  • Hi Alan,

    I have checked "Semihosted" and "Via Semihosting" in "General Options/Library Configuration"
    Also checked "TI-RTOS" in debugger plugins

    I am still not able to print via "System_printf", but I am able to print on the I/O console via normal "printf"

    Is there anything else to be done to print via "System_printf".

    Karthik
  • Hmm. I believe SysStd uses the same console I/O mechanism as printf() so I'm surprised this is not working now.

    Do you still have the below code in your .cfg file?

    var SysStd = xdc.useModule("xdc.runtime.SysStd");
    var System = xdc.useModule("xdc.runtime.System");
    System.SupportProxy = SysStd;

    Is there another assignment of the System.SupportProxy AFTER this assignment in the .cfg file?

    Please share your .cfg file if you are willing.

    Alan
  • Make sure your System_printf() strings end with '\n'.

    I was just informed that the SysStd CIO mechanism only pushes characters to the console when '\n' is received.

    Alan
  • Hi Alan,

    There was one more assignment "System.SupportProxy = SysCallback;" in appBLE.cfg file
    Now I am able to print using "system_printf()".

    Thank you

    Karthik
  • Thanks. It works as suggested.


    Here main steps (for TI BLE stack applications):

    1) Modify your appBLE.cfg config file (e.g. CCS > Project Explorer > YourApp > TOOLS > appBLE.cfg)

    System.SupportProxy = SysCallback; > System.SupportProxy = SysStd;

    2) Add SysStd variable

    SysStd = xdc.useModule("xdc.runtime.SysStd");

    3) Open main module (e.g. CCS > Project Explorer > YourApp > Startup > main.c) and add

    #include <xdc/runtime/System.h>

    ...

    System_printf("TEST\n");


    That's all


    Alex
  • Hi!

    Does anybody know how/why the System_printf prints a value on a console with delay?

    I mean, i am trying to read a value from MPU9250, the aceleration on X, and I would like to print it on a console, but as i read it, not as slow as System_printf does it. I was checking .cfg file, but could not fine any place where it says how often should it print... 

    Anybody knows how can i do it, or maybe some alternative for printing? It will be great to find some help! :))

    Thanks, 

    Natalia

  • Can you start a new thread? This one was marked as Verified and closed.

    Thanks,
    Todd
  • I appreciate the steps, but:

    How is this done in IAR v7.40 for ARM? TI provides an example, ie mutex, the only user I/O is System_printf(), yet it doesn't work out of the box. I've done everything in this thread, but just dropping this

    var SysStd = xdc.useModule("xdc.runtime.SysStd");
    var System = xdc.useModule("xdc.runtime.System");
    System.SupportProxy = SysStd;

    into my projects "*.cfg" file creates compile errors.

    Where is the tie-in for IAR users?

    Thanks in advance.
  • Hello,

    please update:

    System.SupportProxy = SysCallback;

    with

    System.SupportProxy = SysStd;

    and please provide more details about your appBLE.cfg compilation errors.

    Thanks

    Alex

  • Please see the series of screenshots below. In using the recommendations within this thread, these are the results I get. 

    1) This is the unmodified mutex kernel example within the IAR folder within TI-RTOS. It compiles fine w/o the modifications to the cfg file.

    2) My goal is to learn how to use System_printf();

    3) Why doesn't this work out-of-the-box........I didn't add the System_printf(), I just want to use it.

    4) When it eventually does work, will I have to specify an output window, or will it be automatic.

    Any help in getting this to work would be appreciated.

  • Hello,


    as shown in your screenshot you have to remove

    System.SupportProxy = SysCallback;

    from the configuration file.

    Leave only System.SupportProxy = SysStd;

  • Did this work for you? I have the same question... I don't see any of my printfs on the console within CCS with this method.
  • Hello,

    yes. It works.

    Please add also 

    SysStd = xdc.useModule("xdc.runtime.SysStd");

    and use 

    #include <xdc/runtime/System.h>

    ....

    System_printf("???\n");

    ...

    That's all.

    Alex

  • Hi,

    I followed this path:

    CCS > Project Explorer > YourApp > TOOLS > appBLE.cfg but i got following screen

    so where to add all that settings for System_printf?

  • Look at the "Outline" window and select "System". You can navigate through the kernel (SYS/BIOS), but it's easier to just select the module directly. The "Available Products" shows the modules that can be added also if it missing from the "Outline".

    In general, please start a new thread instead of adding onto an older thread.

    Todd