mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-18 22:05:37 +01:00
ci & xtask: support hifive clippy
This commit is contained in:
parent
f118d652d0
commit
5483e7f16f
4 changed files with 75 additions and 43 deletions
18
.github/workflows/build.yml
vendored
18
.github/workflows/build.yml
vendored
|
|
@ -65,7 +65,7 @@ jobs:
|
||||||
- run: cargo xtask --deny-warnings --platform lm3s6965 --backend ${{ matrix.input.backend }} check
|
- run: cargo xtask --deny-warnings --platform lm3s6965 --backend ${{ matrix.input.backend }} check
|
||||||
|
|
||||||
# Clippy
|
# Clippy
|
||||||
# TODO: clippy hifive1, esp32-c3
|
# TODO: clippy esp32-c3
|
||||||
clippy:
|
clippy:
|
||||||
name: clippy
|
name: clippy
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
@ -73,17 +73,29 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
input:
|
input:
|
||||||
- backend: thumbv7
|
- backend: thumbv7
|
||||||
|
platform: lm3s6965
|
||||||
rustup-target: thumbv7m-none-eabi
|
rustup-target: thumbv7m-none-eabi
|
||||||
|
|
||||||
- backend: thumbv6
|
- backend: thumbv6
|
||||||
|
platform: lm3s6965
|
||||||
rustup-target: thumbv6m-none-eabi
|
rustup-target: thumbv6m-none-eabi
|
||||||
|
|
||||||
- backend: thumbv8-base
|
- backend: thumbv8-base
|
||||||
|
platform: lm3s6965
|
||||||
rustup-target: thumbv8m.base-none-eabi
|
rustup-target: thumbv8m.base-none-eabi
|
||||||
|
|
||||||
- backend: thumbv8-main
|
- backend: thumbv8-main
|
||||||
|
platform: lm3s6965
|
||||||
rustup-target: thumbv8m.main-none-eabi
|
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:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -97,7 +109,7 @@ jobs:
|
||||||
- name: Cache Dependencies
|
- name: Cache Dependencies
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
- run: cargo xtask --deny-warnings --platform lm3s6965 --backend ${{ matrix.input.backend }} clippy
|
- run: cargo xtask --deny-warnings --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} clippy
|
||||||
|
|
||||||
# Verify all examples, checks
|
# Verify all examples, checks
|
||||||
checkexamples:
|
checkexamples:
|
||||||
|
|
@ -184,7 +196,7 @@ jobs:
|
||||||
|
|
||||||
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
|
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
|
||||||
name: Download QEMU
|
name: Download QEMU
|
||||||
run: wget "${{ env.QEMU_URL }}"
|
run: wget "${{ env.QEMU_URL }}"
|
||||||
|
|
||||||
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
|
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
|
||||||
name: Extract QEMU
|
name: Extract QEMU
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ Example:
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- Placate clippy
|
||||||
- Updated esp32c3 dependency to v0.27.0
|
- Updated esp32c3 dependency to v0.27.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/// GENERIC RE-EXPORTS: needed for all RTIC backends
|
//! GENERIC RE-EXPORTS: needed for all RTIC backends
|
||||||
|
|
||||||
/// Read the stack pointer.
|
/// Read the stack pointer.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
|
|
||||||
|
|
@ -63,47 +63,26 @@ impl Package {
|
||||||
vec![Some(backend.to_rtic_macros_feature().to_string())]
|
vec![Some(backend.to_rtic_macros_feature().to_string())]
|
||||||
}
|
}
|
||||||
Package::RticMonotonics => {
|
Package::RticMonotonics => {
|
||||||
let features = if partial {
|
let features = backend.to_rtic_monotonics_features(partial);
|
||||||
&[
|
|
||||||
"cortex-m-systick",
|
|
||||||
"rp2040",
|
|
||||||
"nrf52840",
|
|
||||||
"imxrt_gpt1,imxrt-ral/imxrt1062",
|
|
||||||
"stm32_tim2,stm32h725ag",
|
|
||||||
][..]
|
|
||||||
} else {
|
|
||||||
&[
|
|
||||||
"cortex-m-systick",
|
|
||||||
"cortex-m-systick,systick-64bit",
|
|
||||||
"rp2040",
|
|
||||||
"nrf52805",
|
|
||||||
"nrf52810",
|
|
||||||
"nrf52811",
|
|
||||||
"nrf52832",
|
|
||||||
"nrf52833",
|
|
||||||
"nrf52840",
|
|
||||||
"nrf5340-app",
|
|
||||||
"nrf5340-net",
|
|
||||||
"nrf9160",
|
|
||||||
"imxrt_gpt1,imxrt_gpt2,imxrt-ral/imxrt1062",
|
|
||||||
"stm32_tim2,stm32_tim3,stm32_tim4,stm32_tim5,stm32_tim15,stm32h725ag",
|
|
||||||
][..]
|
|
||||||
};
|
|
||||||
|
|
||||||
features
|
if let Some(features) = features {
|
||||||
.iter()
|
features
|
||||||
.map(|&s| {
|
.iter()
|
||||||
if matches!(backend, Backends::Thumbv6) {
|
.map(|&s| {
|
||||||
format!("{s},portable-atomic/critical-section")
|
if matches!(backend, Backends::Thumbv6) {
|
||||||
} else {
|
format!("{s},portable-atomic/critical-section")
|
||||||
s.to_string()
|
} else {
|
||||||
}
|
s.to_string()
|
||||||
})
|
}
|
||||||
.map(Some)
|
})
|
||||||
.chain(std::iter::once(None))
|
.map(Some)
|
||||||
.collect()
|
.chain(std::iter::once(None))
|
||||||
|
.collect()
|
||||||
|
} else {
|
||||||
|
vec![None]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Package::RticSync if matches!(backend, Backends::Thumbv6) => {
|
Package::RticSync if matches!(backend, Backends::Thumbv6) || !backend.is_arm() => {
|
||||||
vec![Some("portable-atomic/critical-section".into())]
|
vec![Some("portable-atomic/critical-section".into())]
|
||||||
}
|
}
|
||||||
_ => vec![None],
|
_ => vec![None],
|
||||||
|
|
@ -200,6 +179,7 @@ impl Backends {
|
||||||
Backends::Riscv32ImcMecall | Backends::Riscv32ImacMecall => "riscv-mecall-backend",
|
Backends::Riscv32ImcMecall | Backends::Riscv32ImacMecall => "riscv-mecall-backend",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::wrong_self_convention)]
|
#[allow(clippy::wrong_self_convention)]
|
||||||
pub fn to_rtic_macros_feature(&self) -> &'static str {
|
pub fn to_rtic_macros_feature(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
|
|
@ -210,6 +190,45 @@ impl Backends {
|
||||||
Backends::Riscv32ImcMecall | Backends::Riscv32ImacMecall => "riscv-mecall",
|
Backends::Riscv32ImcMecall | Backends::Riscv32ImacMecall => "riscv-mecall",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::wrong_self_convention)]
|
||||||
|
pub fn to_rtic_monotonics_features(&self, partial: bool) -> Option<&[&str]> {
|
||||||
|
if !self.is_arm() {
|
||||||
|
None
|
||||||
|
} else if partial {
|
||||||
|
Some(&[
|
||||||
|
"cortex-m-systick",
|
||||||
|
"rp2040",
|
||||||
|
"nrf52840",
|
||||||
|
"imxrt_gpt1,imxrt-ral/imxrt1062",
|
||||||
|
"stm32_tim2,stm32h725ag",
|
||||||
|
])
|
||||||
|
} else {
|
||||||
|
Some(&[
|
||||||
|
"cortex-m-systick",
|
||||||
|
"cortex-m-systick,systick-64bit",
|
||||||
|
"rp2040",
|
||||||
|
"nrf52805",
|
||||||
|
"nrf52810",
|
||||||
|
"nrf52811",
|
||||||
|
"nrf52832",
|
||||||
|
"nrf52833",
|
||||||
|
"nrf52840",
|
||||||
|
"nrf5340-app",
|
||||||
|
"nrf5340-net",
|
||||||
|
"nrf9160",
|
||||||
|
"imxrt_gpt1,imxrt_gpt2,imxrt-ral/imxrt1062",
|
||||||
|
"stm32_tim2,stm32_tim3,stm32_tim4,stm32_tim5,stm32_tim15,stm32h725ag",
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_arm(&self) -> bool {
|
||||||
|
matches!(
|
||||||
|
self,
|
||||||
|
Self::Thumbv6 | Self::Thumbv7 | Self::Thumbv8Base | Self::Thumbv8Main
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Default, Debug)]
|
#[derive(Copy, Clone, Default, Debug)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue