cargo-embed icon indicating copy to clipboard operation
cargo-embed copied to clipboard

rtt enable questions

Open pdgilbert opened this issue 4 years ago • 1 comments

I have two simple questions about rtt for which I cannot find answers in the documentation. (Probably too simple to document, and not helped by my confused understanding of toml. Or possibly I have just not found it.)

I have some rprintln statements that amount to debugging info. These are the kind of statements that would typically be omitted in release mode, if it were not for the fact that most code has to be release mode to fit memory with bluepill. Everything seems to work ok when I cargo embed the code and then restart the MCU without an attached computer. That is, the rtt seems to get ignored or at least not be too concerned that the destination is not there. My question is whether there is a better/preferred way to do this, or is the design actually intend to do this automatically?

Secondly, I am trying to build examples, some that use rprintln and some that do not. If the code does not init rtt then cargo embed chokes if I my Embed.toml has

[default.rtt]
enabled = true

OTOH, for examples that use rprintln I do not get the rtt if I set enable=false. What is the cargo embed command line syntax for overriding the defaults in Embed.toml?

pdgilbert avatar May 14 '21 19:05 pdgilbert

I'm assuming you're using rtt-target. What happens if no debugger is connected depends on how you initialize RTT. If you look at rtt_init_print for example, you can specify the blocking mode. In non-blocking mode, messages will be discarded if the buffer on the MCU is full, in blocking mode the MCU will stop and wait until someone reads the messages.

There is no option to override the RTT option on the CLI, but you could create two different profiles, and then select the appropriate one.

Tiwalun avatar May 14 '21 19:05 Tiwalun