Skip to main content
User.100
Associate II
November 16, 2022
Question

how to found out any printf function for debug messages?

  • November 16, 2022
  • 5 replies
  • 2932 views

I use SPC5Studio-5.8.1, and SPC574S MCU, but I can not found any printf funciton example in the serial example code. Would you help me?

    This topic has been closed for replies.

    5 replies

    Tesla DeLorean
    Guru
    November 16, 2022

    If using GNU/GCC wouldn't the STDIO plumbing come out via _write() ?

    Implement output to a UART you've initialized for this purpose. ​

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    User.100
    User.100Author
    Associate II
    November 16, 2022

    Thank you for your answer. would you give me some more information.

    where can I found the  via _write() ?

    Tesla DeLorean
    Guru
    November 16, 2022

    Check or Google newlib/syscalls.c

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    User.100
    User.100Author
    Associate II
    November 16, 2022

    Hi Tesla,

    I don't found any useful information in search newlib/syscalls.c.

    and I found that SPC5Studio can not found the file of "newlib/syscalls.c".

    so do you have any other suggestion?

    Giuseppe DI-GIORE
    ST Employee
    November 17, 2022

    SPC5Studio provides a component called "Runtime I/O" which implements the low lever software to enable printf().

    Add "Runtime I/O" component to your project, configure it (which seria port to use) and use printf().

    User.100
    User.100Author
    Associate II
    November 18, 2022

    Hi Giuseppe DI-GIORE,

    Thank you for your reply. I don't know how to add ​"Runtime I/O" component to my project.

    Would you give me a example? I searched "Runtime I/O" in serial enabled project , but found nothing.

    Giuseppe DI-GIORE
    ST Employee
    November 18, 2022

    Select a Platform Component (right click)

    0693W00000WIn3NQAT.pngThen select Runtime I/O component

    0693W00000WIn4BQAT.png

    Giuseppe DI-GIORE
    ST Employee
    December 12, 2022

    Configure the serial port using the Low/Level Driver component (selecting the pin you need) and the select the just configured serial port in the Runtime I/O component.