[PATCH RFC v2 2/5] rust: add hw/gpio crate to the workspace
Jack Wang <[email protected]>
| Newsgroups | org.nongnu.qemu-rust,org.nongnu.qemu-arm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
Add the stm32f1xx_gpio crate to the QEMU Rust workspace and Meson/Kconfig build graph. Build it only when Rust support and the STM32F1xx GPIO configuration are enabled. Keep native test registration out of this commit; it is added together with the test source later in the series. Signed-off-by: Jack Wang <[email protected]> --- Cargo.lock | 15 +++++++++++++++ Cargo.toml | 1 + rust/hw/Kconfig | 1 + rust/hw/gpio/Cargo.toml | 30 ++++++++++++++++++++++++++++++ rust/hw/gpio/meson.build | 8 ++++++++ rust/hw/meson.build | 1 + 6 files changed, 56 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index ad664a812d..507257384e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -314,6 +314,21 @@ version = "1.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" +[[package]] +name = "stm32f1xx_gpio" +version = "0.1.0" +dependencies = [ + "bql", + "common", + "glib-sys", + "hwcore", + "migration", + "qom", + "system", + "trace", + "util", +] + [[package]] name = "syn" version = "2.0.104" diff --git a/Cargo.toml b/Cargo.toml index b35704faab..5e25c307c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ resolver = "2" members = [ "rust/hw/char/pl011", + "rust/hw/gpio", "rust/hw/timer/hpet", "rust/tests", ] diff --git a/rust/hw/Kconfig b/rust/hw/Kconfig index 36f92ec028..ba1297ca2d 100644 --- a/rust/hw/Kconfig +++ b/rust/hw/Kconfig @@ -1,3 +1,4 @@ # devices Kconfig source char/Kconfig +source gpio/Kconfig source timer/Kconfig diff --git a/rust/hw/gpio/Cargo.toml b/rust/hw/gpio/Cargo.toml new file mode 100644 index 0000000000..f6a1407984 --- /dev/null +++ b/rust/hw/gpio/Cargo.toml @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +[package] +name = "stm32f1xx_gpio" +version = "0.1.0" +description = "STM32F1xx GPIO device model for QEMU" +resolver = "2" +publish = false + +edition.workspace = true +homepage.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true + +[dependencies] +glib-sys.workspace = true + +# QEMU Rust foundations crate +common = { path = "../../common" } +util = { path = "../../util" } +bql = { path = "../../bql" } +migration = { path = "../../migration" } +qom = { path = "../../qom" } +system = { path = "../../system" } +hwcore = { path = "../../hw/core" } +trace = { path = "../../trace" } + +[lints] +workspace = true diff --git a/rust/hw/gpio/meson.build b/rust/hw/gpio/meson.build new file mode 100644 index 0000000000..e359d7e329 --- /dev/null +++ b/rust/hw/gpio/meson.build @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +_libstm32f1xx_gpio_rs = cargo_ws.package('stm32f1xx_gpio').library() + +rust_devices_ss.add(when: 'CONFIG_X_STM32F1XX_GPIO_RUST', if_true: [declare_dependency( + link_whole: [_libstm32f1xx_gpio_rs], + variables: {'crate': 'stm32f1xx_gpio'}, +)]) diff --git a/rust/hw/meson.build b/rust/hw/meson.build index 9749d4adfc..d6b273170e 100644 --- a/rust/hw/meson.build +++ b/rust/hw/meson.build @@ -1,2 +1,3 @@ subdir('char') +subdir('gpio') subdir('timer') -- 2.53.0