From: Tilman Sauerbeck Date: Fri, 3 Jan 2020 15:09:53 +0000 (+0100) Subject: common: Move panic handler out of libcommon. X-Git-Url: http://git.code-monkey.de/?p=gps-watch.git;a=commitdiff_plain;h=727108edeb96e0b534c86d52ad3f7515b26c1798 common: Move panic handler out of libcommon. This allows us to do a native build of libcommon which is useful for unit testing. --- 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 { - } -}