Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In what file are __io_putchar() and __io_getchar() defined?

I've noticed that the syscalls.c file for an STM32F407-DISC project (Made through the STM32CubeIDE) has __io_putchar() and __io_getchar() as externs.
But I can't locate any file within the project where these functions are actually defined.

This is what is present in the syscalls.c file:

extern int __io_putchar(int ch) __attribute__((weak));
extern int __io_getchar(void) __attribute__((weak));

Does anyone know what file these externs are pulling from?

Thanks in advance!

like image 308
Jazz Jackson Avatar asked Jan 29 '26 16:01

Jazz Jackson


1 Answers

They are in the standard library. So there is no code in your project. You need to download (clone) the source code of the standard library implementation used by the STMCubeIDE toolchain.

Simply write your own ones and they will replace those with the weak linkages.

like image 178
0___________ Avatar answered Feb 02 '26 21:02

0___________



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!