Post 1 - Freestanding Rust Binary

This commit is contained in:
2024-08-25 19:55:02 +02:00
parent 4c29f8e7c3
commit e2b1368e94
2 changed files with 31 additions and 0 deletions

14
blog_os/Cargo.toml Normal file
View File

@@ -0,0 +1,14 @@
[package]
name = "blog_os"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"

17
blog_os/src/main.rs Normal file
View File

@@ -0,0 +1,17 @@
#![no_std] // don't link the Rust standard library
#![no_main] // disable all Rust-level entry points
use core::panic::PanicInfo;
#[no_mangle] // don't mangle the name of this function
pub extern "C" fn _start() -> ! {
// this function is the entry point, since the linker looks for a function
// named `_start` by default
loop {}
}
/// This function is called on panic.
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}