Skip to content

Commit a3dfd46

Browse files
committed
ci & xtask: support hifive clippy
1 parent f118d65 commit a3dfd46

File tree

4 files changed

+59
-31
lines changed

4 files changed

+59
-31
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,37 @@ jobs:
6565
- run: cargo xtask --deny-warnings --platform lm3s6965 --backend ${{ matrix.input.backend }} check
6666

6767
# Clippy
68-
# TODO: clippy hifive1, esp32-c3
68+
# TODO: clippy esp32-c3
6969
clippy:
7070
name: clippy
7171
runs-on: ubuntu-22.04
7272
strategy:
7373
matrix:
7474
input:
7575
- backend: thumbv7
76+
platform: lm3s6965
7677
rustup-target: thumbv7m-none-eabi
7778

7879
- backend: thumbv6
80+
platform: lm3s6965
7981
rustup-target: thumbv6m-none-eabi
8082

8183
- backend: thumbv8-base
84+
platform: lm3s6965
8285
rustup-target: thumbv8m.base-none-eabi
8386

8487
- backend: thumbv8-main
88+
platform: lm3s6965
8589
rustup-target: thumbv8m.main-none-eabi
8690

91+
- backend: riscv32-imc-clint
92+
platform: hifive1
93+
rustup-target: riscv32imc-unknown-none-elf
94+
95+
- backend: riscv32-imc-mecall
96+
platform: hifive1
97+
rustup-target: riscv32imc-unknown-none-elf
98+
8799
steps:
88100
- name: Checkout
89101
uses: actions/checkout@v4
@@ -97,7 +109,7 @@ jobs:
97109
- name: Cache Dependencies
98110
uses: Swatinem/rust-cache@v2
99111

100-
- run: cargo xtask --deny-warnings --platform lm3s6965 --backend ${{ matrix.input.backend }} clippy
112+
- run: cargo xtask --deny-warnings --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} clippy
101113

102114
# Verify all examples, checks
103115
checkexamples:
@@ -184,7 +196,7 @@ jobs:
184196
185197
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
186198
name: Download QEMU
187-
run: wget "${{ env.QEMU_URL }}"
199+
run: wget "${{ env.QEMU_URL }}"
188200

189201
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
190202
name: Extract QEMU

rtic/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Example:
2222

2323
### Changed
2424

25+
- Placate clippy
2526
- Updated esp32c3 dependency to v0.27.0
2627

2728
### Added

rtic/src/export/riscv_common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// GENERIC RE-EXPORTS: needed for all RTIC backends
1+
//! GENERIC RE-EXPORTS: needed for all RTIC backends
22
33
/// Read the stack pointer.
44
#[inline(always)]

xtask/src/argument_parsing.rs

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,32 +63,7 @@ impl Package {
6363
vec![Some(backend.to_rtic_macros_feature().to_string())]
6464
}
6565
Package::RticMonotonics => {
66-
let features = if partial {
67-
&[
68-
"cortex-m-systick",
69-
"rp2040",
70-
"nrf52840",
71-
"imxrt_gpt1,imxrt-ral/imxrt1062",
72-
"stm32_tim2,stm32h725ag",
73-
][..]
74-
} else {
75-
&[
76-
"cortex-m-systick",
77-
"cortex-m-systick,systick-64bit",
78-
"rp2040",
79-
"nrf52805",
80-
"nrf52810",
81-
"nrf52811",
82-
"nrf52832",
83-
"nrf52833",
84-
"nrf52840",
85-
"nrf5340-app",
86-
"nrf5340-net",
87-
"nrf9160",
88-
"imxrt_gpt1,imxrt_gpt2,imxrt-ral/imxrt1062",
89-
"stm32_tim2,stm32_tim3,stm32_tim4,stm32_tim5,stm32_tim15,stm32h725ag",
90-
][..]
91-
};
66+
let features = backend.to_rtic_monotonics_features(partial);
9267

9368
features
9469
.iter()
@@ -103,7 +78,7 @@ impl Package {
10378
.chain(std::iter::once(None))
10479
.collect()
10580
}
106-
Package::RticSync if matches!(backend, Backends::Thumbv6) => {
81+
Package::RticSync if matches!(backend, Backends::Thumbv6) || !backend.is_arm() => {
10782
vec![Some("portable-atomic/critical-section".into())]
10883
}
10984
_ => vec![None],
@@ -200,6 +175,7 @@ impl Backends {
200175
Backends::Riscv32ImcMecall | Backends::Riscv32ImacMecall => "riscv-mecall-backend",
201176
}
202177
}
178+
203179
#[allow(clippy::wrong_self_convention)]
204180
pub fn to_rtic_macros_feature(&self) -> &'static str {
205181
match self {
@@ -210,6 +186,45 @@ impl Backends {
210186
Backends::Riscv32ImcMecall | Backends::Riscv32ImacMecall => "riscv-mecall",
211187
}
212188
}
189+
190+
#[allow(clippy::wrong_self_convention)]
191+
pub fn to_rtic_monotonics_features(&self, partial: bool) -> &[&str] {
192+
if !self.is_arm() {
193+
&[""]
194+
} else if partial {
195+
&[
196+
"cortex-m-systick",
197+
"rp2040",
198+
"nrf52840",
199+
"imxrt_gpt1,imxrt-ral/imxrt1062",
200+
"stm32_tim2,stm32h725ag",
201+
][..]
202+
} else {
203+
&[
204+
"cortex-m-systick",
205+
"cortex-m-systick,systick-64bit",
206+
"rp2040",
207+
"nrf52805",
208+
"nrf52810",
209+
"nrf52811",
210+
"nrf52832",
211+
"nrf52833",
212+
"nrf52840",
213+
"nrf5340-app",
214+
"nrf5340-net",
215+
"nrf9160",
216+
"imxrt_gpt1,imxrt_gpt2,imxrt-ral/imxrt1062",
217+
"stm32_tim2,stm32_tim3,stm32_tim4,stm32_tim5,stm32_tim15,stm32h725ag",
218+
][..]
219+
}
220+
}
221+
222+
pub fn is_arm(&self) -> bool {
223+
matches!(
224+
self,
225+
Self::Thumbv6 | Self::Thumbv7 | Self::Thumbv8Base | Self::Thumbv8Main
226+
)
227+
}
213228
}
214229

215230
#[derive(Copy, Clone, Default, Debug)]

0 commit comments

Comments
 (0)