rtic: placate clippy for esp32c3

This commit is contained in:
datdenkikniet 2025-03-22 23:55:32 +01:00
parent b43590510d
commit 6f77668bc0
5 changed files with 27 additions and 56 deletions

View file

@ -74,53 +74,6 @@ jobs:
platform: esp32-c3 platform: esp32-c3
rustup-target: riscv32imc-unknown-none-elf rustup-target: riscv32imc-unknown-none-elf
# Clippy
# TODO: put in clippy-check-example once esp32-c3 clippy is fixed
clippy:
name: clippy
runs-on: ubuntu-22.04
strategy:
matrix:
input:
- backend: thumbv7
platform: lm3s6965
rustup-target: thumbv7m-none-eabi
- backend: thumbv6
platform: lm3s6965
rustup-target: thumbv6m-none-eabi
- backend: thumbv8-base
platform: lm3s6965
rustup-target: thumbv8m.base-none-eabi
- backend: thumbv8-main
platform: lm3s6965
rustup-target: thumbv8m.main-none-eabi
- backend: riscv32-imc-clint
platform: hifive1
rustup-target: riscv32imc-unknown-none-elf
- backend: riscv32-imc-mecall
platform: hifive1
rustup-target: riscv32imc-unknown-none-elf
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Rust target ${{ matrix.input.rustup-target }}
run: rustup target add ${{ matrix.input.rustup-target }}
- name: Add Rust component clippy
run: rustup component add clippy
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- run: cargo xtask --deny-warnings --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} clippy
buildqemu: buildqemu:
name: Get modern QEMU, build and store name: Get modern QEMU, build and store
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04

View file

@ -53,4 +53,22 @@ jobs:
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: Check the examples - name: Check the examples
run: cargo xtask example-check --platform ${{ inputs.platform }} --backend ${{ inputs.backend }} ${{ inputs.example-args }} run: cargo xtask example-check --platform ${{ inputs.platform }} --backend ${{ inputs.backend }} ${{ inputs.example-args }}
clippy:
runs-on: ubuntu-22.04
name: Run clippy
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Rust target ${{ inputs.rustup-target }}
run: rustup target add ${{ inputs.rustup-target }}
- name: Add Rust component clippy
run: rustup component add clippy
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- run: cargo xtask --deny-warnings --platform ${{ inputs.platform }} --backend ${{ inputs.backend }} clippy

View file

@ -2,6 +2,7 @@
pub use esp32c3::*; pub use esp32c3::*;
#[cfg(feature = "riscv-esp32c3")] #[cfg(feature = "riscv-esp32c3")]
#[allow(clippy::module_inception)]
mod esp32c3 { mod esp32c3 {
use crate::{ use crate::{
analyze::Analysis as CodegenAnalysis, analyze::Analysis as CodegenAnalysis,
@ -92,7 +93,7 @@ mod esp32c3 {
for (&priority, name) in interrupt_ids.chain( for (&priority, name) in interrupt_ids.chain(
app.hardware_tasks app.hardware_tasks
.values() .values()
.filter_map(|task| Some((&task.args.priority, &task.args.binds))), .map(|task| (&task.args.priority, &task.args.binds)),
) { ) {
let es = format!( let es = format!(
"Maximum priority used by interrupt vector '{name}' is more than supported by hardware" "Maximum priority used by interrupt vector '{name}' is more than supported by hardware"
@ -207,7 +208,7 @@ mod esp32c3 {
stmts stmts
} }
pub fn async_prio_limit(app: &App, analysis: &CodegenAnalysis) -> Vec<TokenStream2> { pub fn async_prio_limit(_app: &App, analysis: &CodegenAnalysis) -> Vec<TokenStream2> {
let max = if let Some(max) = analysis.max_async_prio { let max = if let Some(max) = analysis.max_async_prio {
quote!(#max) quote!(#max)
} else { } else {
@ -232,7 +233,7 @@ mod esp32c3 {
for (_, name) in interrupt_ids.chain( for (_, name) in interrupt_ids.chain(
app.hardware_tasks app.hardware_tasks
.values() .values()
.filter_map(|task| Some((&task.args.priority, &task.args.binds))), .map(|task| (&task.args.priority, &task.args.binds)),
) { ) {
if *name == dispatcher_name { if *name == dispatcher_name {
let ret = &("interrupt".to_owned() + &curr_cpu_id.to_string()); let ret = &("interrupt".to_owned() + &curr_cpu_id.to_string());

View file

@ -49,8 +49,8 @@ impl TimerBackend {
/// Use the prelude macros instead. /// Use the prelude macros instead.
pub fn _start(timer: SYSTIMER) { pub fn _start(timer: SYSTIMER) {
const INTERRUPT_MAP_BASE: u32 = 0x600c2000; const INTERRUPT_MAP_BASE: u32 = 0x600c2000;
let interrupt_number = 37 as isize; let interrupt_number = 37isize;
let cpu_interrupt_number = 31 as isize; let cpu_interrupt_number = 31isize;
unsafe { unsafe {
let intr_map_base = INTERRUPT_MAP_BASE as *mut u32; let intr_map_base = INTERRUPT_MAP_BASE as *mut u32;
intr_map_base intr_map_base
@ -65,7 +65,7 @@ impl TimerBackend {
intr_prio_base intr_prio_base
.offset(cpu_interrupt_number) .offset(cpu_interrupt_number)
.write_volatile(15 as u32); .write_volatile(15);
} }
timer.conf().write(|w| w.timer_unit0_work_en().set_bit()); timer.conf().write(|w| w.timer_unit0_work_en().set_bit());
timer timer

View file

@ -57,8 +57,7 @@ where
pub unsafe fn lock<T, R>(ptr: *mut T, ceiling: u8, f: impl FnOnce(&mut T) -> R) -> R { pub unsafe fn lock<T, R>(ptr: *mut T, ceiling: u8, f: impl FnOnce(&mut T) -> R) -> R {
if ceiling == (15) { if ceiling == (15) {
//turn off interrupts completely, were at max prio //turn off interrupts completely, were at max prio
let r = critical_section::with(|_| f(&mut *ptr)); critical_section::with(|_| f(&mut *ptr))
r
} else { } else {
let current = unsafe { let current = unsafe {
(*INTERRUPT_CORE0::ptr()) (*INTERRUPT_CORE0::ptr())