Skip to content

Commit

Permalink
Use panic-rtt-target when using rtt
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Nov 20, 2024
1 parent b85f35c commit f5ba2b8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[target.xtensa-esp32s3-none-elf]
runner = "probe-rs run --preverify"
runner = "probe-rs run --preverify --always-print-stacktrace"
#runner = "espflash flash -M --erase-parts=otadata --log-format=defmt -T partitions.csv -s 8mb"
rustflags = [
"-C", "link-arg=-nostartfiles",
"-C", "link-arg=-Wl,-Tlinkall.x",
]

[target.riscv32imac-unknown-none-elf]
runner = "probe-rs run --preverify"
runner = "probe-rs run --preverify --always-print-stacktrace"
#runner = "espflash flash -M --erase-parts=otadata --log-format=defmt -T partitions.csv -s 8mb"
rustflags = [
"-C", "force-frame-pointers",
Expand Down
16 changes: 9 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ embassy-executor = { workspace = true, features = ["nightly"] }
embassy-time = { version = "0.3.0" }

embedded-hal-old = { package = "embedded-hal", version = "0.2.7" }
rtt-target = { version = "0.6.0", git = "https://github.com/probe-rs/rtt-target", optional = true }
rtt-target = { version = "0.6.0", git = "https://github.com/probe-rs/rtt-target", branch = "prep", optional = true }
panic-rtt-target = { version = "0.2.0", git = "https://github.com/probe-rs/rtt-target", branch = "prep", optional = true }

esp-hal = { version = "0.22.0" }
esp-hal-embassy = { version = "0.5.0" }
esp-backtrace = { version = "0.14.2", features = [
esp-backtrace = { version = "0.14.2", optional = true, features = [
"panic-handler",
"exception-handler"
] }
Expand Down Expand Up @@ -144,7 +145,7 @@ esp32s3 = [
"esp-hal/esp32s3",
"embassy-executor/integrated-timers",
"dep:norfs-esp32s3",
"esp-backtrace/esp32s3",
"esp-backtrace?/esp32s3",
"esp-wifi/esp32s3",
"esp-hal-embassy/esp32s3",
"esp-println?/esp32s3",
Expand All @@ -153,7 +154,7 @@ esp32c6 = [
"esp-hal/esp32c6",
"embassy-time/generic-queue-8",
"dep:norfs-esp32c6",
"esp-backtrace/esp32c6",
"esp-backtrace?/esp32c6",
"esp-wifi/esp32c6",
"esp-hal-embassy/esp32c6",
"esp-println?/esp32c6",
Expand All @@ -168,7 +169,7 @@ defmt = [
"embedded-graphics/defmt",
"esp-wifi/defmt",
"esp-hal/defmt",
"esp-backtrace/defmt",
"esp-backtrace?/defmt",
"esp-println?/defmt-espflash",

"logger/defmt",
Expand All @@ -184,10 +185,11 @@ defmt = [
"embassy-net/defmt",
"smoltcp/defmt",
"rtt-target?/defmt",
"panic-rtt-target?/defmt",
]

rtt = ["dep:rtt-target"]
esp-println = ["dep:esp-println", "esp-println/jtag-serial"]
rtt = ["dep:panic-rtt-target", "dep:rtt-target"]
esp-println = ["dep:esp-backtrace", "dep:esp-println", "esp-println/jtag-serial"]

[package.metadata.espflash]
partition_table = "partitions.csv"
Expand Down
4 changes: 4 additions & 0 deletions src/board/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ pub mod storage;
pub mod utils;
pub mod wifi;

#[cfg(feature = "esp-println")]
use esp_backtrace as _;

#[cfg(feature = "rtt")]
use panic_rtt_target as _;

pub use hardware::*;

pub const DEFAULT_BACKEND_URL: &str = "https://stingray-prime-monkey.ngrok-free.app";
Expand Down
14 changes: 2 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,8 @@ where

#[main]
async fn main(_spawner: Spawner) {
#[cfg(feature = "rtt")]
{
let channels = rtt_target::rtt_init! {
up: {
0: {
size: 1024,
name: "defmt"
}
}
};
rtt_target::set_defmt_channel(channels.up.0);
}
#[cfg(all(feature = "rtt", feature = "defmt"))]
rtt_target::rtt_init_defmt!();

esp_alloc::heap_allocator!((48 + 96) * 1024);

Expand Down

0 comments on commit f5ba2b8

Please sign in to comment.