From cbff8e75d06b5e8ea9a196fa4fa706ba9f9ed124 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 11 Jul 2022 17:56:55 +0200 Subject: [PATCH] Make code compatible with picolibc >= 1.7.3 picolibc commit 1eba3461fd1664d38be36f3bf21898f889a7d2e3 changed the way how stdio backends are used by picolibc. Let's use the PICOLIBC_STDIO_GLOBALS to differentiate the old vs. new method. Closes: SYS#6042 --- libcommon/src/iob_stm32_nonblocking.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libcommon/src/iob_stm32_nonblocking.c b/libcommon/src/iob_stm32_nonblocking.c index 4ca0f50..ff33e93 100644 --- a/libcommon/src/iob_stm32_nonblocking.c +++ b/libcommon/src/iob_stm32_nonblocking.c @@ -95,8 +95,13 @@ static FILE __stdin = FDEV_SETUP_STREAM(NULL, my_stdin_getc, NULL, _FDEV_SETUP_R static FILE __stdout = FDEV_SETUP_STREAM(my_stdout_putc, NULL, my_stdout_flush, _FDEV_SETUP_WRITE); static FILE __stderr = FDEV_SETUP_STREAM(my_stderr_putc, NULL, NULL, _FDEV_SETUP_WRITE); +#ifndef PICOLIBC_STDIO_GLOBALS FILE *const __iob[3] = { &__stdin, &__stdout, &__stderr }; - +#else +FILE *const stdin = &__stdin; +FILE *const stdout = &__stdout; +FILE *const stderr = &__stderr; +#endif #include