To write a bare-metal Rust application, create a project with no_std, define a #[panic_handler], and implement a #[no_mangle] entry point that loops infinitely.
#![no_std]
#![no_main]
use core::panic::PanicInfo;
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
#[no_mangle]
pub extern "C" fn _start() -> ! {
loop {}
}
Add panic = "abort" to your Cargo.toml under [profile.dev] and [profile.release] to avoid linking the unwinder.