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.

printf-styleTrace Debug on Cortex-M3 without SYS/BIOS

Other Parts Discussed in Thread: LM3S6965, SYSBIOS

I'm working with the LM3S6965 in Code Composer v4 and the sample code enet_lwip.

I would really like to be able to view printf-style trace debug messages in CCS using SWD (UART is used for the application).

The only way I have been able to figure our how to do this is via SYS/BIOS, but this seems like a lot of extra bulk and I'd like to avoid it if I can. Plus I'm concerned it may not be compatible with the http code in enet_lwip.

Is there a way to use the debug interface to get printf-style trace logging in CCS v4 without resorting to SYS/BIOS?

Thanks,

+ Chris

 

  • Chris,

    Not quite sure what you mean by SWD, but the stdout in the target application is redirected to the CCS console by default. Therefore, if you include the run time support library, printf() calls from your application should be displayed directly in the console view of CCS.

    Please note that printf() calls are very costly in number of cycles, therefore may disrupt the real-time deadlines of your code. Depending on the version of your compiler you can use a reduced implementation of it. Check the page below for additional details on this option and Console I/O functions in TI compiler tools.

    http://processors.wiki.ti.com/index.php/Printf_support_in_compiler

    http://processors.wiki.ti.com/index.php/Tips_for_using_printf

    The alternative would be to use SYSBIOS for a lightweight printf.

    Hope this helps,

    Rafael

  • Hi Rafael,

    Thanks for the links. I had seen and tried this before, but abandoned it as it did not work and did not appear to apply to the Cortex M3.

    I tried to adapt them by setting the project properties Library Function Assumptions "Level of printf support required (--printf_supported)" to "full" and checking the box next to "File contains an RTS library function. (--std_lib_func_defined, -ol1)".

    But still do not see any output in the CCS Console.

    I would really prefer not to use SYSBIOS just to get output to the console, seems like a heavyweight solution to add an RTOS just for debugging. I'm trying to keep it simple.

    Also, I don't have to use printf, anything that would let me get trace information into CCS would be workable for debugging.

    Regards,

    + Chris

    By "SWD" I'm referring to "Serial Wire Debug" which listed on the LM3S6965 datasheet (and elsewhere), and how I think it could be possible to send debug information.

  • Chris,

    Chris Brandson said:

    I tried to adapt them by setting the project properties Library Function Assumptions "Level of printf support required (--printf_supported)" to "full" and checking the box next to "File contains an RTS library function. (--std_lib_func_defined, -ol1)".

    The option --std_lib_func_defined is only necessary if the you are modifying a standard library function, not using it (I understand the verbiage is not the best). I suggest you to remove this option.

    Also, all the console I/O functions require a minimum heap (I usually start with the 0x400 and move up as required).

    Unfortunately I don't know the Stellarisware example in details, but if it is redirecting the stdout in some way (to the UART, for example) then the calls would not be displayed in CCS at all. I couldn't see anything suspicious in a quick check, but I will try to run the code in a board here and let you know what I find (I don't have the exact one here).

    Chris Brandson said:

    Also, I don't have to use printf, anything that would let me get trace information into CCS would be workable for debugging.

    Printf should simply work, therefore the suggestion... The issue you are having must be something else.

    Chris Brandson said:

    By "SWD" I'm referring to "Serial Wire Debug" which listed on the LM3S6965 datasheet (and elsewhere), and how I think it could be possible to send debug information.

    Thanks for the info; learned something today.

    Rafael

  • I tried your suggestions regarding the option and heap size, and am still not seeing any messages.

    Also looked for somewhere that the output was being redirected to a UART and didn't see anything.

    Were you able to see output on your board?

    Regards,

    + Chris

  • Chris,

    Check the screen attached; it worked for me in a 8962 board with the minimal printf support on the enet_lwip project.

    In main I added the printf() call followed by a fflush(stdout) - just to guarantee the buffered data will be sent to CCS.

    Also, I made sure the Debugger options had CIO breakpoints enabled (right click on the project --> Debug Properties --> tab Target)

    I also checked the linker options to see if there was any heap allocated (it was 0 by default).

    In the project Build Properties I set the printf_support option to minimal

    As a result I got the printf output in the Console screen.

    Can you go through this check list and see if everything checks?

    Hope this helps,

    Rafael

     

  • Thank-you Rafael, it works now!

    The fflush() was the last piece, when I added that it worked.

    Regards,

    + Chris