rust-embedded / rust-embedded/cortex-m
iprintln!() fails to print after printing certain amount of data
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1k
- Forks
- 202
- Avg merge
- 6d 2h
- Merged PRs (30d)
- 2
Description
Hello 🦀, when running the program below that repeatedly calls iprintln!(), it always stops printing at the same point in code, not finishing the printing tasks. It should print "Hello World ~" 77 times in a loop, but the program always stops printing in the middle of 26th invocation of iprintln!().
#[entry]
fn main() -> ! {
if let (Some(dp), Some(mut cp)) = (
stm32::Peripherals::take(),
cortex_m::peripheral::Peripherals::take(),
) {
// Set up the system clock. We want to run at 168MHz for this one.
let rcc = dp.RCC.constrain();
let clocks = rcc.cfgr.sysclk(168.mhz()).freeze();
let mut itm = cp.ITM;
for i in 0..77 {
iprintln!(&mut itm.stim[0], "Hello World for the {}-th time", i);
}
loop {
continue;
}
}
// Failed to access peripherals..
panic!();
}
logs from ITM are stored locally in itm.txt, and the log is always the same as below
(no matter how many times I try running).
Hello World for the 0-th time
Hello World for the 1-th time
Hello World for the 2-th time
Hello World for the 3-th time
Hello World for the 4-th time
Hello World for the 5-th time
Hello World for the 6-th time
Hello World for the 7-th time
Hello World for the 8-th time
Hello World for the 9-th time
Hello World for the 10-th time
Hello World for the 11-th time
Hello World for the 12-th time
Hello World for the 13-th time
Hello World for the 14-th time
Hello World for the 15-th time
Hello World for the 16-th time
Hello World for the 17-th time
Hello World for the 18-th time
Hello World for the 19-th time
Hello World for the 20-th time
Hello World for the 21-th time
Hello World for the 22-th time
Hello World for the 23-th time
Hello World for the 24-th time
Hello World
Is there a maximum limit of data that iprintln! can send in total?
If not, I guess this should be considered a bug..
Metadata
- I used
stm32f407g-disc1board to run this program. rustc --version --verbose
rustc 1.46.0-nightly (feb3536eb 2020-06-09)
binary: rustc
commit-hash: feb3536eba10c2e4585d066629598f03d5ddc7c6
commit-date: 2020-06-09
host: x86_64-unknown-linux-gnu
release: 1.46.0-nightly
LLVM version: 10.0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided #[entry] example on the stm32f407g-disc1 and inspect iprintln! output through itm.stim[0]. Reproduce the fixed truncation after the 25th complete message, then identify why the remaining loop output is lost and verify that all 77 messages are captured.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100