From 727108edeb96e0b534c86d52ad3f7515b26c1798 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Fri, 3 Jan 2020 16:09:53 +0100 Subject: [PATCH] common: Move panic handler out of libcommon. This allows us to do a native build of libcommon which is useful for unit testing. --- src/application/main.rs | 7 +++++++ src/bootloader/main.rs | 7 +++++++ src/common/lib.rs | 9 --------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/application/main.rs b/src/application/main.rs index b119503..4cad3e3 100644 --- a/src/application/main.rs +++ b/src/application/main.rs @@ -75,6 +75,13 @@ impl Timer { } } +#[inline(never)] +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop { + } +} + #[no_mangle] pub unsafe extern "C" fn _start() -> ! { clock::configure(); diff --git a/src/bootloader/main.rs b/src/bootloader/main.rs index 815429e..2ce5980 100644 --- a/src/bootloader/main.rs +++ b/src/bootloader/main.rs @@ -83,6 +83,13 @@ fn bootloader_requested() -> bool { false } +#[inline(never)] +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop { + } +} + #[no_mangle] pub unsafe extern "C" fn _start() -> ! { watchdog::disable(); diff --git a/src/common/lib.rs b/src/common/lib.rs index e38ff52..69cd7be 100644 --- a/src/common/lib.rs +++ b/src/common/lib.rs @@ -43,12 +43,3 @@ pub mod display; pub mod gps; pub mod fmt; pub mod time; - -use core::panic::PanicInfo; - -#[inline(never)] -#[panic_handler] -fn panic(_info: &PanicInfo) -> ! { - loop { - } -} -- 2.30.2