probe-rs / flash-algorithm-template

A template for writing CMSIS-Pack flash algorithms in Rust
Apache License 2.0
10 stars 7 forks source link

No RTT messages #3

Closed nilfit closed 1 year ago

nilfit commented 1 year ago

When running with cargo run, RTT messages are not printed.

Actual behavior:

Generating the YAML file in `"target/definition.yaml"`
Test: Erasing sectorwise and writing two pages ...
thread 'main' panicked at 'Not all sectors were erased'

Expected:

Generating the YAML file in `"target/definition.yaml"`
Test: Erasing sectorwise and writing two pages ...
Message: Init
Message: Erase sector addr:0
Message: Erase sector addr:8192
thread 'main' panicked at 'Not all sectors were erased'

This happens because target-gen disables the default rtt feature of probe-rs when installed according to the README.

cargo install target-gen

Installing target-gen with the feature enabled gives the expected behavior.

cargo install target-gen --features probe-rs/rtt

The README could be updated to suggest this, but I'm not sure if it makes more sense to change the default features of target-gen instead.

Yatekii commented 1 year ago

Hmm that's indeed bad. The rtt feature should be a default feature. Why is it not enabled. I will dig a bit :)

nilfit commented 1 year ago

target-gen opts out of default features: https://github.com/probe-rs/probe-rs/blob/dc5eb11ba23a5abfd1dd734385b93c7edd60f490/target-gen/Cargo.toml

elfmimi commented 1 year ago

Thanks. building target-gen locally with this change worked.

-probe-rs = { path = "../probe-rs", version = "0.19.0", default-features = false }
+probe-rs = { path = "../probe-rs", version = "0.19.0", default-features = false, features = [ "rtt" ] }