Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cgo: add support for stdio in picolibc #2135

Merged
merged 1 commit into from
Oct 26, 2021
Merged

cgo: add support for stdio in picolibc #2135

merged 1 commit into from
Oct 26, 2021

Conversation

aykevl
Copy link
Member

@aykevl aykevl commented Sep 24, 2021

This is simple: just add the required header file. But this PR also adds a simple test to make sure it remains supported.

@aykevl
Copy link
Member Author

aykevl commented Sep 27, 2021

This doesn't work yet on WebAssembly. That's fixable, but requires a bit more CGo work.

@aykevl aykevl force-pushed the cgo-picolibc-stdio branch from 7500373 to e188243 Compare October 23, 2021 00:24
@aykevl
Copy link
Member Author

aykevl commented Oct 23, 2021

Updated so that a function like puts works when called from Go (CGo), even on baremetal systems! It will forward the written bytes to the putchar function in the runtime. It also works on WebAssembly now.

This adds support for stdio in picolibc and fixes wasm_exec.js so that
it can also support C puts. With this, C stdout works on all supported
platforms.
@deadprogram
Copy link
Member

This will be very useful for hacky debug sessions, among other more serious uses. 😸

Thanks @aykevl now merging.

@deadprogram deadprogram merged commit 14bb90c into dev Oct 26, 2021
@deadprogram deadprogram deleted the cgo-picolibc-stdio branch October 26, 2021 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants