remove rtt feature

This commit is contained in:
Robert Jördens 2021-05-13 11:14:03 +02:00
parent 5b616a2874
commit 401e1b0681
4 changed files with 26 additions and 40 deletions

24
Cargo.lock generated
View File

@ -517,16 +517,6 @@ dependencies = [
"autocfg",
]
[[package]]
name = "panic-rtt-target"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d6ab67bc881453e4c90f958c657c1303670ea87bc1a16e87fd71a40f656dce9"
dependencies = [
"cortex-m 0.7.2",
"rtt-target 0.3.1",
]
[[package]]
name = "paste"
version = "1.0.5"
@ -633,7 +623,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d082d3a20a5d4f69ad509720de1777fe5aa2092ea1af51b254ff79113d46d2ea"
dependencies = [
"log",
"rtt-target 0.2.2",
"rtt-target",
]
[[package]]
@ -646,15 +636,6 @@ dependencies = [
"ufmt-write",
]
[[package]]
name = "rtt-target"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "065d6058bb1204f51a562a67209e1817cf714759d5cf845aa45c75fa7b0b9d9b"
dependencies = [
"ufmt-write",
]
[[package]]
name = "rustc_version"
version = "0.2.3"
@ -767,10 +748,9 @@ dependencies = [
"miniconf",
"minimq",
"nb 1.0.0",
"panic-rtt-target",
"paste",
"rtt-logger",
"rtt-target 0.2.2",
"rtt-target",
"serde",
"serde-json-core",
"shared-bus",

View File

@ -31,9 +31,8 @@ members = ["ad9959", "dsp"]
cortex-m = { version = "0.6", features = ["const-fn"] }
cortex-m-rt = { version = "0.6", features = ["device"] }
log = { version = "0.4", features = ["max_level_trace", "release_max_level_info"] }
rtt-target = { version = "0.2.1", features = ["cortex-m"], optional = true }
panic-rtt-target = { version = "0.1.1", features = ["cortex-m"], optional = true }
rtt-logger = { version = "0.1", optional = true }
rtt-target = { version = "0.2.1", features = ["cortex-m"] }
rtt-logger = { version = "0.1" }
serde = { version = "1.0", features = ["derive"], default-features = false }
heapless = { version = "0.6", features = ["serde"] }
cortex-m-rtic = "0.5.6"
@ -70,7 +69,6 @@ git = "https://github.com/quartiq/minimq.git"
rev = "d2ec3e8"
[features]
rtt = [ "rtt-target", "panic-rtt-target", "rtt-logger" ]
bkpt = [ ]
nightly = ["cortex-m/inline-asm", "dsp/nightly"]
pounder_v1_1 = [ ]

View File

@ -145,21 +145,19 @@ pub fn setup(
.pll2_q_ck(100.mhz())
.freeze(vos, &device.SYSCFG);
#[cfg(feature = "rtt")]
// Set up RTT logging
{
// Enable debug during WFE/WFI-induced sleep
device.DBGMCU.cr.modify(|_, w| w.dbgsleep_d1().set_bit());
use log::LevelFilter;
use rtt_logger::RTTLogger;
use rtt_target::rtt_init_print;
static LOGGER: RTTLogger = RTTLogger::new(LevelFilter::Info);
rtt_init_print!(NoBlockSkip, 1024);
static LOGGER: RTTLogger = RTTLogger::new(log::LevelFilter::Info);
rtt_target::rtt_init_print!(NoBlockSkip, 1024);
log::set_logger(&LOGGER)
.map(|()| log::set_max_level(log::LevelFilter::Trace))
.unwrap();
log::info!("Setup...");
log::info!("Starting...");
}
// Set up the system timer for RTIC scheduling.

View File

@ -54,21 +54,31 @@ pub type EthernetPhy = hal::ethernet::phy::LAN8742A<hal::ethernet::EthernetMAC>;
pub use configuration::{setup, PounderDevices, StabilizerDevices};
#[cfg(feature = "rtt")]
use panic_rtt_target as _;
#[inline(never)]
#[panic_handler]
#[cfg(all(not(feature = "rtt")))]
fn panic(_info: &core::panic::PanicInfo) -> ! {
fn panic(info: &core::panic::PanicInfo) -> ! {
use core::{
fmt::Write,
sync::atomic::{compiler_fence, Ordering::SeqCst},
};
use cortex_m::interrupt;
use rtt_target::{ChannelMode, UpChannel};
interrupt::disable();
let gpiod = unsafe { &*hal::stm32::GPIOD::ptr() };
// Turn on both red LEDs, FP_LED_1, FP_LED_3
gpiod.odr.modify(|_, w| w.odr6().high().odr12().high());
// Analogous to panic-rtt-target
if let Some(mut channel) = unsafe { UpChannel::conjure(0) } {
channel.set_mode(ChannelMode::BlockIfFull);
writeln!(channel, "{}", info).ok();
}
loop {
// Halt
core::sync::atomic::compiler_fence(
core::sync::atomic::Ordering::SeqCst,
);
compiler_fence(SeqCst);
}
}