Skip to content

Commit 9a2d2bd

Browse files
authored
transfer all current feature gating to device specific features (#266)
* transfer all current feature gating to device specific features MCU with missing PAC support is marked like `// feature = "stm32l471", // missing PAC support` * fixup some of the gating * gate CAN so L412/L422 can be part of CI * These features aren't actually present * USART3 not on these specific MCUs * add all models to ci * add common MCU feature lists to copy from * remove r/s from ci "support" is extremely minimal
1 parent fdb39ef commit 9a2d2bd

File tree

14 files changed

+807
-419
lines changed

14 files changed

+807
-419
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on:
22
push:
3-
branches: [ master ]
3+
branches: [master]
44
pull_request:
55

66
name: Continuous integration
@@ -9,15 +9,28 @@ jobs:
99
ci:
1010
runs-on: ubuntu-latest
1111
strategy:
12-
matrix: # All permutations of {rust, mcu}
12+
matrix: # All permutations of {rust, mcu}
1313
rust:
1414
- stable
1515
mcu:
16-
- stm32l4x1
17-
- stm32l4x2
18-
- stm32l4x3
19-
- stm32l4x5
20-
- stm32l4x6
16+
- stm32l412
17+
- stm32l422
18+
- stm32l431
19+
- stm32l432
20+
- stm32l433
21+
- stm32l442
22+
- stm32l443
23+
- stm32l451
24+
- stm32l452
25+
- stm32l462
26+
- stm32l471
27+
- stm32l475
28+
- stm32l476
29+
- stm32l486
30+
- stm32l496
31+
- stm32l4a6
32+
#- stm32l4r9
33+
#- stm32l4s9
2134

2235
steps:
2336
- uses: actions/checkout@v2
@@ -27,12 +40,14 @@ jobs:
2740
toolchain: ${{ matrix.rust }}
2841
target: thumbv7em-none-eabihf
2942
override: true
30-
- uses: actions-rs/cargo@v1
43+
- name: build
44+
uses: actions-rs/cargo@v1
3145
with:
3246
use-cross: true
3347
command: build
3448
args: --verbose --release --examples --target thumbv7em-none-eabihf --features rt,unproven,${{ matrix.mcu }}
35-
- uses: actions-rs/cargo@v1
49+
- name: test
50+
uses: actions-rs/cargo@v1
3651
with:
3752
command: test
3853
args: --lib --target x86_64-unknown-linux-gnu --features rt,unproven,${{ matrix.mcu }}

.github/workflows/clippy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- uses: actions-rs/clippy-check@v1
2020
with:
2121
token: ${{ secrets.GITHUB_TOKEN }}
22-
args: --examples --target thumbv7em-none-eabihf --features=stm32l4x2,rt,unproven
22+
args: --examples --target thumbv7em-none-eabihf --features=stm32l432,rt,unproven

Cargo.toml

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,53 @@ features = ["cortex-m", "fs"]
5757
optional = true
5858

5959
[package.metadata.docs.rs]
60-
features = ["rt", "stm32l4x2", "stm32-usbd"]
60+
features = ["rt", "stm32l432", "stm32-usbd"]
6161

6262
[features]
6363
rt = ["stm32l4/rt"]
64-
stm32l4x1 = ["stm32l4/stm32l4x1"]
65-
stm32l4x2 = ["stm32l4/stm32l4x2"]
66-
stm32l4x3 = ["stm32l4/stm32l4x3"]
67-
stm32l4x5 = ["stm32l4/stm32l4x5"]
68-
stm32l4x6 = ["stm32l4/stm32l4x6"]
6964
unproven = ["embedded-hal/unproven"]
7065
otg_fs = ["synopsys-usb-otg"]
7166

67+
# L4x1
68+
stm32l431 = [ "stm32l4/stm32l4x1" ]
69+
stm32l451 = [ "stm32l4/stm32l4x1" ]
70+
stm32l471 = [ "stm32l4/stm32l4x1" ]
71+
72+
# L4x2
73+
stm32l412 = [ "stm32l4/stm32l4x2" ]
74+
stm32l422 = [ "stm32l4/stm32l4x2" ]
75+
stm32l432 = [ "stm32l4/stm32l4x2" ]
76+
stm32l442 = [ "stm32l4/stm32l4x2" ]
77+
stm32l452 = [ "stm32l4/stm32l4x2" ]
78+
stm32l462 = [ "stm32l4/stm32l4x2" ]
79+
80+
# L4x3
81+
stm32l433 = [ "stm32l4/stm32l4x3" ]
82+
stm32l443 = [ "stm32l4/stm32l4x3" ]
83+
84+
# L4x5
85+
stm32l475 = [ "stm32l4/stm32l4x5" ]
86+
87+
# L4x6
88+
stm32l476 = [ "stm32l4/stm32l4x6" ]
89+
stm32l486 = [ "stm32l4/stm32l4x6" ]
90+
stm32l496 = [ "stm32l4/stm32l4x6" ]
91+
stm32l4a6 = [ "stm32l4/stm32l4x6" ]
92+
93+
# L4+ series PAC support??
94+
#stm32l4p5 = [ "stm32l4/stm32l4x5" ]
95+
#stm32l4q5 = [ "stm32l4/stm32l4x5" ]
96+
#stm32l4r5 = [ "stm32l4/stm32l4x5" ]
97+
#stm32l4s5 = [ "stm32l4/stm32l4x5" ]
98+
99+
# L4x7
100+
#stm32l4r7 = [ "stm32l4/stm32l4x7" ]
101+
#stm32l4s7 = [ "stm32l4/stm32l4x7" ]
102+
103+
## L4x9
104+
stm32l4r9 = [ "stm32l4/stm32l4r9" ] # PAC has an L4r9 specific variation
105+
stm32l4s9 = [ "stm32l4/stm32l4r9" ]
106+
72107
[dev-dependencies]
73108
panic-halt = "0.2.0"
74109
panic-semihosting = "0.5.0"
@@ -103,19 +138,19 @@ lto = true
103138

104139
[[example]]
105140
name = "adc"
106-
required-features = ["rt", "stm32l4x3"]
141+
required-features = ["rt"]
107142

108143
[[example]]
109144
name = "can-loopback"
110-
required-features = ["rt", "stm32l4x1"]
145+
required-features = ["rt", "stm32l433" ] # CAN peripheral on ever series except L41/L42, gate so CI will pass
111146

112147
[[example]]
113148
name = "irq_button"
114149
required-features = ["rt"]
115150

116151
[[example]]
117152
name = "qspi"
118-
required-features = ["rt", "stm32l4x5"]
153+
required-features = ["rt", "stm32l476"] # L433/43 have no QSPI peripheral and are highly likely to be used
119154

120155
[[example]]
121156
name = "rng"
@@ -127,36 +162,36 @@ required-features = ["rt"]
127162

128163
[[example]]
129164
name = "rtic_frame_serial_dma"
130-
required-features = ["rt", "stm32l4x2"]
165+
required-features = ["rt"]
131166

132167
[[example]]
133168
name = "spi_dma_rxtx"
134-
required-features = ["rt", "stm32l4x2"]
169+
required-features = ["rt"]
135170

136171
[[example]]
137172
name = "serial_echo_rtic"
138-
required-features = ["rt", "stm32l4x3"]
173+
required-features = ["rt"]
139174

140175
[[example]]
141176
name = "timer"
142177
required-features = ["rt"]
143178

144179
[[example]]
145180
name = "usb_serial"
146-
required-features = ["rt", "stm32l4x2", "stm32-usbd"]
181+
required-features = ["rt", "stm32-usbd"]
147182

148183
[[example]]
149184
name = "otg_fs_serial"
150-
required-features = ["rt", "stm32l4x6", "otg_fs"]
185+
required-features = ["rt", "otg_fs"]
151186

152187
[[example]]
153188
name = "i2c_write"
154-
required-features = ["stm32l4x1"]
189+
required-features = ["stm32l433"]
155190

156191
[[example]]
157192
name = "lptim_rtic"
158-
required-features = ["rt", "stm32l4x2"]
193+
required-features = ["rt"]
159194

160195
[[example]]
161196
name = "adc_dma"
162-
required-features = ["rt", "stm32l4x1"]
197+
required-features = ["rt"]

examples/timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn main() -> ! {
3939
// let mut led = gpiob.pb3.into_push_pull_output(&mut gpiob.moder, &mut gpiob.otyper);
4040

4141
unsafe { NVIC::unmask(hal::stm32::Interrupt::TIM7) };
42-
let mut timer = Timer::tim7(dp.TIM7, 1.hz(), clocks, &mut rcc.apb1r1);
42+
let mut timer = Timer::tim6(dp.TIM6, 1.hz(), clocks, &mut rcc.apb1r1);
4343
timer.listen(Event::TimeOut);
4444

4545
loop {

src/can.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ mod common_pins {
4545
}
4646
}
4747

48-
#[cfg(feature = "stm32l4x1")]
48+
// L4x1
49+
#[cfg(any(feature = "stm32l431", feature = "stm32l451", feature = "stm32l471"))]
4950
mod pb13_pb12_af10 {
5051
use crate::gpio::{
5152
gpiob::{PB12, PB13},

src/gpio.rs

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,23 @@ gpio!(GPIOE, gpioe, PEx, 'E', 4, [
709709
PE15: (pe15, 15, Input<Floating>, H8, exticr4),
710710
]);
711711

712-
#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6"))]
712+
#[cfg(any(
713+
// feature = "stm32l471", // missing PAC support for Port G
714+
feature = "stm32l475",
715+
feature = "stm32l476",
716+
feature = "stm32l485",
717+
feature = "stm32l486",
718+
feature = "stm32l496",
719+
feature = "stm32l4a6",
720+
// feature = "stm32l4p5",
721+
// feature = "stm32l4q5",
722+
// feature = "stm32l4r5",
723+
// feature = "stm32l4s5",
724+
// feature = "stm32l4r7",
725+
// feature = "stm32l4s7",
726+
feature = "stm32l4r9",
727+
feature = "stm32l4s9",
728+
))]
713729
gpio!(GPIOF, gpiof, PFx, 'F', 5, [
714730
PF0: (pf0, 0, Input<Floating>, L8, exticr1),
715731
PF1: (pf1, 1, Input<Floating>, L8, exticr1),
@@ -728,8 +744,23 @@ gpio!(GPIOF, gpiof, PFx, 'F', 5, [
728744
PF14: (pf14, 14, Input<Floating>, H8, exticr4),
729745
PF15: (pf15, 15, Input<Floating>, H8, exticr4),
730746
]);
731-
732-
#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6"))]
747+
#[cfg(any(
748+
// feature = "stm32l471", // missing PAC support for Port G
749+
feature = "stm32l475",
750+
feature = "stm32l476",
751+
feature = "stm32l485",
752+
feature = "stm32l486",
753+
feature = "stm32l496",
754+
feature = "stm32l4a6",
755+
// feature = "stm32l4p5",
756+
// feature = "stm32l4q5",
757+
// feature = "stm32l4r5",
758+
// feature = "stm32l4s5",
759+
// feature = "stm32l4r7",
760+
// feature = "stm32l4s7",
761+
feature = "stm32l4r9",
762+
feature = "stm32l4s9",
763+
))]
733764
gpio!(GPIOG, gpiog, PGx, 'G', 6, [
734765
PG0: (pg0, 0, Input<Floating>, L8, exticr1),
735766
PG1: (pg1, 1, Input<Floating>, L8, exticr1),
@@ -758,9 +789,41 @@ impl<const P: char> Gpio<P> {
758789
'C' => crate::pac::GPIOC::ptr() as _,
759790
'D' => crate::pac::GPIOD::ptr() as _,
760791
'E' => crate::pac::GPIOE::ptr() as _,
761-
#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6"))]
792+
#[cfg(any(
793+
// feature = "stm32l471", // missing PAC support for Port F
794+
feature = "stm32l475",
795+
feature = "stm32l476",
796+
feature = "stm32l485",
797+
feature = "stm32l486",
798+
feature = "stm32l496",
799+
feature = "stm32l4a6",
800+
// feature = "stm32l4p5",
801+
// feature = "stm32l4q5",
802+
// feature = "stm32l4r5",
803+
// feature = "stm32l4s5",
804+
// feature = "stm32l4r7",
805+
// feature = "stm32l4s7",
806+
feature = "stm32l4r9",
807+
feature = "stm32l4s9",
808+
))]
762809
'F' => crate::pac::GPIOF::ptr() as _,
763-
#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6"))]
810+
#[cfg(any(
811+
// feature = "stm32l471", // missing PAC support for Port G
812+
feature = "stm32l475",
813+
feature = "stm32l476",
814+
feature = "stm32l485",
815+
feature = "stm32l486",
816+
feature = "stm32l496",
817+
feature = "stm32l4a6",
818+
// feature = "stm32l4p5",
819+
// feature = "stm32l4q5",
820+
// feature = "stm32l4r5",
821+
// feature = "stm32l4s5",
822+
// feature = "stm32l4r7",
823+
// feature = "stm32l4s7",
824+
feature = "stm32l4r9",
825+
feature = "stm32l4s9",
826+
))]
764827
'G' => crate::pac::GPIOG::ptr() as _,
765828
_ => crate::pac::GPIOA::ptr(),
766829
}

0 commit comments

Comments
 (0)