allow developer to select desired implementation of stdin, etc. #1900

Open
opened 2024-09-03 21:03:26 -05:00 by gneverov · 5 comments
gneverov commented 2024-09-03 21:03:26 -05:00 (Migrated from github.com)

picolibc_interface.c currently defines strong symbols for stdin, stdout, and stderr that use the implementation from pico_stdio. There is no way for the developer to override this behavior.

Use cases

  • if picolibc was compiled with POSIX_IO, then picolibc already defines weak versions of stdin, etc.. Probably the developer intends to use this implementation, but it is silently overridden by the pico-sdk's implementation, which uses strong symbols.
  • the developer might define their own symbols for stdin, etc. and doesn't want them overridden or in conflict with what pico-sdk defines.
[picolibc_interface.c](https://github.com/raspberrypi/pico-sdk/blob/develop/src/rp2_common/pico_clib_interface/picolibc_interface.c) currently defines strong symbols for stdin, stdout, and stderr that use the implementation from [pico_stdio](https://github.com/raspberrypi/pico-sdk/tree/develop/src/rp2_common/pico_stdio). There is no way for the developer to override this behavior. ### Use cases - if picolibc was compiled with POSIX_IO, then picolibc already defines weak versions of stdin, etc.. Probably the developer intends to use this implementation, but it is silently overridden by the pico-sdk's implementation, which uses strong symbols. - the developer might define their own symbols for stdin, etc. and doesn't want them overridden or in conflict with what pico-sdk defines.
vazhnov commented 2026-06-16 04:10:39 -05:00 (Migrated from github.com)
Is it fixed by https://github.com/raspberrypi/pico-sdk/pull/2935 ?
gneverov commented 2026-06-17 13:29:28 -05:00 (Migrated from github.com)

I'm not sure. I resolved my original issue by creating my own "interface.c" rather than relying on the built-in ones. I'm fine with closing this issue.

I'm not sure. I resolved my original issue by creating my own "interface.c" rather than relying on the built-in ones. I'm fine with closing this issue.
vazhnov commented 2026-06-17 13:37:16 -05:00 (Migrated from github.com)

@gneverov , before to close the issue, you can share your recipe with others :)

@gneverov , before to close the issue, you can share your recipe with others :)
kilograham commented 2026-06-18 07:47:27 -05:00 (Migrated from github.com)

yeah, i think, leave this open, as it is a reasonable enhancement

yeah, i think, leave this open, as it is a reasonable enhancement
gneverov commented 2026-06-18 11:05:27 -05:00 (Migrated from github.com)

@vazhnov, @kilograham mentioned at the time that the C lib interface system is user extensible. You can define the CMake PICO_CLIB variable to point to your own implementation instead of using a built-in one.

@vazhnov, @kilograham mentioned at the time that the C lib interface system is user extensible. You can define the CMake PICO_CLIB variable to point to your own implementation instead of using a built-in one.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1900
No description provided.