1
0
Fork 0

Fix nix build to compilation error at Check Phase

- "panic_handler" should not be declared during test
- "main" and "std" are needed during test
fix_nix_build_compilation
linuswck 2023-12-15 13:11:05 +08:00
parent 1b3b121a2d
commit f2b419f8d0
1 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,5 @@
#![no_main]
#![no_std]
#![cfg_attr(not(test), no_main)]
#![cfg_attr(not(test), no_std)]
use cortex_m_rt::entry;
use log::info;
@ -10,21 +10,22 @@ mod laser_diode;
use device::{boot::bootup, log_setup, sys_timer};
// If RTT is used, print panic info through RTT
#[cfg(feature = "RTT")]
#[cfg(all(feature = "RTT", not(test)))]
use {
core::panic::PanicInfo,
rtt_target::rprintln,
};
#[cfg(feature = "RTT")]
#[cfg(all(feature = "RTT", not(test)))]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
rprintln!("{}", info);
loop {}
}
// Otherwise use panic halt
#[cfg(not(feature = "RTT"))]
#[cfg(all(not(feature = "RTT"), not(test)))]
use panic_halt as _;
#[cfg(not(test))]
#[entry]
fn main() -> ! {