Skip to content
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

fix: build errors on new version of rust #50

Merged
merged 4 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Use nightly Rust
# lock to 2024-08-23 and wait for embassy-executor to be updated
run: |
rustup default nightly-2024-08-23
rustup default nightly
rustup component add rust-src
rustup update
rustup target add riscv32imac-unknown-none-elf
Expand Down
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ ch32-metapac = { features = [
], git = "https://github.com/ch32-rs/ch32-metapac.git", tag = "ch32-data-0f143d8ce505711e4667002b42b8a34eb9c1d039" }
# ch32-metapac = { features = ["memory-x","rt"], path = "../ch32-data/build/ch32-metapac" }

qingke = { version = "0.2.0", features = ["critical-section-impl"] }
qingke-rt = { version = "0.2.1", optional = true }
# qingke-rt = { version = "0.2.0", path = "../qingke/qingke-rt" }
# qingke = { version = "0.2.0", path = "../qingke", features = [
qingke = { version = "0.4.0", features = ["critical-section-impl"] }
qingke-rt = { version = "0.4.0", optional = true }
# qingke-rt = { version = "0.4.0", path = "../qingke/qingke-rt", optional = true }
# qingke = { version = "0.4.0", path = "../qingke", features = [
# "critical-section-impl",
# ] }

Expand All @@ -33,12 +33,12 @@ embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [
embedded-hal = { package = "embedded-hal", version = "1.0" }
embedded-hal-async = "1.0.0"

critical-section = { version = "1.1.2" }
defmt = { version = "0.3.5", optional = true }
critical-section = { version = "1.2.0" }
defmt = { version = "0.3.8", optional = true }
embassy-sync = { version = "0.6.0", optional = true }
embassy-futures = { version = "0.1.1", optional = true }
embassy-time-driver = { version = "0.1.0", optional = true }
embassy-time = { version = "0.3.0", optional = true }
embassy-time = { version = "0.3.2", optional = true }
embassy-usb-driver = "0.1.0"

nb = "1.1.0"
Expand Down
11 changes: 5 additions & 6 deletions examples/ch32l103/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ ch32-hal = { path = "../../", features = [
"time-driver-tim2"
], default-features = false }
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
"executor-thread",
] }
embassy-time = { version = "0.3.0" }
embassy-time = { version = "0.3.2" }

qingke-rt = { version = "0.2.1" }
qingke = "0.2.0"
# qingke-rt = { version = "0.2.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.2.0", path = "../../../qingke" }
qingke-rt = { version = "0.4.0" }
qingke = "0.4.0"
# qingke-rt = { version = "0.4.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.4.0", path = "../../../qingke" }

panic-halt = "0.2.0"
embedded-hal = "1.0.0"
Expand Down
11 changes: 5 additions & 6 deletions examples/ch32v003/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@ ch32-hal = { path = "../../", features = [
"rt",
] }
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
"executor-thread",
# "task-arena-size-512", or nightly
"task-arena-size-128", # or better use nightly, but fails on recent Rust versions
] }
embassy-time = { version = "0.3.0" }

qingke-rt = { version = "0.2.1", features = ["highcode"] }
qingke = "0.2.0"
# qingke-rt = { version = "0.2.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.2.0", path = "../../../qingke" }
qingke-rt = { version = "0.4.0", features = ["highcode"] }
qingke = "0.4.0"
# qingke-rt = { version = "0.4.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.4.0", path = "../../../qingke" }


panic-halt = "0.2.0"
Expand Down
11 changes: 5 additions & 6 deletions examples/ch32v103/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ ch32-hal = { path = "../../", features = [
"time-driver-tim2",
] }
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
"executor-thread",
] }
embassy-time = { version = "0.3.0" }
embassy-time = { version = "0.3.2" }

qingke-rt = "0.2.1"
qingke = "0.2.0"
# qingke-rt = { version = "0.2.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.2.0", path = "../../../qingke" }
qingke-rt = "0.4.0"
qingke = "0.4.0"
# qingke-rt = { version = "0.4.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.4.0", path = "../../../qingke" }

# Not working for now
# defmt = "0.3"
Expand Down
11 changes: 5 additions & 6 deletions examples/ch32v203/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ ch32-hal = { path = "../../", features = [
# "rt",
#], path = "../../../ch32-data/build/ch32-metapac" }
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
"executor-thread",
] }
embassy-time = { version = "0.3.0" }
embassy-time = { version = "0.3.2" }
embassy-usb = { version = "0.3.0" }
embassy-futures = { version = "0.1.0" }

qingke-rt = "0.2.1"
qingke = "0.2.0"
#qingke-rt = { version = "0.2.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.2.0", path = "../../../qingke" }
qingke-rt = "0.4.0"
qingke = "0.4.0"
#qingke-rt = { version = "0.4.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.4.0", path = "../../../qingke" }

panic-halt = "0.2.0"

Expand Down
11 changes: 5 additions & 6 deletions examples/ch32v208/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ ch32-hal = { path = "../../", features = [
"rt",
], default-features = false }
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
"executor-thread",
] }
embassy-time = { version = "0.3.0" }
embassy-time = { version = "0.3.2" }

qingke-rt = "0.2.1"
qingke = "0.2.0"
# qingke-rt = { version = "0.2.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.2.0", path = "../../../qingke" }
qingke-rt = "0.4.0"
qingke = "0.4.0"
# qingke-rt = { version = "0.4.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.4.0", path = "../../../qingke" }

panic-halt = "0.2.0"

Expand Down
11 changes: 5 additions & 6 deletions examples/ch32v305/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ edition = "2021"
[dependencies]
ch32-hal = { path = "../../", features = ["ch32v305fbp6", "embassy", "rt"] }
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
"executor-thread",
] }
embassy-time = { version = "0.3.0" }
embassy-time = { version = "0.3.2" }

qingke-rt = "0.2.1"
qingke = "0.2.0"
# qingke-rt = { version = "0.2.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.2.0", path = "../../../qingke" }
qingke-rt = "0.4.0"
qingke = "0.4.0"
# qingke-rt = { version = "0.4.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.4.0", path = "../../../qingke" }

# Not working for now
# defmt = "0.3"
Expand Down
8 changes: 4 additions & 4 deletions examples/ch32v307/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ ch32-hal = { path = "../../", features = [
"time-driver-tim1",
] }
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
"executor-thread",
] }
embassy-time = "0.3.2"
nb = "1.1.0"

qingke = "0.2.0"
# qingke-rt = { version = "0.2.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.2.0", path = "../../../qingke" }
qingke = "0.4.0"
# qingke-rt = { version = "0.4.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.4.0", path = "../../../qingke" }

# Not working for now
# defmt = "0.3"
Expand All @@ -38,6 +37,7 @@ embedded-hal-bus = "0.2.0"
ssd1306 = "0.9"

edrv-bmp180 = "0.0.1"
embedded-hal = "1.0.0"

[profile.release]
strip = false # symbols are not flashed to the microcontroller, so don't strip them.
Expand Down
11 changes: 0 additions & 11 deletions examples/ch32v307/src/bin/i2c-bmp180-async.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
//! I2C test with SSD1306
//!
//! Folowing pins are used:
//! SDA PB11
//! SCL PB10
//!
//! Depending on your target and the board you are using you have to change the pins.
//!
//! For this example you need to hook up an SSD1306 I2C display.
//! The display will flash black and white.

#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
Expand Down
11 changes: 0 additions & 11 deletions examples/ch32v307/src/bin/i2c-bmp180.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
//! I2C test with SSD1306
//!
//! Folowing pins are used:
//! SDA PB11
//! SCL PB10
//!
//! Depending on your target and the board you are using you have to change the pins.
//!
//! For this example you need to hook up an SSD1306 I2C display.
//! The display will flash black and white.

#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
Expand Down
11 changes: 5 additions & 6 deletions examples/ch32x035/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ edition = "2021"
[dependencies]
ch32-hal = { path = "../../", features = ["ch32x035f7p6", "embassy", "rt"] }
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
"executor-thread",
] }
embassy-time = { version = "0.3.0" }
embassy-time = { version = "0.3.2" }

qingke-rt = "0.2.1"
qingke = "0.2.0"
# qingke-rt = { version = "0.2.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.2.0", path = "../../../qingke" }
qingke-rt = "0.4.0"
qingke = "0.4.0"
# qingke-rt = { version = "0.4.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.4.0", path = "../../../qingke" }

panic-halt = "0.2.0"

Expand Down
13 changes: 6 additions & 7 deletions examples/ch641/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@ ch32-hal = { path = "../../", features = [
"rt",
] }
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
"executor-thread",
# "task-arena-size-512", or nightly
"task-arena-size-128", # or better use nightly, but fails on recent Rust versions
] }
embassy-time = { version = "0.3.0" }
embassy-time = { version = "0.3.2" }

qingke-rt = "0.2.1"
qingke = "0.2.0"
# qingke-rt = { version = "0.2.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.2.0", path = "../../../qingke" }
qingke-rt = "0.4.0"
qingke = "0.4.0"
# qingke-rt = { version = "0.4.0", path = "../../../qingke/qingke-rt" }
# qingke = { version = "0.4.0", path = "../../../qingke" }


panic-halt = "0.2.0"
Expand Down
63 changes: 40 additions & 23 deletions src/exti.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ EXTI25_16

/// safety: must be called only once
#[cfg(gpio_x0)]
pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
use crate::pac::Interrupt;
mod irq_impl {
use super::*;

#[interrupt]
unsafe fn EXTI7_0() {
Expand All @@ -298,16 +298,18 @@ pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
on_irq();
}

qingke::pfic::enable_interrupt(Interrupt::EXTI7_0 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI15_8 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI25_16 as u8);
pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
use crate::pac::Interrupt;

qingke::pfic::enable_interrupt(Interrupt::EXTI7_0 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI15_8 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI25_16 as u8);
}
}

#[cfg(all(gpio_v3, not(ch641)))]
pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
use qingke_rt::interrupt;

use crate::pac::Interrupt;
mod irq_impl {
use super::*;

#[interrupt]
unsafe fn EXTI0() {
Expand Down Expand Up @@ -338,30 +340,38 @@ pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
on_irq();
}

qingke::pfic::enable_interrupt(Interrupt::EXTI0 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI1 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI2 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI3 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI4 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI9_5 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI15_10 as u8);
pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
use crate::pac::Interrupt;

qingke::pfic::enable_interrupt(Interrupt::EXTI0 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI1 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI2 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI3 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI4 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI9_5 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI15_10 as u8);
}
}

#[cfg(gpio_v0)]
pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
use crate::pac::Interrupt;
mod irq_impl {
use super::*;

#[interrupt]
unsafe fn EXTI7_0() {
on_irq();
}

qingke::pfic::enable_interrupt(Interrupt::EXTI7_0 as u8);
pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
use crate::pac::Interrupt;

qingke::pfic::enable_interrupt(Interrupt::EXTI7_0 as u8);
}
}

#[cfg(all(gpio_v3, ch641))]
pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
use crate::pac::Interrupt;
mod irq_impl {
use super::*;

#[interrupt]
unsafe fn EXTI7_0() {
Expand All @@ -373,6 +383,13 @@ pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
on_irq();
}

qingke::pfic::enable_interrupt(Interrupt::EXTI7_0 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI15_8 as u8);
pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
use crate::pac::Interrupt;

qingke::pfic::enable_interrupt(Interrupt::EXTI7_0 as u8);
qingke::pfic::enable_interrupt(Interrupt::EXTI15_8 as u8);
}
}


pub(crate) use irq_impl::*;
Loading
Loading