2025-04-01 3:19 AM - last edited on 2025-04-01 3:38 AM by Andrew Neil
Originally a comment on the How to redirect the printf function to a UART for debug messages Knowledge Base article.
Moved to main forum for better visibility & discussion
Hello @ST AME Support NF ,
I have tried example code.
..\Repository\STM32Cube_FW_F7_V1.17.2\Projects\STM32F746ZG-Nucleo\Examples\UART\UART_Printf
In ST CubeIDE and MDK-ARM it's working fine but in IAR(EWARM) IDE it's not working.
I tried to implement _write function but it's not triggered whenever i call printf.
Please guide me to implement this in IAR IDE.
2025-04-01 3:35 AM - edited 2025-04-01 3:37 AM
@lavanya wrote:Please guide me to implement this in IAR IDE.
It is implementation-defined, so probably best to ask IAR about that - they may well have their own way of doing this ...
PS:
2025-04-01 4:34 AM - last edited on 2025-04-01 4:45 AM by Andrew Neil
Duplicate - merged.
Hi
I have tried example code.
..\Repository\STM32Cube_FW_F7_V1.17.2\Projects\STM32F746ZG-Nucleo\Examples\UART\UART_Printf
In ST CubeIDE and MDK-ARM it's working fine, But in IAR(EWARM) IDE it's not working.
I tried to implement _write function but it's not triggered whenever i call printf.
Please guide me to implement this in IAR IDE.
2025-04-01 5:09 AM - edited 2025-04-01 5:11 AM
Implement function in your code:
size_t __write(int handle, const unsigned char * buffer, size_t size);
Note the double __ ! For the CubeIDE (newlib) this function is _write with single _.
Also with the semihosting, the function names differ. All this is described in the IAR C/C++ development document.