From bbc2436cc3a19c5b6e022ce67565a480f6befbf1 Mon Sep 17 00:00:00 2001 From: t-moe Date: Wed, 27 Dec 2023 14:16:32 +0100 Subject: [PATCH] Fixes from review --- CHANGELOG.md | 2 ++ firmware/defmt-test/CHANGELOG.md | 3 +++ firmware/defmt-test/src/export.rs | 4 +--- firmware/panic-probe/Cargo.toml | 2 +- firmware/panic-probe/README.md | 8 +------- firmware/panic-probe/src/lib.rs | 19 ++++++++++++------- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fa144af..5e65e6d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] - [#789]: `defmt`: Add support for new time-related display hints +- [#796]: `panic-probe`: Add `print-log` feature [#789]: https://github.com/knurling-rs/defmt/pull/789 +[#796]: https://github.com/knurling-rs/defmt/pull/796 ## defmt-decoder v0.3.9, defmt-print v0.3.10 - 2023-10-04 diff --git a/firmware/defmt-test/CHANGELOG.md b/firmware/defmt-test/CHANGELOG.md index b1a6664d..143c79e6 100644 --- a/firmware/defmt-test/CHANGELOG.md +++ b/firmware/defmt-test/CHANGELOG.md @@ -1,6 +1,9 @@ # [Unreleased] + - [#796] Add support for risc-v +[#796]: https://github.com/knurling-rs/defmt/pull/796 + # [v0.3.1] - [#786]: `defmt-test`: Exit with semihosting exit diff --git a/firmware/defmt-test/src/export.rs b/firmware/defmt-test/src/export.rs index 663300e0..c78093d3 100644 --- a/firmware/defmt-test/src/export.rs +++ b/firmware/defmt-test/src/export.rs @@ -5,9 +5,7 @@ use crate::TestOutcome; /// Terminates the application and makes a semihosting-capable debug tool exit /// with status code 0. pub fn exit() -> ! { - loop { - semihosting::process::exit(0); - } + semihosting::process::exit(0); } pub fn check_outcome(outcome: T, should_error: bool) { diff --git a/firmware/panic-probe/Cargo.toml b/firmware/panic-probe/Cargo.toml index f213239a..43626ade 100644 --- a/firmware/panic-probe/Cargo.toml +++ b/firmware/panic-probe/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" name = "panic-probe" readme = "README.md" repository = "https://github.com/knurling-rs/defmt" -version = "0.4.0" +version = "0.3.1" [dependencies] defmt = { version = "0.3", path = "../../defmt", optional = true } diff --git a/firmware/panic-probe/README.md b/firmware/panic-probe/README.md index 2a55ae7b..211bf8db 100644 --- a/firmware/panic-probe/README.md +++ b/firmware/panic-probe/README.md @@ -4,17 +4,11 @@ [`probe-rs`]: https://github.com/probe-rs/probe-rs -`panic-probe` can optionally log the panic message. Enabled one of the following features for that: +`panic-probe` can optionally log the panic message. Enable one of the following features for that: * `print-defmt` to print via `defmt::error!(..)` * `print-log` to print via `log::error!(..)` * `print-rtt` to print via `rtt_target::rprintln(..)` - - using the [`defmt`] logging framework. -This functionality can be enabled through the `print-defmt` Cargo feature. - -[`defmt`]: https://github.com/knurling-rs/defmt - ## Support `panic-probe` is part of the [Knurling] project, [Ferrous Systems]' effort at diff --git a/firmware/panic-probe/src/lib.rs b/firmware/panic-probe/src/lib.rs index 75b60492..e470e110 100644 --- a/firmware/panic-probe/src/lib.rs +++ b/firmware/panic-probe/src/lib.rs @@ -75,16 +75,21 @@ pub fn abort() -> ! { semihosting::process::abort(); } -#[cfg(target_os = "none")] -pub fn disable_isr() { - #[cfg(cortex_m)] +#[cfg(target_arch = "riscv32")] +pub fn riscv32_disable_isr() { + unsafe { riscv::interrupt::disable() }; +} +#[cfg(target_arch = "riscv32")] +use crate::riscv32_disable_isr as disable_isr; + +#[cfg(cortex_m)] +pub fn cortex_m_disable_isr() { cortex_m::interrupt::disable(); - #[cfg(target_arch = "riscv32")] - unsafe { - riscv::interrupt::disable() - }; } +#[cfg(cortex_m)] +use crate::cortex_m_disable_isr as disable_isr; + #[cfg(feature = "print-rtt")] mod print_rtt { use core::panic::PanicInfo;