probe-rs/rtt-target

rtt_init_print!() macro pollutes scope

etiandre opened this issue · 2 comments

rtt_init_print!() (defined here) pollutes the scope of the function it's inserted into by creating a binding named channels.

If the user creates another binding with the same name, it shadows the macro's one, and breaks rtt_target.

The only error message displayed using cargo-embed is Failed to initialize RTT UI: No RTT channels configured.

edit: this may be more complicated than it appears, i'm using RTIC 0.5, the problem may be on their side.

Hmm, the macro shouldn't pollute the scope because of how hygiene works. If you put let _ = channels; right after the call, does that compile...?

If you're using RTIC you might be running to the wfi bug in STM32/probe-rs: probe-rs/probe-rs#350 (comment)

Yeah, seems I jumped to conclusions ! It doesn't appear to be the bug you linked either unfortunately. I'm having trouble reproducing the issue, for now it happens at random for me. I'll report back if I find something.