2024-11-25 02:42 PM - edited 2024-11-25 02:43 PM
I have used this method many times on this board (Nucleo-H743ZI) to transmit printf() to usart3 using the following:
int __io_putchar(int ch) {
/* e.g. write a character to the USART3 and Loop until the end of transmission */
HAL_UART_Transmit(&huart3, (uint8_t*) &ch, 1, 0xFFFF);
return ch;
}
[...]
printf("hello world\n")
However, it has now stopped working in my project. HAL_UART_Transmit() still works fine but printf never seems to call __ioputchar.
This same thing is working on my project with the STM32H7B3I-DK, using usart1.
Any Ideas what could've happened?
2024-11-25 02:52 PM
Review with a debugger?
Disassemble, check the library linkage, and understand where in the path from printf() to __ioputchar() it is failing.
syscalls.c ? _write() ?
2024-11-25 03:08 PM - edited 2024-11-26 10:38 AM
From viewing the disassembly I can see it gets to __io_putchar with the following disassembly.. it doesnt look like its getting into the __ io_putchar that I defined
112 __io_putchar(*ptr++);
08003718: ldr r3, [r7, #8]
0800371a: adds r2, r3, #1
0800371c: str r2, [r7, #8]
0800371e: ldrb r3, [r3, #0]
08003720: mov r0, r3
08003722: nop.w