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

stdio_rtt is loosing output #20510

Open
maribu opened this issue Mar 27, 2024 · 0 comments
Open

stdio_rtt is loosing output #20510

maribu opened this issue Mar 27, 2024 · 0 comments
Assignees

Comments

@maribu
Copy link
Member

maribu commented Mar 27, 2024

Description

stdio_rtt is convenient because of its speed and because it does not block any peripheral. However, it is basically useless in tests as it will loos output written to the ringbuffer right before the main thread exists.

More than once I spent time tracing down non-existing bugs as the app appeared to be stuck, while in fact it ran to completion and succeeded but the last few lines of output where never flushed.

Steps to reproduce the issue

Run any test app with stdio_rtt and OpenOCD. I had this with the nucleo-f429zi and the e180-zg120b-tb; but given that the issue affected 2 out of 2 random boards, I think it applies generally.

Expected results

No output is lost, unless writing faster than OpenOCD can drain the ringbuffer.

Actual results

The last bytes written to stdio are lost. Adding simple fflush() or similar doesn't solve the issue, but adding some while (1) {puts("."); ztimer_sleep(ZTIMER_MSEC, 100);} or similar to add more output results in the relevant output to be written.

Maybe this is also specific to the interaction between OpenOCD and stdio_rtt and jlink is a bit more eager in extracting data?

Versions

Current master, but the issue is not new.

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

No branches or pull requests

2 participants