Skip to content

Commit cbfb8fa

Browse files
committed
Upgrade cortex-m-rt and PACs to ~2022
I noticed that our cortex-m-rt version was generating potentially invalid code in the Reset function -- setting up and tearing down a stack frame, before we've turned on RAM! This bug got fixed in the upstream cortex-m-rt crate, but we haven't upgraded in ... quite a while. This upgrades to a compromise point -- 0.15 of the stm32 pacs. Upgrading farther than that causes massive API incompatibilities, since it looks like they've comprehensively changed the svd2rust generated code. Rather than touch literally every driver in the system, I've settled on 0.15 and left 0.16 as a trap for the future. As you can see, this still required a fair amount of churn, mostly due to renamed enum variants.
1 parent 4dfe978 commit cbfb8fa

File tree

17 files changed

+79
-86
lines changed

17 files changed

+79
-86
lines changed

Cargo.lock

Lines changed: 17 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ colored = { version = "2.0", default-features = false }
6363
convert_case = { version = "0.4", default-features = false }
6464
corncobs = { version = "0.1.1", default-features = false }
6565
cortex-m = { version = "0.7", default-features = false, features = ["inline-asm"]}
66-
cortex-m-rt = { version = "0.6.12", default-features = false }
66+
cortex-m-rt = { version = "0.7.5", default-features = false }
6767
cortex-m-semihosting = { version = "0.5.0", default-features = false }
6868
crc = { version = "3.0.0", default-features = false }
6969
critical-section = { version = "1.1.2" }
@@ -89,7 +89,7 @@ indexmap = { version = "1.4.0", default-features = false, features = ["serde-1"]
8989
indoc = { version = "2.0.3", default-features = false }
9090
itertools = { version = "0.10.5", default-features = false }
9191
leb128 = { version = "0.2.5", default-features = false }
92-
lpc55-pac = { version = "0.4", default-features = false }
92+
lpc55-pac = { version = "0.5", default-features = false }
9393
memchr = { version = "2.4", default-features = false }
9494
memoffset = { version = "0.6.5", default-features = false }
9595
minicbor = { version = "2.1.1", default-features = false }
@@ -127,10 +127,10 @@ ssh-key = { version = "0.6.6", default-features = false, features = ["std", "p25
127127
spin = { version = "0.9.4", default-features = false, features = ["mutex", "spin_mutex"]}
128128
ssmarshal = { version = "1.0.0", default-features = false }
129129
static_assertions = { version = "1", default-features = false }
130-
stm32f3 = { version = "0.13.0", default-features = false }
131-
stm32f4 = { version = "0.13.0", default-features = false }
132-
stm32h7 = { version = "0.14", default-features = false }
133-
stm32g0 = { version = "0.15.1", default-features = false }
130+
stm32f3 = { version = "0.15", default-features = false }
131+
stm32f4 = { version = "0.15", default-features = false }
132+
stm32h7 = { version = "0.15", default-features = false }
133+
stm32g0 = { version = "0.15", default-features = false }
134134
strsim = { version = "0.10.0", default-features = false }
135135
syn = { version = "2", default-features = false, features = ["derive", "parsing", "proc-macro", "extra-traits", "full", "printing"] }
136136
toml = { version = "0.9.6", default-features = false, features = ["parse", "display", "serde", "preserve_order"] }

app/cosmo/base.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ input = {port = "B", pin = 14, af = 5}
13891389
[config.spi.spi2.devices.spartan7_fpga]
13901390
mux = "port_b"
13911391
cs = []
1392-
clock_divider = "DIV8" # 12.5 MHz
1392+
clock_divider = "Div8" # 12.5 MHz
13931393
# no CS pin; we're using the SPI peripheral to send synchronized CLK + DATA
13941394

13951395
# SPI_SP_TO_KSZ8463_SCK
@@ -1444,7 +1444,7 @@ input = {port = "J", pin = 11, af = 5}
14441444
[config.spi.spi5.devices.rot]
14451445
mux = "port_j"
14461446
cs = [{port = "K", pin = 1}]
1447-
clock_divider = "DIV256"
1447+
clock_divider = "Div256"
14481448

14491449
################################################################################
14501450

app/demo-stm32h7-nucleo/app-h743.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ input = {port = "A", pin = 6, af = 5} # miso
185185
[config.spi.spi1.devices.pins]
186186
mux = "cn7_arduino"
187187
cs = [{port = "D", pin = 14}]
188-
clock_divider = "DIV16"
188+
clock_divider = "Div16"
189189

190190

191191
[config.net]

app/demo-stm32h7-nucleo/app-h753.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ input = {port = "A", pin = 6, af = 5}
233233
[config.spi.spi1.devices.pins]
234234
mux = "cn7_arduino"
235235
cs = [{port = "D", pin = 14}]
236-
clock_divider = "DIV32"
236+
clock_divider = "Div32"
237237

238238
[config.net]
239239
# UDP ports in sockets below are assigned in oxidecomputer/oana

app/gemini-bu/app.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,4 @@ input = {port = "E", pin = 5, af = 5}
321321
[config.spi.spi4.devices.rot]
322322
mux = "port_e"
323323
cs = [{port = "E", pin = 4}]
324-
clock_divider = "DIV256"
324+
clock_divider = "Div256"

app/gimlet/base.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ input = {port = "E", pin = 5, af = 5}
12881288
[config.spi.spi4.devices.rot]
12891289
mux = "rot"
12901290
cs = [{port = "E", pin = 4}]
1291-
clock_divider = "DIV256"
1291+
clock_divider = "Div256"
12921292

12931293
# VLAN configuration
12941294
[config.net.vlans.sidecar1]

app/gimlet/src/main.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ fn system_init() {
137137
// the prescaler.
138138
divm: 1,
139139
// VCO must tolerate an 8MHz input range:
140-
vcosel: device::rcc::pllcfgr::PLL1VCOSEL_A::WIDEVCO,
141-
pllrange: device::rcc::pllcfgr::PLL1RGE_A::RANGE8,
140+
vcosel: device::rcc::pllcfgr::PLL1VCOSEL_A::WideVco,
141+
pllrange: device::rcc::pllcfgr::PLL1RGE_A::Range8,
142142
// DIVN governs the multiplication of the VCO input frequency to produce
143143
// the intermediate frequency. We want an IF of 800MHz, or a
144144
// multiplication of 100x.
@@ -148,23 +148,23 @@ fn system_init() {
148148
divn: 100 - 1,
149149
// P is the divisor from the VCO IF to the system frequency. We want
150150
// 400MHz, so:
151-
divp: device::rcc::pll1divr::DIVP1_A::DIV2,
151+
divp: device::rcc::pll1divr::DIVP1_A::Div2,
152152
// Q produces kernel clocks; we set it to 200MHz:
153153
divq: 4 - 1,
154154
// R is mostly used by the trace unit and we leave it fast:
155155
divr: 2 - 1,
156156

157157
// We run the CPU at the full core rate of 400MHz:
158-
cpu_div: device::rcc::d1cfgr::D1CPRE_A::DIV1,
158+
cpu_div: device::rcc::d1cfgr::D1CPRE_A::Div1,
159159
// We down-shift the AHB by a factor of 2, to 200MHz, to meet its
160160
// constraints:
161-
ahb_div: device::rcc::d1cfgr::HPRE_A::DIV2,
161+
ahb_div: device::rcc::d1cfgr::HPRE_A::Div2,
162162
// We configure all APB for 100MHz. These are relative to the AHB
163163
// frequency.
164-
apb1_div: device::rcc::d2cfgr::D2PPRE1_A::DIV2,
165-
apb2_div: device::rcc::d2cfgr::D2PPRE2_A::DIV2,
166-
apb3_div: device::rcc::d1cfgr::D1PPRE_A::DIV2,
167-
apb4_div: device::rcc::d3cfgr::D3PPRE_A::DIV2,
164+
apb1_div: device::rcc::d2cfgr::D2PPRE1_A::Div2,
165+
apb2_div: device::rcc::d2cfgr::D2PPRE2_A::Div2,
166+
apb3_div: device::rcc::d1cfgr::D1PPRE_A::Div2,
167+
apb4_div: device::rcc::d3cfgr::D3PPRE_A::Div2,
168168

169169
// Flash runs at 200MHz: 2WS, 2 programming cycles. See reference manual
170170
// Table 13.

app/gimletlet/base-gimletlet2.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ input = {port = "C", pin = 11, af = 6}
176176
[config.spi.spi3.devices.spi3_header]
177177
mux = "port_c"
178178
cs = [{port = "A", pin = 15}]
179-
clock_divider = "DIV256" # 774 kHz, works with LPC55 clock at 48MHz
180-
# clock_divider = "DIV128" # 1.5 MHz, fails unless LPC55 clock is at 96MHz
179+
clock_divider = "Div256" # 774 kHz, works with LPC55 clock at 48MHz
180+
# clock_divider = "Div128" # 1.5 MHz, fails unless LPC55 clock is at 96MHz
181181

182182
[config.spi.spi4]
183183
controller = 4

app/grapefruit/base.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ input = {port = "B", pin = 14, af = 5} # not actually used in FPGA config
428428
[config.spi.spi2.devices.spartan7_fpga]
429429
mux = "port_b"
430430
cs = []
431-
clock_divider = "DIV8" # 12.5 MHz
431+
clock_divider = "Div8" # 12.5 MHz
432432
# no CS pin; we're using the SPI peripheral to send synchronized CLK + DATA
433433

434434
[config.spi.spi4]
@@ -443,7 +443,7 @@ input = {port = "E", pin = 5, af = 5}
443443
[config.spi.spi4.devices.rot]
444444
mux = "port_e"
445445
cs = [{port = "E", pin = 4}]
446-
clock_divider = "DIV256"
446+
clock_divider = "Div256"
447447

448448
################################################################################
449449

0 commit comments

Comments
 (0)