Skip to main content
JPell.2
Associate
December 3, 2022
Question

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

  • December 3, 2022
  • 3 replies
  • 1288 views

..

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
December 3, 2022

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
December 7, 2022

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

Tesla DeLorean
Guru
December 7, 2022

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..