refine panic handler and add some logging info

This commit is contained in:
Robert Jördens 2021-05-13 15:18:22 +02:00
parent 6cd5c4182a
commit 18a8053cab
4 changed files with 21 additions and 11 deletions

View File

@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
* Const generics, bumping the MSRV to 1.51.0
* `lockin-internal` and `lockin-external` have been merged into `lockin`
* Default target CPU is cortex-m7, effective bumping the MSRV to 1.52.0
* Set target CPU to cortex-m7, effectively bumping the MSRV to 1.52.0
### Fixed

View File

@ -10,7 +10,7 @@
## Applications
This firmware offers a library of hardware and software functionality targeting the use of the Stabilizer hardware in various digital signal processing applications commonly occurring in Quantum Technology applications.
This firmware offers a library of hardware and software functionality targeting the use of the Stabilizer hardware in various digital signal processing applications commonly occurring in Quantum Technology.
It provides abstractions over the fast analog inputs and outputs, time stamping, Pounder DDS interfaces and a collection of tailored and optimized digital signal processing algorithms (IIR, FIR, Lockin, PLL, reciprocal PLL, Unwrapper, Lowpass, Cosine-Sine, Atan2).
An application can compose and configure these hardware and software components to implement different use cases.
Several applications are provides by default:

View File

@ -157,7 +157,7 @@ pub fn setup(
log::set_logger(&LOGGER)
.map(|()| log::set_max_level(log::LevelFilter::Trace))
.unwrap();
log::info!("Starting...");
log::info!("starting...");
}
// Set up the system timer for RTIC scheduling.
@ -537,6 +537,7 @@ pub fn setup(
&mut eeprom_i2c,
&mut delay,
));
log::info!("EUI48: {}", mac_addr);
let network_devices = {
// Configure the ethernet controller
@ -673,6 +674,7 @@ pub fn setup(
let pounder_pgood = gpiob.pb13.into_pull_down_input();
delay.delay_ms(2u8);
let pounder = if pounder_pgood.is_high().unwrap() {
log::info!("Found Pounder");
let ad9959 = {
let qspi_interface = {
// Instantiate the QUADSPI pins and peripheral interface.
@ -935,6 +937,7 @@ pub fn setup(
// info!("Version {} {}", build_info::PKG_VERSION, build_info::GIT_VERSION.unwrap());
// info!("Built on {}", build_info::BUILT_TIME_UTC);
// info!("{} {}", build_info::RUSTC_VERSION, build_info::TARGET);
log::info!("setup() complete");
// Enable the instruction cache.
core.SCB.enable_icache();

View File

@ -59,15 +59,22 @@ pub use configuration::{setup, PounderDevices, StabilizerDevices};
fn panic(info: &core::panic::PanicInfo) -> ! {
use core::{
fmt::Write,
sync::atomic::{compiler_fence, Ordering::SeqCst},
sync::atomic::{AtomicBool, Ordering},
};
use cortex_m::interrupt;
use cortex_m::asm;
use rtt_target::{ChannelMode, UpChannel};
interrupt::disable();
cortex_m::interrupt::disable();
// Recursion protection
static PANICKED: AtomicBool = AtomicBool::new(false);
while PANICKED.load(Ordering::Relaxed) {
asm::bkpt();
}
PANICKED.store(true, Ordering::Relaxed);
let gpiod = unsafe { &*hal::stm32::GPIOD::ptr() };
// Turn on both red LEDs, FP_LED_1, FP_LED_3
let gpiod = unsafe { &*hal::stm32::GPIOD::ptr() };
gpiod.odr.modify(|_, w| w.odr6().high().odr12().high());
// Analogous to panic-rtt-target
@ -76,10 +83,10 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
writeln!(channel, "{}", info).ok();
}
loop {
// Abort
asm::udf();
// Halt
compiler_fence(SeqCst);
}
// loop { core::sync::atomic::compiler_fence(Ordering::SeqCst); }
}
#[cortex_m_rt::exception]