Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make features explicit for stm32h7[45b]3 #241

Merged
merged 1 commit into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions build-i2c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ cfg-if = "0.1.10"
multimap = "0.8.3"
convert_case = "0.4"

[features]
default = ["standalone"]
standalone = ["h753"]
h743 = []
h753 = []
h7b3 = []
11 changes: 7 additions & 4 deletions build-i2c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,14 @@ impl ConfigGenerator {
use drv_stm32h7_rcc_api::Peripheral;
use drv_i2c_api::Controller;

#[cfg(feature = "h7b3")]
use stm32h7::stm32h7b3 as device;

#[cfg(feature = "h743")]
use stm32h7::stm32h743 as device;"##
use stm32h7::stm32h743 as device;

#[cfg(feature = "h753")]
use stm32h7::stm32h753 as device;

#[cfg(feature = "h7b3")]
use stm32h7::stm32h7b3 as device;"##
)?;
}

Expand Down
12 changes: 9 additions & 3 deletions demo-stm32h7/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ name = "demo-stm32h7"
version = "0.1.0"

[features]
default = ["itm", "standalone"]
standalone = ["h743"]
default = ["standalone"]
standalone = ["itm", "h743"]
lzrd marked this conversation as resolved.
Show resolved Hide resolved
itm = ["panic-itm", "kern/klog-itm"]
semihosting = ["panic-semihosting", "kern/klog-semihosting"]
h743 = ["stm32h7/stm32h743"]
h753 = ["stm32h7/stm32h753"]
h7b3 = ["stm32h7/stm32h7b3"]
# Available but unused:
# h743v = ["stm32h7/stm32h743v"]
# h747cm4 = ["stm32h7/stm32h747cm4"]
# h747cm7 = ["stm32h7/stm32h747cm7"]
# h753v = ["stm32h7/stm32h753v"]

[dependencies]
cortex-m = { version = "0.7", features = ["inline-asm"] }
Expand All @@ -21,7 +27,7 @@ panic-itm = { version = "0.4.1", optional = true }
panic-halt = { version = "0.2.0", optional = true }
panic-semihosting = { version = "0.5.3", optional = true }
cfg-if = "0.1.10"
stm32h7 = { version = "0.13.0", features = ["rt"] }
stm32h7 = { version = "0.13.0", default-features = false, features = ["rt"] }

[dependencies.kern]
path = "../kern"
Expand Down
8 changes: 4 additions & 4 deletions demo-stm32h7/app-h743.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ requires = {flash = 32768, ram = 4096}
# If one does choose to change this to semihosting for purposes of
# development, be sure to also change it in every task of interest.
#
features = ["itm", "h743"]
features = ["h743", "itm"]

[supervisor]
notification = 1
Expand Down Expand Up @@ -112,7 +112,7 @@ path = "../drv/stm32h7-spi-server"
name = "drv-stm32h7-spi-server"
priority = 2
requires = {flash = 16384, ram = 4096}
features = ["spi3"]
features = ["spi3", "h743"]
uses = ["spi3"]
start = true
interrupts = {51 = 1}
Expand Down Expand Up @@ -146,7 +146,7 @@ user_leds = "user_leds"
[tasks.hiffy]
path = "../task-hiffy"
name = "task-hiffy"
features = ["stm32h7", "itm", "i2c", "gpio", "qspi"]
features = ["h743", "stm32h7", "itm", "i2c", "gpio", "qspi"]
priority = 3
requires = {flash = 32768, ram = 32768 }
stacksize = 2048
Expand All @@ -160,7 +160,7 @@ i2c_driver = "i2c_driver"
[tasks.hf]
path = "../drv/gimlet-hf-server"
name = "drv-gimlet-hf-server"
features = []
features = ["h743"]
priority = 3
requires = {flash = 16384, ram = 8192 }
stacksize = 2048
Expand Down
4 changes: 2 additions & 2 deletions demo-stm32h7/app-h7b3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ requires = {flash = 32768, ram = 4096}
# If one does choose to change this to semihosting for purposes of
# development, be sure to also change it in every task of interest.
#
features = ["itm", "h7b3"]
features = ["h7b3", "itm"]

[supervisor]
notification = 1
Expand Down Expand Up @@ -135,7 +135,7 @@ usart_driver = "usart_driver"
[tasks.hiffy]
path = "../task-hiffy"
name = "task-hiffy"
features = ["stm32h7", "itm", "i2c"]
features = ["h7b3", "stm32h7", "itm", "i2c"]
priority = 3
requires = {flash = 32768, ram = 16384 }
start = true
Expand Down
2 changes: 1 addition & 1 deletion demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ version = "0.1.0"

[features]
default = ["standalone"]
standalone = ["itm", "stm32f4"]
itm = ["panic-itm", "kern/klog-itm"]
semihosting = ["panic-semihosting", "kern/klog-semihosting"]
standalone = ["itm", "stm32f4"]

# a target for `cargo xtask check`
[package.metadata.build]
Expand Down
2 changes: 1 addition & 1 deletion demo/app-f3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ stacksize = 1536
[tasks.rcc_driver]
path = "../drv/stm32fx-rcc"
name = "drv-stm32fx-rcc"
features = ["stm32f3"]
features = ["f3"]
priority = 1
requires = {flash = 8192, ram = 1024}
uses = ["rcc"]
Expand Down
3 changes: 2 additions & 1 deletion demo/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ stacksize = 1536
[tasks.rcc_driver]
path = "../drv/stm32fx-rcc"
name = "drv-stm32fx-rcc"
features = ["stm32f4"]
features = ["f4"]
priority = 1
requires = {flash = 8192, ram = 1024}
uses = ["rcc"]
Expand Down Expand Up @@ -105,6 +105,7 @@ user_leds = "user_leds"
path = "../task-hiffy"
name = "task-hiffy"
priority = 3
features = ["stm32f4"]
requires = {flash = 32768, ram = 16384 }
stacksize = 2048
start = true
Expand Down
12 changes: 7 additions & 5 deletions drv/gimlet-hf-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ edition = "2018"

[dependencies]
userlib = {path = "../../userlib"}
stm32h7 = { version = "0.13.0", features = ["stm32h743"] }
drv-stm32h7-rcc-api = {path = "../stm32h7-rcc-api", features = ["h743"]}
drv-stm32h7-gpio-api = {path = "../stm32h7-gpio-api"}
drv-stm32h7-qspi = {path = "../stm32h7-qspi"}
stm32h7 = { version = "0.13.0", default-features = false }
drv-stm32h7-rcc-api = {path = "../stm32h7-rcc-api", default-features = false}
drv-stm32h7-gpio-api = {path = "../stm32h7-gpio-api", default-features = false}
drv-stm32h7-qspi = {path = "../stm32h7-qspi", default-features = false}
cfg-if = "0.1.10"
num-traits = { version = "0.2.12", default-features = false }
drv-gimlet-hf-api = {path = "../gimlet-hf-api"}
Expand All @@ -21,7 +21,9 @@ build-util = {path = "../../build-util"}

[features]
default = ["standalone"]
standalone = []
standalone = ["h753"]
h743 = ["stm32h7/stm32h743", "drv-stm32h7-rcc-api/h743", "drv-stm32h7-qspi/h743"]
h753 = ["stm32h7/stm32h753", "drv-stm32h7-rcc-api/h753", "drv-stm32h7-qspi/h753"]

# a target for `cargo xtask check`
[package.metadata.build]
Expand Down
7 changes: 7 additions & 0 deletions drv/gimlet-hf-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ use userlib::*;
use drv_stm32h7_gpio_api as gpio_api;
use drv_stm32h7_qspi::Qspi;
use drv_stm32h7_rcc_api as rcc_api;

// Note: h7b3 has QUADSPI but has not been used in this project.

#[cfg(feature = "h743")]
use stm32h7::stm32h743 as device;

#[cfg(feature = "h753")]
use stm32h7::stm32h753 as device;

use drv_gimlet_hf_api::{HfError, InternalHfError, Operation};

task_slot!(RCC, rcc_driver);
Expand Down
7 changes: 4 additions & 3 deletions drv/gimlet-seq-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ edition = "2018"
userlib = {path = "../../userlib"}
zerocopy = "0.3.0"
num-traits = { version = "0.2.12", default-features = false }
drv-stm32h7-spi = {path = "../stm32h7-spi"}
drv-stm32h7-rcc-api = {path = "../stm32h7-rcc-api"}
drv-stm32h7-spi = {path = "../stm32h7-spi", default-features = false }
drv-stm32h7-rcc-api = {path = "../stm32h7-rcc-api", default-features = false}
drv-stm32h7-gpio-api = {path = "../stm32h7-gpio-api"}
drv-spi-api = {path = "../spi-api"}
drv-ice40-spi-program = {path = "../ice40-spi-program"}
Expand All @@ -24,7 +24,8 @@ gnarle = {path = "../../gnarle"}

[features]
default = ["standalone"]
standalone = []
standalone = ["h753"]
h753 = ["drv-stm32h7-spi/h753", "drv-stm32h7-rcc-api/h753"]

# a target for `cargo xtask check`
[package.metadata.build]
Expand Down
8 changes: 5 additions & 3 deletions drv/stm32fx-rcc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ edition = "2018"

[dependencies]
userlib = {path = "../../userlib"}
stm32f3 = { version = "0.13.0", features = ["stm32f303"], optional = true }
stm32f4 = { version = "0.13.0", features = ["stm32f407"], optional = true }
stm32f3 = { version = "0.13.0", optional = true, default-features = false }
stm32f4 = { version = "0.13.0", optional = true, default-features = false }
zerocopy = "0.3.0"
num-traits = { version = "0.2.12", default-features = false }

[features]
default = ["standalone"]
standalone = ["stm32f4"]
standalone = ["f4"]
f3 = ["stm32f3/stm32f303"]
f4 = ["stm32f4/stm32f407"]

# a target for `cargo xtask check`
[package.metadata.build]
Expand Down
11 changes: 6 additions & 5 deletions drv/stm32h7-gpio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ userlib = {path = "../../userlib"}
zerocopy = "0.3.0"
byteorder = { version = "1.3.4", default-features = false }
num-traits = { version = "0.2.12", default-features = false }
drv-stm32h7-rcc-api = {path = "../stm32h7-rcc-api"}
stm32h7 = { version = "0.13.0" }
drv-stm32h7-rcc-api = {path = "../stm32h7-rcc-api", default-features = false }
stm32h7 = { version = "0.13.0", default-features = false }
cortex-m = { version = "0.7", features = ["inline-asm"] }

[features]
default = ["standalone"]
standalone = ["h743"]
h743 = ["stm32h7/stm32h743"]
h7b3 = ["stm32h7/stm32h7b3"]
standalone = ["h753"]
h743 = ["stm32h7/stm32h743", "drv-stm32h7-rcc-api/h743"]
h753 = ["stm32h7/stm32h753", "drv-stm32h7-rcc-api/h753"]
h7b3 = ["stm32h7/stm32h7b3", "drv-stm32h7-rcc-api/h7b3"]

# a target for `cargo xtask check`
[package.metadata.build]
Expand Down
4 changes: 4 additions & 0 deletions drv/stm32h7-gpio/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ use zerocopy::{AsBytes, FromBytes, Unaligned, U16, U32};

#[cfg(feature = "h743")]
use stm32h7::stm32h743 as device;

#[cfg(feature = "h753")]
use stm32h7::stm32h753 as device;

#[cfg(feature = "h7b3")]
use stm32h7::stm32h7b3 as device;

Expand Down
9 changes: 5 additions & 4 deletions drv/stm32h7-i2c-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ userlib = {path = "../../userlib"}
ringbuf = {path = "../../ringbuf"}
num-traits = { version = "0.2.12", default-features = false }
drv-stm32h7-gpio-api = {path = "../stm32h7-gpio-api"}
drv-stm32h7-rcc-api = {path = "../stm32h7-rcc-api"}
drv-stm32h7-rcc-api = {path = "../stm32h7-rcc-api", default-features = false}
drv-stm32h7-i2c = {path = "../stm32h7-i2c", default-features = false }
drv-i2c-api = {path = "../i2c-api"}
cortex-m-semihosting = "0.3.5"
Expand All @@ -26,9 +26,10 @@ cfg-if = "0.1.10"

[features]
default = ["standalone"]
standalone = [ "h743" ]
h7b3 = ["stm32h7/stm32h7b3", "drv-stm32h7-i2c/h7b3"]
h743 = ["stm32h7/stm32h743", "drv-stm32h7-i2c/h743"]
standalone = [ "h753" ]
h7b3 = ["stm32h7/stm32h7b3", "drv-stm32h7-i2c/h7b3", "drv-stm32h7-rcc-api/h7b3", "build-i2c/h7b3"]
h743 = ["stm32h7/stm32h743", "drv-stm32h7-i2c/h743", "drv-stm32h7-rcc-api/h743", "build-i2c/h743"]
h753 = ["stm32h7/stm32h753", "drv-stm32h7-i2c/h753", "drv-stm32h7-rcc-api/h753", "build-i2c/h753"]
itm = [ "userlib/log-itm" ]

# These options allow for external muxes on the Gemini bringup board:
Expand Down
11 changes: 6 additions & 5 deletions drv/stm32h7-i2c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ ringbuf = {path = "../../ringbuf"}
zerocopy = "0.3.0"
num-traits = { version = "0.2.12", default-features = false }
drv-stm32h7-gpio-api = {path = "../stm32h7-gpio-api"}
drv-stm32h7-rcc-api = {path = "../stm32h7-rcc-api"}
drv-stm32h7-rcc-api = {path = "../stm32h7-rcc-api", default-features = false}
drv-i2c-api = {path = "../i2c-api"}
cortex-m-semihosting = "0.3.5"
cortex-m = { version = "0.7", features = ["inline-asm"] }
cfg-if = "0.1.10"
bitfield = "0.13"
stm32h7 = { version = "0.13.0" }
stm32h7 = { version = "0.13.0", default-features = false }

[features]
default = ["standalone"]
standalone = [ "h743" ]
h7b3 = ["stm32h7/stm32h7b3"]
h743 = ["stm32h7/stm32h743"]
standalone = [ "h753" ]
h743 = ["stm32h7/stm32h743", "drv-stm32h7-rcc-api/h743"]
h753 = ["stm32h7/stm32h753", "drv-stm32h7-rcc-api/h753"]
h7b3 = ["stm32h7/stm32h7b3", "drv-stm32h7-rcc-api/h7b3"]
itm = [ "userlib/log-itm" ]

# a target for `cargo xtask check`
Expand Down
9 changes: 6 additions & 3 deletions drv/stm32h7-i2c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ use stm32h7::stm32h7b3 as device;
#[cfg(feature = "h743")]
use stm32h7::stm32h743 as device;

#[cfg(feature = "h753")]
use stm32h7::stm32h753 as device;

#[cfg(feature = "h7b3")]
pub type RegisterBlock = device::i2c3::RegisterBlock;

#[cfg(feature = "h743")]
#[cfg(any(feature = "h743", feature = "h753"))]
pub type RegisterBlock = device::i2c1::RegisterBlock;

pub mod ltc4306;
Expand Down Expand Up @@ -213,7 +216,7 @@ impl<'a> I2cController<'a> {
.scldel().bits(8)
.sdadel().bits(0)
});
} else if #[cfg(feature = "h743")] {
} else if #[cfg(any(feature = "h743", feature = "h753"))] {
// Here our APB1 peripheral clock is 100MHz, yielding the
// following:
//
Expand Down Expand Up @@ -250,7 +253,7 @@ impl<'a> I2cController<'a> {
// t_i2cclk this yields 1219.7 (1220); on h7b3, this is 3416.9
// (3417).
//
if #[cfg(feature = "h743")] {
if #[cfg(any(feature = "h743", feature = "h753"))] {
i2c.timeoutr.write(|w| { w
.timouten().set_bit() // Enable SCL timeout
.timeouta().bits(1220) // Timeout value
Expand Down
8 changes: 7 additions & 1 deletion drv/stm32h7-qspi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
stm32h7 = { version = "0.13.0", features = ["stm32h743"] }
stm32h7 = { version = "0.13.0" }
vcell = "0.1.2"
zerocopy = "0.3.0"
userlib = {path = "../../userlib"}

# a target for `cargo xtask check`
[package.metadata.build]
target = "thumbv7em-none-eabihf"

[features]
default = ["standalone"]
standalone = ["h753"]
h743 = ["stm32h7/stm32h743"]
h753 = ["stm32h7/stm32h753"]
7 changes: 7 additions & 0 deletions drv/stm32h7-qspi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

#![no_std]

// Note that stm32h7b3 has QUADSPI support also.

#[cfg(feature = "h743")]
use stm32h7::stm32h743 as device;

#[cfg(feature = "h753")]
use stm32h7::stm32h753 as device;

use userlib::{sys_irq_control, sys_recv_closed, TaskId};
use zerocopy::AsBytes;

Expand Down
Loading