diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..cac83ac --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,4 @@ +[build] +target = "avr-specs/avr-atmega328p.json" +[unstable] +build-std = ["core"] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a9d37c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..db5bba8 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,23 @@ +[package] +edition = "2021" +name = "embassy-avr-as5600-encoder" +version = "0.1.0" +authors = ["brainstorm "] +resolver = "2" + +[dependencies] +panic-halt = "0.2" +embassy-executor = { git = "https://github.com/embassy-rs/embassy", features = ["arch-avr", "nightly", "executor-thread"] } +avr-device = { version = "0.5", features = ["atmega328p", "rt"] } +as5600 = "0.6.0" + +[profile.dev] +panic = "abort" +lto = true +opt-level = "s" + +[profile.release] +panic = "abort" +codegen-units = 1 +lto = true +opt-level = "s" diff --git a/avr-specs/avr-atmega328p.json b/avr-specs/avr-atmega328p.json new file mode 100644 index 0000000..7d7d82c --- /dev/null +++ b/avr-specs/avr-atmega328p.json @@ -0,0 +1,25 @@ +{ + "arch": "avr", + "atomic-cas": false, + "cpu": "atmega328p", + "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", + "eh-frame-header": false, + "exe-suffix": ".elf", + "late-link-args": { + "gcc": [ + "-lgcc" + ] + }, + "linker": "avr-gcc", + "llvm-target": "avr-unknown-unknown", + "max-atomic-width": 8, + "no-default-libraries": false, + "pre-link-args": { + "gcc": [ + "-mmcu=atmega328p" + ] + }, + "relocation-model": "static", + "target-c-int-width": "16", + "target-pointer-width": "16" +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..cd4305f --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "nightly" +components = ["rust-src"] +profile = "minimal" diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..6fc30c1 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,11 @@ +#![no_std] +#![no_main] + +use panic_halt as _; + +use embassy_executor::Spawner; + +#[embassy_executor::main] +async fn main(_spawner: Spawner) { + loop {} +}