From 8d88b46702cbbfa3cbde1e1c4edb0c4a2d9ba5a3 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 9 Jul 2019 09:42:41 -0700 Subject: [PATCH] Freestanding binary --- Cargo.toml | 7 +++++++ src/main.rs | 15 +++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3c6a779..2abc2e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,4 +4,11 @@ version = "0.1.0" authors = ["greg "] edition = "2018" +[profile.dev] +panic = "abort" + +[profile.release] +panic = "abort" + [dependencies] + diff --git a/src/main.rs b/src/main.rs index e7a11a9..3a00d98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,14 @@ -fn main() { - println!("Hello, world!"); +#![no_std] +#![no_main] + +use core::panic::PanicInfo; + +#[panic_handler] +fn panic(_info: &PanicInfo) -> !{ + loop {} +} + +#[no_mangle] +pub extern "C" fn _start() -> ! { + loop {} }