From 4754b66f72a8fbfd48e30ae0bd12a44d13a4ce10 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sun, 1 May 2022 17:50:00 +0200 Subject: initial commit Build small no_std example for rv64i target. This code executes some linux syscalls as demo and therefore expects to be executed in rv64 linux. --- src/main.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/main.rs (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..f1ea8b0 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,20 @@ +#![no_std] +#![no_main] + +use user_sw::{eprintln, println, sys}; + +fn main() { + println!("Hello {} from rust main().", 1337); +} + +#[no_mangle] +pub extern "C" fn _start() -> ! { + main(); + sys::exit(0); +} + +#[panic_handler] +fn panic_handler(info: &core::panic::PanicInfo) -> ! { + eprintln!("{}", info); + sys::exit(42); +} -- cgit v1.2.3