template
This commit is contained in:
commit
54ab1ba86d
13 changed files with 280 additions and 0 deletions
8
.cargo/config.toml
Normal file
8
.cargo/config.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[build]
|
||||||
|
target = "avr-specs/avr-atmega328p.json"
|
||||||
|
|
||||||
|
[target.'cfg(target_arch = "avr")']
|
||||||
|
runner = "ravedude uno -cb 57600"
|
||||||
|
|
||||||
|
[unstable]
|
||||||
|
build-std = ["core"]
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target
|
40
Cargo.toml
Normal file
40
Cargo.toml
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
[package]
|
||||||
|
name = "pick-n-place"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Andy Killorin <37423245+Speedy6451@users.noreply.github.com>"]
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "pick-n-place"
|
||||||
|
test = false
|
||||||
|
bench = false
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
panic-halt = "0.2.0"
|
||||||
|
ufmt = "0.2.0"
|
||||||
|
nb = "0.1.2"
|
||||||
|
embedded-hal = "0.2.3"
|
||||||
|
|
||||||
|
[dependencies.arduino-hal]
|
||||||
|
git = "https://github.com/rahix/avr-hal"
|
||||||
|
rev = "3e362624547462928a219c40f9ea8e3a64f21e5f"
|
||||||
|
features = ["arduino-uno"]
|
||||||
|
|
||||||
|
# The latest releases of `proc-macro2` do not support the rust toolchain that
|
||||||
|
# we use. Thus, we must fix this dependency to an older version where our
|
||||||
|
# toolchain is still supported. See https://github.com/Rahix/avr-hal/issues/537
|
||||||
|
[build-dependencies.proc-macro2]
|
||||||
|
version = "=1.0.79"
|
||||||
|
|
||||||
|
# Configure the build for minimal size - AVRs have very little program memory
|
||||||
|
[profile.dev]
|
||||||
|
panic = "abort"
|
||||||
|
lto = true
|
||||||
|
opt-level = "s"
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
panic = "abort"
|
||||||
|
codegen-units = 1
|
||||||
|
debug = true
|
||||||
|
lto = true
|
||||||
|
opt-level = "s"
|
25
avr-specs/avr-atmega1280.json
Normal file
25
avr-specs/avr-atmega1280.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"arch": "avr",
|
||||||
|
"atomic-cas": false,
|
||||||
|
"cpu": "atmega1280",
|
||||||
|
"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=atmega1280"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"relocation-model": "static",
|
||||||
|
"target-c-int-width": "16",
|
||||||
|
"target-pointer-width": "16"
|
||||||
|
}
|
25
avr-specs/avr-atmega168.json
Normal file
25
avr-specs/avr-atmega168.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"arch": "avr",
|
||||||
|
"atomic-cas": false,
|
||||||
|
"cpu": "atmega168",
|
||||||
|
"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=atmega168"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"relocation-model": "static",
|
||||||
|
"target-c-int-width": "16",
|
||||||
|
"target-pointer-width": "16"
|
||||||
|
}
|
25
avr-specs/avr-atmega2560.json
Normal file
25
avr-specs/avr-atmega2560.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"arch": "avr",
|
||||||
|
"atomic-cas": false,
|
||||||
|
"cpu": "atmega2560",
|
||||||
|
"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=atmega2560"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"relocation-model": "static",
|
||||||
|
"target-c-int-width": "16",
|
||||||
|
"target-pointer-width": "16"
|
||||||
|
}
|
25
avr-specs/avr-atmega328p.json
Normal file
25
avr-specs/avr-atmega328p.json
Normal file
|
@ -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"
|
||||||
|
}
|
25
avr-specs/avr-atmega32u4.json
Normal file
25
avr-specs/avr-atmega32u4.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"arch": "avr",
|
||||||
|
"atomic-cas": false,
|
||||||
|
"cpu": "atmega32u4",
|
||||||
|
"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=atmega32u4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"relocation-model": "static",
|
||||||
|
"target-c-int-width": "16",
|
||||||
|
"target-pointer-width": "16"
|
||||||
|
}
|
25
avr-specs/avr-atmega48p.json
Normal file
25
avr-specs/avr-atmega48p.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"arch": "avr",
|
||||||
|
"atomic-cas": false,
|
||||||
|
"cpu": "atmega48p",
|
||||||
|
"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=atmega48p"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"relocation-model": "static",
|
||||||
|
"target-c-int-width": "16",
|
||||||
|
"target-pointer-width": "16"
|
||||||
|
}
|
25
avr-specs/avr-attiny85.json
Normal file
25
avr-specs/avr-attiny85.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"arch": "avr",
|
||||||
|
"atomic-cas": false,
|
||||||
|
"cpu": "attiny85",
|
||||||
|
"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=attiny85"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"relocation-model": "static",
|
||||||
|
"target-c-int-width": "16",
|
||||||
|
"target-pointer-width": "16"
|
||||||
|
}
|
25
avr-specs/avr-attiny88.json
Normal file
25
avr-specs/avr-attiny88.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"arch": "avr",
|
||||||
|
"atomic-cas": false,
|
||||||
|
"cpu": "attiny88",
|
||||||
|
"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=attiny88"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"relocation-model": "static",
|
||||||
|
"target-c-int-width": "16",
|
||||||
|
"target-pointer-width": "16"
|
||||||
|
}
|
4
rust-toolchain.toml
Normal file
4
rust-toolchain.toml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[toolchain]
|
||||||
|
channel = "nightly-2024-03-22"
|
||||||
|
components = ["rust-src"]
|
||||||
|
profile = "minimal"
|
27
src/main.rs
Normal file
27
src/main.rs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
use panic_halt as _;
|
||||||
|
|
||||||
|
#[arduino_hal::entry]
|
||||||
|
fn main() -> ! {
|
||||||
|
let dp = arduino_hal::Peripherals::take().unwrap();
|
||||||
|
let pins = arduino_hal::pins!(dp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For examples (and inspiration), head to
|
||||||
|
*
|
||||||
|
* https://github.com/Rahix/avr-hal/tree/main/examples
|
||||||
|
*
|
||||||
|
* NOTE: Not all examples were ported to all boards! There is a good chance though, that code
|
||||||
|
* for a different board can be adapted for yours. The Arduino Uno currently has the most
|
||||||
|
* examples available.
|
||||||
|
*/
|
||||||
|
|
||||||
|
let mut led = pins.d13.into_output();
|
||||||
|
|
||||||
|
loop {
|
||||||
|
led.toggle();
|
||||||
|
arduino_hal::delay_ms(1000);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue