Skip to main content
JPell.2
Associate
Dec 3, 2022 1:37 PM UTC
Question

I'm using a STM32F407ZG. When we use printf, it goes where?

..

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
Dec 3, 2022 2:34 PM UTC

In GNU/GCC as implemented via ST _write() then __io_putchar() to the UART you've created/enabled to output the data

In Keil the plumbing is slightly different, but the overall method is to sink characters and output them via a channel you opt to use.

They can go to HAL_UART_Transmit() or ITM_SendChar(), or both. Or whatever equivalent bare-metal or library you utilize.

https://community.st.com/s/article/how-to-redirect-the-printf-function-to-a-uart-for-debug-messages

https://community.st.com/s/question/0D50X0000BNLT7RSQX/role-of-syscallsc

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
JPell.2
JPell.2Author
Associate
Dec 7, 2022 5:28 PM UTC

If I didn't use any UART or If it's not redirected, I suppose it goes nowhere, right?

Tesla DeLorean
Guru
Dec 7, 2022 5:33 PM UTC

Or traps in a BKPT..

Some of this might be evident with some debugging, and code walking. You could look at a disassembly, perhaps .MAP symbols.

Not much to work with here, your description of the system and build tools, pretty vague.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..