diff --git a/rust/src/.gitignore b/rust/.gitignore
similarity index 100%
rename from rust/src/.gitignore
rename to rust/.gitignore
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 4b1c24969be1c75d0c3139e236e92717a1827ad9..98c2bc9871d6a48d3252c4b23bd5bb6a297eeb0f 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -2,6 +2,15 @@
 name = "rust"
 version = "0.1.0"
 authors = ["pln <Per Lindgren>"]
-edition = "2018"
+# edition = "2018"
 
 [dependencies]
+
+[profile.dev]
+panic = "abort"
+
+[profile.release]
+panic = "abort"
+codegen-units = 1 # better optimizations
+debug = true # symbols are nice and they don't increase the size on Flash
+lto = true # better optimizations
\ No newline at end of file
diff --git a/rust/src/main.rs b/rust/src/main.rs
index 07c4d09ec945faa414595d663aa7f5e0ce150f47..a3edf80194f620fecab48dd618c6aca2684650d2 100644
--- a/rust/src/main.rs
+++ b/rust/src/main.rs
@@ -1,7 +1,25 @@
 #![no_std]
+#![feature(compiler_builtins_lib)]
+#![feature(lang_items)]
+#![feature(core_intrinsics)]
+#![no_main]
 
-//use core::ptr::read;
+use core::intrinsics;
+use core::panic::PanicInfo;
 
+#[panic_handler]
+fn panic(_info: &PanicInfo) -> ! {
+    unsafe { intrinsics::abort() }
+}
+
+#[inline(never)]
+fn f1() -> u32 {
+    0
+}
+
+#[no_mangle]
 fn main() {
-    
+    f1();
 }
+
+// cargo rustc --release -- -C linker=true --emit=llvm-ir,llvm-bc