439439
440440extern crate cortex_m_rt_macros as macros;
441441
442- use core:: arch:: global_asm;
443442use core:: fmt;
444- use core:: sync:: atomic:: { self , Ordering } ;
443+ #[ cfg( cortex_m) ]
444+ use core:: arch:: global_asm;
445445
446446// HardFault exceptions are bounced through this trampoline which grabs the stack pointer at
447447// the time of the exception and passes it to th euser's HardFault handler in r0.
448448// Depending on the stack mode in EXC_RETURN, fetches stack from either MSP or PSP.
449+ #[ cfg( cortex_m) ]
449450global_asm ! (
450451 ".cfi_sections .debug_frame
451452 .section .HardFaultTrampoline, \" ax\"
@@ -468,6 +469,7 @@ global_asm!(
468469) ;
469470
470471/// Parse cfg attributes inside a global_asm call.
472+ #[ cfg( cortex_m) ]
471473macro_rules! cfg_global_asm {
472474 { @inner, [ $( $x: tt) * ] , } => {
473475 global_asm!{ $( $x) * }
@@ -490,6 +492,7 @@ macro_rules! cfg_global_asm {
490492// Calls an optional user-provided __pre_init and then initialises RAM.
491493// If the target has an FPU, it is enabled.
492494// Finally jumsp to the user main function.
495+ #[ cfg( cortex_m) ]
493496cfg_global_asm ! {
494497 ".cfi_sections .debug_frame
495498 .section .Reset, \" ax\"
@@ -1048,12 +1051,14 @@ pub static __RESET_VECTOR: unsafe extern "C" fn() -> ! = Reset;
10481051#[ cfg_attr( cortex_m, link_section = ".HardFault.default" ) ]
10491052#[ no_mangle]
10501053pub unsafe extern "C" fn HardFault_ ( ef : & ExceptionFrame ) -> ! {
1054+ #[ allow( clippy:: empty_loop) ]
10511055 loop { }
10521056}
10531057
10541058#[ doc( hidden) ]
10551059#[ no_mangle]
10561060pub unsafe extern "C" fn DefaultHandler_ ( ) -> ! {
1061+ #[ allow( clippy:: empty_loop) ]
10571062 loop { }
10581063}
10591064
0 commit comments