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

Unable to use Defmt logging

Open seanybaggins opened this issue 3 years ago • 3 comments

Unable to use the Defmt logging.

Steps to reproduce the behavior: My Embed.toml

[default.general]
chip = "STM32F303VCTx"

[default.rtt]
enable = true

channels = [
    { up = 0, name = "defmt_rtt", format = "Defmt" },
]

cargo embed --version

cargo-embed 0.10.1
git commit: crates.io

Error message from running cargo embed

       Error The config 'default' could not be loaded.
             
             Caused by:
                 enum DataFormat does not have variant constructor Defmt

Looking in my ~/.cargo/registry/src/github.com-xxxxxxxxxxx/cargo-embed-0.10.1/src/rttui/channel.rs file.

#[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize)]
pub enum DataFormat {
    String,
    BinaryLE,
}

This seems to contradict the change log, default.toml and the source code in the master branch. It should be

#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub enum DataFormat {
    String,
    BinaryLE,
    Defmt,
}

I tried to install cargo embed using

cargo install --git https://github.com/probe-rs/cargo-embed.git --branch master

but ran into issue #189.

seanybaggins avatar Feb 18 '21 17:02 seanybaggins

Sorry for the inconvenience! 0.10 does not have defmt logging :)

Building against probe-rs master is fixed with this PR: https://github.com/probe-rs/cargo-embed/pull/190 I hope to merge it today. You can try that branch :)

Yatekii avatar Feb 18 '21 18:02 Yatekii

So I installed against the branch you suggested. I was able to install but now I am unable to launch a rtt terminal.

Using cargo embed I get

Config default
      Target ${SOME_DIR}/ipendulum/implementation/target/thumbv7em-none-eabihf/debug/implementation
     Erasing sectors ✔ [00:00:02] [####################################################################]  46.00KB/ 46.00KB @  22.89KB/s (eta 0s )
 Programming pages   ✔ [00:00:04] [####################################################################]  45.00KB/ 45.00KB @   7.10KB/s (eta 0s )
    Finished flashing in 6.225s
        Done processing config default

and then I get put into my regular shell.

Here is my Embed.toml

 [default.general]
chip = "STM32F303VCTx"

[default.rtt]
enable = true

channels = [
    { up = 0, name = "defmt_rtt", format = "Defmt" },
]

seanybaggins avatar Feb 22 '21 18:02 seanybaggins

Does it just hang here? I hope I can test it n the evening :)

Yatekii avatar Feb 24 '21 06:02 Yatekii