Skip to content

Commit 31ca8a3

Browse files
authored
Merge pull request #216 from Piroro-hs/memory_x
Auto generate memory.x
2 parents 09b15bd + 18617af commit 31ca8a3

File tree

8 files changed

+442
-279
lines changed

8 files changed

+442
-279
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,36 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14+
# Devices only differ in memory size are commented out
1415
mcu:
15-
- stm32f301
16-
- stm32f318
16+
- stm32f301x6
17+
- stm32f318x8
18+
- stm32f302x6
19+
# - stm32f302x8
1720
- stm32f302xb
18-
- stm32f302xc
21+
# - stm32f302xc
1922
- stm32f302xd
20-
- stm32f302xe
21-
- stm32f302x6
22-
- stm32f302x8
23+
# - stm32f302xe
24+
- stm32f303x6
25+
# - stm32f303x8
2326
- stm32f303xb
24-
- stm32f303xc
27+
# - stm32f303xc
2528
- stm32f303xd
26-
- stm32f303xe
27-
- stm32f303x6
28-
- stm32f303x8
29-
- stm32f373
30-
- stm32f378
31-
- stm32f334
32-
- stm32f328
33-
- stm32f358
34-
- stm32f398
29+
# - stm32f303xe
30+
- stm32f328x8
31+
- stm32f358xc
32+
- stm32f398xe
33+
- stm32f373x8
34+
# - stm32f373xb
35+
# - stm32f373xc
36+
- stm32f378xc
37+
- stm32f334x4
38+
# - stm32f334x6
39+
# - stm32f334x8
3540
features: ["rt"]
3641
include:
3742
- mcu: stm32f303xc
38-
features: rt,stm32-usbd
43+
features: rt,can,stm32-usbd
3944
steps:
4045
- uses: actions/checkout@v2
4146
- uses: actions-rs/toolchain@v1
@@ -47,7 +52,7 @@ jobs:
4752
- uses: actions-rs/cargo@v1
4853
with:
4954
command: check
50-
args: --features=${{ matrix.mcu }},${{ matrix.features }} --lib --examples
55+
args: --features=${{ matrix.mcu }},ld,${{ matrix.features }} --lib --examples
5156

5257
# This is our MSRV. However this is only for documentation
5358
# purposes and should be increased if newer features are used.
@@ -66,7 +71,7 @@ jobs:
6671
- uses: actions-rs/cargo@v1
6772
with:
6873
command: check
69-
args: --features=stm32f303xc,stm32-usbd,rt,can --lib --examples
74+
args: --features=stm32f303xc,stm32-usbd,rt,can,ld --lib --examples
7075

7176
check-tests:
7277
name: Check Tests
@@ -89,7 +94,7 @@ jobs:
8994
- uses: actions-rs/cargo@v1
9095
with:
9196
command: check
92-
args: --features=rt,defmt,${{ matrix.mcu }} --test ${{ matrix.test }}
97+
args: --features=ld,defmt,${{ matrix.mcu }} --test ${{ matrix.test }}
9398

9499
clippy:
95100
name: Clippy
@@ -107,7 +112,7 @@ jobs:
107112
with:
108113
token: ${{ secrets.GITHUB_TOKEN }}
109114
args: >
110-
--features=stm32f303xc,rt,stm32-usbd,can --lib --examples
115+
--features=stm32f303xc,ld,rt,stm32-usbd,can --lib --examples
111116
-- -D warnings
112117
113118
rustfmt:

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1515
- Enable better GPIO internal resistor configuration ([#189])
1616
- Support for GPIO output slew rate configuration ([#189])
1717
- Support for GPIO interrupts ([#189])
18+
- `ld` feature, which enables the memory.x generation ([#216])
1819

1920
### Changed
2021

@@ -26,6 +27,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2627

2728
- Delay based on systick no longer panics ([#203]) for to high values
2829
and support longer delays ([#208])
30+
- Long delay during ADC initialization ([#217])
2931

3032
### Breaking Changes
3133

@@ -35,6 +37,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3537
If the supplied frequency cannot be converted to `Hertz` the code
3638
will `panic`. This will occur if the supplied `Megahertz` frequency
3739
cannot fit into `u32::MAX` when converting to `Hertz` ([#192])
40+
- You always required to select a sub-target for target chips ([#216])
3841

3942
```rust
4043
// The supplied frequencies must be in `MHz`.
@@ -313,6 +316,8 @@ let clocks = rcc
313316
[defmt]: https://github.com/knurling-rs/defmt
314317
[filter]: https://defmt.ferrous-systems.com/filtering.html
315318

319+
[#217]: https://github.com/stm32-rs/stm32f3xx-hal/pull/217
320+
[#216]: https://github.com/stm32-rs/stm32f3xx-hal/pull/216
316321
[#211]: https://github.com/stm32-rs/stm32f3xx-hal/pull/211
317322
[#210]: https://github.com/stm32-rs/stm32f3xx-hal/pull/210
318323
[#208]: https://github.com/stm32-rs/stm32f3xx-hal/pull/208

Cargo.toml

Lines changed: 62 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -66,39 +66,67 @@ default = ["unproven"]
6666
unproven = ["embedded-hal/unproven"]
6767
device-selected = []
6868
direct-call-deprecated = []
69+
ld = []
6970
rt = ["stm32f3/rt"]
7071
can = ["embedded-hal-can"]
7172

73+
svd-f301 = ["stm32f3/stm32f301"]
74+
svd-f302 = ["stm32f3/stm32f302"]
75+
svd-f303 = ["stm32f3/stm32f303"]
76+
svd-f373 = ["stm32f3/stm32f373"]
77+
svd-f3x4 = ["stm32f3/stm32f3x4"]
78+
79+
mem-4 = []
80+
mem-6 = []
81+
mem-8 = []
82+
mem-b = []
83+
mem-c = []
84+
mem-d = []
85+
mem-e = []
86+
7287
gpio-f302 = []
7388
gpio-f303 = []
7489
gpio-f303e = []
7590
gpio-f333 = []
7691
gpio-f373 = []
7792

78-
# Any changes here should be mirrored in README.md, src/lib.rs, and
93+
# Any changes here should be mirrored in README.md, build.rs, src/lib.rs, and
7994
# .github/workflows/ci.yml.
80-
stm32f301 = ["gpio-f302", "stm32f3/stm32f301", "device-selected"]
81-
stm32f318 = ["gpio-f302", "stm32f3/stm32f301", "device-selected"]
82-
stm32f302 = ["stm32f3/stm32f302", "direct-call-deprecated"]
83-
stm32f302x6 = ["stm32f302", "gpio-f302", "device-selected"]
84-
stm32f302x8 = ["stm32f302", "gpio-f302", "device-selected"]
85-
stm32f302xb = ["stm32f302", "gpio-f303", "device-selected"]
86-
stm32f302xc = ["stm32f302", "gpio-f303", "device-selected"]
87-
stm32f302xd = ["stm32f302", "gpio-f303e", "device-selected"]
88-
stm32f302xe = ["stm32f302", "gpio-f303e", "device-selected"]
89-
stm32f303 = ["stm32f3/stm32f303", "direct-call-deprecated"]
90-
stm32f303x6 = ["stm32f303", "gpio-f333", "device-selected"]
91-
stm32f303x8 = ["stm32f303", "gpio-f333", "device-selected"]
92-
stm32f303xb = ["stm32f303", "gpio-f303", "device-selected"]
93-
stm32f303xc = ["stm32f303", "gpio-f303", "device-selected"]
94-
stm32f303xd = ["stm32f303", "gpio-f303e", "device-selected"]
95-
stm32f303xe = ["stm32f303", "gpio-f303e", "device-selected"]
96-
stm32f328 = ["gpio-f333", "stm32f3/stm32f303", "device-selected"]
97-
stm32f358 = ["gpio-f303", "stm32f3/stm32f303", "device-selected"]
98-
stm32f398 = ["gpio-f303e", "stm32f3/stm32f303", "device-selected"]
99-
stm32f373 = ["gpio-f373", "stm32f3/stm32f373", "device-selected"]
100-
stm32f378 = ["gpio-f373", "stm32f3/stm32f373", "device-selected"]
101-
stm32f334 = ["gpio-f333", "stm32f3/stm32f3x4", "device-selected"]
95+
stm32f301 = ["svd-f301", "direct-call-deprecated"]
96+
stm32f301x6 = ["stm32f301", "mem-6", "gpio-f302", "device-selected"]
97+
stm32f301x8 = ["stm32f301", "mem-8", "gpio-f302", "device-selected"]
98+
stm32f318 = ["svd-f301", "direct-call-deprecated"]
99+
stm32f318x8 = ["stm32f318", "mem-8", "gpio-f302", "device-selected"]
100+
stm32f302 = ["svd-f302", "direct-call-deprecated"]
101+
stm32f302x6 = ["stm32f302", "mem-6", "gpio-f302", "device-selected"]
102+
stm32f302x8 = ["stm32f302", "mem-8", "gpio-f302", "device-selected"]
103+
stm32f302xb = ["stm32f302", "mem-b", "gpio-f303", "device-selected"]
104+
stm32f302xc = ["stm32f302", "mem-c", "gpio-f303", "device-selected"]
105+
stm32f302xd = ["stm32f302", "mem-d", "gpio-f303e", "device-selected"]
106+
stm32f302xe = ["stm32f302", "mem-e", "gpio-f303e", "device-selected"]
107+
stm32f303 = ["svd-f303", "direct-call-deprecated"]
108+
stm32f303x6 = ["stm32f303", "mem-6", "gpio-f333", "device-selected"]
109+
stm32f303x8 = ["stm32f303", "mem-8", "gpio-f333", "device-selected"]
110+
stm32f303xb = ["stm32f303", "mem-b", "gpio-f303", "device-selected"]
111+
stm32f303xc = ["stm32f303", "mem-c", "gpio-f303", "device-selected"]
112+
stm32f303xd = ["stm32f303", "mem-d", "gpio-f303e", "device-selected"]
113+
stm32f303xe = ["stm32f303", "mem-e", "gpio-f303e", "device-selected"]
114+
stm32f328 = ["svd-f303", "direct-call-deprecated"]
115+
stm32f328x8 = ["stm32f328", "mem-8", "gpio-f333", "device-selected"]
116+
stm32f358 = ["svd-f303", "direct-call-deprecated"]
117+
stm32f358xc = ["stm32f358", "mem-c", "gpio-f303", "device-selected"]
118+
stm32f398 = ["svd-f303", "direct-call-deprecated"]
119+
stm32f398xe = ["stm32f398", "mem-e", "gpio-f303e", "device-selected"]
120+
stm32f373 = ["svd-f373", "direct-call-deprecated"]
121+
stm32f373x8 = ["stm32f373", "mem-8", "gpio-f373", "device-selected"]
122+
stm32f373xb = ["stm32f373", "mem-b", "gpio-f373", "device-selected"]
123+
stm32f373xc = ["stm32f373", "mem-c", "gpio-f373", "device-selected"]
124+
stm32f378 = ["svd-f373", "direct-call-deprecated"]
125+
stm32f378xc = ["stm32f378", "mem-c", "gpio-f373", "device-selected"]
126+
stm32f334 = ["svd-f3x4", "direct-call-deprecated"]
127+
stm32f334x4 = ["stm32f334", "mem-4", "gpio-f333", "device-selected"]
128+
stm32f334x6 = ["stm32f334", "mem-6", "gpio-f333", "device-selected"]
129+
stm32f334x8 = ["stm32f334", "mem-8", "gpio-f333", "device-selected"]
102130

103131
defmt-default = ["defmt"]
104132
defmt-trace = ["defmt"]
@@ -118,45 +146,45 @@ opt-level = "s"
118146

119147
[[example]]
120148
name = "pwm"
121-
required-features = ["stm32f303xc"]
149+
required-features = ["ld", "stm32f303xc"]
122150

123151
[[example]]
124152
name = "toggle"
125-
required-features = ["rt", "stm32f303xc"]
153+
required-features = ["ld", "stm32f303xc"]
126154

127155
[[example]]
128156
name = "usb_serial"
129-
required-features = ["rt", "stm32f303xc", "stm32-usbd"]
157+
required-features = ["ld", "stm32f303xc", "stm32-usbd"]
130158

131159
[[example]]
132160
name = "spi"
133-
required-features = ["stm32f303"]
161+
required-features = ["ld", "stm32f303"]
134162

135163
[[example]]
136164
name = "can"
137-
required-features = ["rt", "can", "stm32f303"]
165+
required-features = ["ld", "can", "stm32f303"]
138166

139167
[[example]]
140168
name = "serial_dma"
141-
required-features = ["stm32f303"]
169+
required-features = ["ld", "stm32f303"]
142170

143171
[[example]]
144172
name = "adc"
145-
required-features = ["stm32f303"]
173+
required-features = ["ld", "stm32f303"]
146174

147175
[[example]]
148176
name = "i2c_scanner"
149-
required-features = ["stm32f303xc"]
177+
required-features = ["ld", "stm32f303xc"]
150178

151179
[[example]]
152180
name = "gpio_erased"
153-
required-features = ["rt", "stm32f303xc"]
181+
required-features = ["ld", "stm32f303xc"]
154182

155183
[[example]]
156184
name = "gpio_interrupts"
157-
required-features = ["rt", "stm32f303xc"]
185+
required-features = ["ld", "rt", "stm32f303xc"]
158186

159187
[[test]]
160188
name = "rcc"
161-
required-features = ["rt", "defmt"]
189+
required-features = ["ld", "defmt"]
162190
harness = false

0 commit comments

Comments
 (0)