Skip to content

Commit

Permalink
update toolchain to 2025-02-22
Browse files Browse the repository at this point in the history
  • Loading branch information
tones111 committed Feb 22, 2025
1 parent 95f5810 commit 33357c1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 37 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ jobs:
- name: Install Nightly Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2023-08-08
toolchain: nightly-2025-02-22
components: rustfmt

# Actual test run
- name: Generate chip description sources
run: make RUSTUP_TOOLCHAIN=nightly-2023-08-08
run: make RUSTUP_TOOLCHAIN=nightly-2025-02-22
- name: Test-compile the crate
run: cargo check --all-features

Expand Down Expand Up @@ -86,7 +86,8 @@ jobs:
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2023-12-28
toolchain: nightly-2025-02-22
rustflags: ""
components: rust-src,rustfmt
- name: Install AVR gcc, binutils, and libc
run: sudo apt-get install -y avr-libc binutils-avr gcc-avr
Expand Down
3 changes: 2 additions & 1 deletion examples/atmega328p/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[build]
target = "avr-specs/avr-atmega328p.json"
target = "avr-none"
rustflags = ["-C", "target-cpu=atmega328p"]

[target.'cfg(target_arch = "avr")']
runner = "ravedude uno -cb 57600"
Expand Down
4 changes: 2 additions & 2 deletions examples/atmega328p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "mega328-test"
version = "0.1.0"
authors = ["Frank Villaro-Dixon <frank@villaro-dixon.eu>"]
edition = "2021"
edition = "2024"
license = "MIT OR Apache-2.0"

[[bin]]
Expand All @@ -18,7 +18,7 @@ embedded-hal = "0.2.3"


[dependencies.avr-device]
version = "0.5.3"
version = "0.7"
# To use the local version of avr-device instead, uncomment the following line:
# NB: make sure to build this crate first by running `make` at the root of the project
# path = "../.."
Expand Down
25 changes: 0 additions & 25 deletions examples/atmega328p/avr-specs/avr-atmega328p.json

This file was deleted.

2 changes: 1 addition & 1 deletion examples/atmega328p/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2023-12-28"
channel = "nightly-2025-02-22"
components = ["rust-src"]
profile = "minimal"
13 changes: 8 additions & 5 deletions examples/atmega328p/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ fn TIMER0_OVF() {
// We then count 61 times to approximate 1s.
// XXX: this is a really bad way to count time

static mut OVF_COUNTER: u16 = 0;
const ROLLOVER: u16 = 61;
use core::sync::atomic::{AtomicU8, Ordering::Relaxed};

*OVF_COUNTER = OVF_COUNTER.wrapping_add(1);
if *OVF_COUNTER > ROLLOVER {
*OVF_COUNTER = 0;
static OVF_COUNTER: AtomicU8 = AtomicU8::new(0);
const ROLLOVER: u8 = 61;

let ovf = OVF_COUNTER.load(Relaxed);
if ovf < ROLLOVER {
OVF_COUNTER.store(ovf + 1, Relaxed);
} else {
OVF_COUNTER.store(0, Relaxed);
interrupt::free(|cs| {
LED_STATE.borrow(cs).set(!LED_STATE.borrow(cs).get());
});
Expand Down

0 comments on commit 33357c1

Please sign in to comment.