-
Notifications
You must be signed in to change notification settings - Fork 885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[avr] create initial example #3696
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[build] | ||
target = "avr-unknown-gnu-atmega328" | ||
|
||
[target.'cfg(target_arch = "avr")'] | ||
runner = "ravedude uno -cb 57600" | ||
|
||
[unstable] | ||
build-std = ["core"] |
tones111 marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
edition = "2021" | ||
name = "embassy-avr-examples" | ||
version = "0.1.0" | ||
license = "MIT OR Apache-2.0" | ||
|
||
[dependencies] | ||
avr-device = { version = "0.6", features = ["atmega328p"] } | ||
embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-avr", "executor-thread", "nightly"] } | ||
panic-halt = "1" | ||
|
||
[profile.dev] | ||
panic = "abort" | ||
lto = true | ||
opt-level = "s" | ||
|
||
[profile.release] | ||
panic = "abort" | ||
codegen-units = 1 | ||
debug = true | ||
lto = true | ||
opt-level = "s" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Examples for AVR microcontrollers | ||
Run individual examples with | ||
``` | ||
cargo run --bin <module-name> --release | ||
``` | ||
for example | ||
``` | ||
cargo run --bin blinky | ||
``` | ||
|
||
## Checklist before running examples | ||
You may need to adjust `.cargo/config.toml`, `Cargo.toml` and possibly update pin numbers or peripherals to match the specific MCU or board you are using. | ||
|
||
* [ ] Update `.cargo/config.toml` with the correct target and runner command for your hardware. (use `ravedude --help` to list supported boards) | ||
* [ ] Update `Cargo.toml` to use the correct `avr-device` feature for your processor. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[toolchain] | ||
channel = "nightly-2024-12-10" | ||
components = ["rust-src"] | ||
profile = "minimal" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#![no_std] | ||
#![no_main] | ||
#![feature(impl_trait_in_assoc_type)] | ||
|
||
use embassy_executor::Spawner; | ||
use panic_halt as _; | ||
|
||
#[embassy_executor::main] | ||
async fn main(_spawner: Spawner) { | ||
loop { | ||
// TODO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Toggling a pin using Is there interest in implementing/supporting an embassy-specific AVR hal, or should the examples make use of One challenge is that none of the AVR HAL crates have been published, so git dependencies are needed. I'm also unsure how well it's design aligns with the HALs here. |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the example directory name more closely match the rustc target (avr -> atmega328)?
Currently nightly only supports this target, but avr-hal maintains some additional spec files. I'm unsure if these will all end up being their own rustc platforms, if they can drop the gnu dependency, or if they can be consolidated under a more generic name.
I'm assuming any AVR support here would only use rustc supported targets, otherwise this repo would likely need to duplicate the spec files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've learned of some progress regarding rustc avr target support.
rust-lang/rust#131651
The proposal consolidates the avr processors into one
avr-unknown-unknown
oravr-unknown-none
target.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i put "avr-unknown-gnu-atmega328" just because it was there, i think most of the times, you'll be using target jsons from avr-hal