From fd9edad00f5c3b6ff0a678c67fb6fc23d57d2df0 Mon Sep 17 00:00:00 2001 From: kirbylife Date: Mon, 21 Nov 2022 00:38:10 -0600 Subject: [PATCH] Initial commit --- .gitignore | 6 ++++++ Cargo.toml | 9 +++++++++ avr-atmega328p.json | 30 ++++++++++++++++++++++++++++++ src/main.rs | 15 +++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 Cargo.toml create mode 100644 avr-atmega328p.json create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore index 3ca43ae..776164c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,9 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb +# hex output +*.hex + +# Added by cargo + +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..acff39b --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "arduino_blinkrs" +version = "0.1.0" +edition = "2021" + +[dependencies] + +[profile.release] +lto = true \ No newline at end of file diff --git a/avr-atmega328p.json b/avr-atmega328p.json new file mode 100644 index 0000000..4898248 --- /dev/null +++ b/avr-atmega328p.json @@ -0,0 +1,30 @@ +{ + "arch": "avr", + "cpu": "atmega328p", + "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", + "env": "", + "executables": true, + "linker": "avr-gcc", + "linker-flavor": "gcc", + "linker-is-gnu": true, + "llvm-target": "avr-unknown-unknown", + "os": "unknown", + "position-independent-executables": false, + "exe-suffix": ".elf", + "eh-frame-header": false, + "pre-link-args": { + "gcc": [ + "-mmcu=atmega328p" + ] + }, + "late-link-args": { + "gcc": [ + "-lgcc", + "-lc" + ] + }, + "target-c-int-width": "16", + "target-endian": "little", + "target-pointer-width": "16", + "vendor": "unknown" +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..3dc92e1 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,15 @@ +#![feature(lang_items)] +#![allow(improper_ctypes_definitions)] +#![no_std] +#![no_main] + +#[no_mangle] +pub extern "C" fn main() {} + +#[lang = "eh_personality"] +pub unsafe extern "C" fn rust_eh_personality() -> () {} + +#[lang = "panic_impl"] +fn panic(_info: &::core::panic::PanicInfo) -> ! { + loop {} +}