rprint! adding newline
Opened this issue · 8 comments
Strange behaviour:
rprint!("rprint");
rprintln!("rprintln");
works as expected, output: rprintrprintln
.
But
rprint!("rprint");
Timer::after_millis(TIME).await; // use embassy_time::Timer;
rprintln!("rprintln");
adds a newline, depending on the value of TIME. Output:
rprintr
rprintln
when TIME is something above 270 (thereshold is changing from time to time).
This shows some more strange behaviour:
for _ in 0..100 {
Timer::after_millis(10).await;
rprint!(".");
}
Output:
.
.
.....
.....
.....
.
.....
.....
.....
.....
.
.....
.....
.
.....
.....
.....
.
.....
.....
.....
.
.....
.....
.....
.
..
Very mysterious. Which program on your computer are you using to look at the output?
I use both, cargo run
in a normal Linux Terminal and vscode (which also uses cargo in the background).
What do you have configured as the runner in .cargo/config.toml
? Is it probe-rs run or?
runner = 'probe-rs run --chip <chip-name>'
From the original posting, I think what is happening is that somewhere between rtt-target
and probe-rs
, a newline is added after every write of String RTT data to the client (Terminal or VSCode). I'll have to look through the code to confirm, but I think what happens is the process reads all the data available in the target RTT buffer, and sends it to the output with a newline at the end of it, then goes back to look for more data.
- If the data comes in during a single buffer read , e.g. "rprintrprintln", then it will send that to the output.
- If the data comes in the first buffer read having "rprint", it will process it, and then look again, and find the slightly delayed "rprintln" and send that on another (new) line.
Were you able to reproduce the problem?
My config.toml
has this line, yes:
runner = [ "probe-rs", "run", "--chip", "STM32H730VBTx"]
and I can also run probe-rs run --chip STM32H730VBTx target/thumbv7em-none-eabihf/debug/pintest
on the terminal and have this effect.
I put up a minimum (?) working project that shows this behaviour.
rprinttest.zip