Skip to main content
User.100
Associate II
Nov 16, 2022 4:21 AM UTC
Question

how to found out any printf function for debug messages?

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.

    9 replies

    Tesla DeLorean
    Guru
    Nov 16, 2022 5:48 AM UTC

    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 Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    User.100
    User.100Author
    Associate II
    Nov 16, 2022 5:51 AM UTC

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

    where can I found the  via _write() ?

    Tesla DeLorean
    Guru
    Nov 16, 2022 5:59 AM UTC

    Check or Google newlib/syscalls.c

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    User.100
    User.100Author
    Associate II
    Nov 16, 2022 6:50 AM UTC

    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
    Nov 17, 2022 3:48 PM UTC

    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
    Nov 18, 2022 2:39 AM UTC

    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
    Nov 18, 2022 9:56 AM UTC

    Select a Platform Component (right click)

    0693W00000WIn3NQAT.pngThen select Runtime I/O component

    0693W00000WIn4BQAT.png

    Giuseppe DI-GIORE
    ST Employee
    Dec 12, 2022 8:45 AM UTC

    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.