From e702b7d1de075a34c5c800fc9c03834dfbf424e1 Mon Sep 17 00:00:00 2001 From: Arjen Roodselaar Date: Wed, 31 Jan 2024 13:28:50 -0800 Subject: [PATCH] Sidecar: Add support for rev D mainboard (#1607) Fixes #1606 --- .github/workflows/build-boards.yml | 15 +++++++++++++-- app/sidecar/rev-c.toml | 2 +- app/sidecar/rev-d-dev.toml | 2 ++ app/sidecar/rev-d-lab.toml | 2 ++ app/sidecar/rev-d.toml | 7 +++++++ app/sidecar/src/main.rs | 2 ++ build/xtask/src/flash.rs | 6 ++++-- drv/fpga-server/src/main.rs | 6 ++++-- drv/sidecar-front-io/build.rs | 2 +- drv/sidecar-front-io/src/leds.rs | 8 ++++---- drv/sidecar-mainboard-controller/build.rs | 3 ++- ... => sidecar_mainboard_controller_rev_c_d.bit} | Bin drv/sidecar-seq-server/src/clock_generator.rs | 8 ++++++-- ...load_bc.rs => clock_generator_payload_bcd.rs} | 0 ...ock_generator_payload_bcd_pcie_common_ref.rs} | 0 drv/stm32h7-sprot-server/src/main.rs | 1 + .../src/bsp/{sidecar_bc.rs => sidecar_bcd.rs} | 0 task/monorail-server/src/main.rs | 10 ++++++++-- .../src/bsp/{sidecar_bc.rs => sidecar_bcd.rs} | 0 task/net/src/main.rs | 10 ++++++++-- task/packrat/build.rs | 2 +- .../src/bsp/{sidecar_bc.rs => sidecar_bcd.rs} | 0 task/power/src/main.rs | 8 ++++++-- .../src/bsp/{sidecar_bc.rs => sidecar_bcd.rs} | 0 task/thermal/src/main.rs | 8 ++++++-- 25 files changed, 78 insertions(+), 24 deletions(-) create mode 100644 app/sidecar/rev-d-dev.toml create mode 100644 app/sidecar/rev-d-lab.toml create mode 100644 app/sidecar/rev-d.toml rename drv/sidecar-mainboard-controller/{sidecar_mainboard_controller_rev_c.bit => sidecar_mainboard_controller_rev_c_d.bit} (100%) rename drv/sidecar-seq-server/src/{clock_generator_payload_bc.rs => clock_generator_payload_bcd.rs} (100%) rename drv/sidecar-seq-server/src/{clock_generator_payload_bc_pcie_common_ref.rs => clock_generator_payload_bcd_pcie_common_ref.rs} (100%) rename task/monorail-server/src/bsp/{sidecar_bc.rs => sidecar_bcd.rs} (100%) rename task/net/src/bsp/{sidecar_bc.rs => sidecar_bcd.rs} (100%) rename task/power/src/bsp/{sidecar_bc.rs => sidecar_bcd.rs} (100%) rename task/thermal/src/bsp/{sidecar_bc.rs => sidecar_bcd.rs} (100%) diff --git a/.github/workflows/build-boards.yml b/.github/workflows/build-boards.yml index 3811da896..a16b55b87 100644 --- a/.github/workflows/build-boards.yml +++ b/.github/workflows/build-boards.yml @@ -17,7 +17,7 @@ jobs: name: build-sidecar strategy: matrix: - build: [sidecar-b, sidecar-b-lab, sidecar-b-dev, sidecar-c, sidecar-c-lab, sidecar-c-dev] + build: [sidecar-b, sidecar-b-lab, sidecar-b-dev, sidecar-c, sidecar-c-lab, sidecar-c-dev, sidecar-d, sidecar-d-lab, sidecar-d-dev] include: - build: sidecar-b app_name: sidecar-b @@ -43,6 +43,18 @@ jobs: app_name: sidecar-c-dev app_toml: app/sidecar/rev-c-dev.toml image: default + - build: sidecar-d + app_name: sidecar-d + app_toml: app/sidecar/rev-d.toml + image: default + - build: sidecar-d-lab + app_name: sidecar-d-lab + app_toml: app/sidecar/rev-d-lab.toml + image: default + - build: sidecar-d-dev + app_name: sidecar-d-dev + app_toml: app/sidecar/rev-d-dev.toml + image: default uses: ./.github/workflows/build-one.yml with: build: ${{ matrix.build }} @@ -234,4 +246,3 @@ jobs: app_toml: ${{ matrix.app_toml }} image: ${{ matrix.image }} os: ${{ inputs.os }} - diff --git a/app/sidecar/rev-c.toml b/app/sidecar/rev-c.toml index af4552ce4..1c3f6a17a 100644 --- a/app/sidecar/rev-c.toml +++ b/app/sidecar/rev-c.toml @@ -3,6 +3,6 @@ board = "sidecar-c" inherit = "base.toml" [[auxflash.blobs]] -file = "drv/sidecar-mainboard-controller/sidecar_mainboard_controller_rev_c.bit" +file = "drv/sidecar-mainboard-controller/sidecar_mainboard_controller_rev_c_d.bit" compress = true tag = "FPGA" diff --git a/app/sidecar/rev-d-dev.toml b/app/sidecar/rev-d-dev.toml new file mode 100644 index 000000000..195e6dbc1 --- /dev/null +++ b/app/sidecar/rev-d-dev.toml @@ -0,0 +1,2 @@ +name = "sidecar-d-dev" +inherit = ["rev-d.toml", "dev.toml"] diff --git a/app/sidecar/rev-d-lab.toml b/app/sidecar/rev-d-lab.toml new file mode 100644 index 000000000..5c5db70c8 --- /dev/null +++ b/app/sidecar/rev-d-lab.toml @@ -0,0 +1,2 @@ +name = "sidecar-d-lab" +inherit = ["rev-d-dev.toml", "lab.toml"] diff --git a/app/sidecar/rev-d.toml b/app/sidecar/rev-d.toml new file mode 100644 index 000000000..e644fa0e0 --- /dev/null +++ b/app/sidecar/rev-d.toml @@ -0,0 +1,7 @@ +name = "sidecar-d" +board = "sidecar-d" + +# Rev D is identical to rev C from a software perspective. Ideally they would +# be combined into the same image, but the resulting change in board name is not +# supported by current update methods. +inherit = "rev-c.toml" diff --git a/app/sidecar/src/main.rs b/app/sidecar/src/main.rs index f759c1fad..42a97c443 100644 --- a/app/sidecar/src/main.rs +++ b/app/sidecar/src/main.rs @@ -101,6 +101,8 @@ fn system_init() { let expected_rev = 0b001; } else if #[cfg(target_board = "sidecar-c")] { let expected_rev = 0b010; + } else if #[cfg(target_board = "sidecar-d")] { + let expected_rev = 0b011; } else { compile_error!("not a recognized sidecar board") } diff --git a/build/xtask/src/flash.rs b/build/xtask/src/flash.rs index e9d089742..49b47f57e 100644 --- a/build/xtask/src/flash.rs +++ b/build/xtask/src/flash.rs @@ -175,7 +175,7 @@ pub fn config( | "nucleo-h753zi" | "stm32h7b3i-dk" | "gemini-bu-1" | "gimletlet-1" | "gimletlet-2" | "gimlet-b" | "gimlet-c" | "gimlet-d" | "gimlet-e" | "gimlet-f" | "psc-a" | "psc-b" | "psc-c" | "sidecar-b" - | "sidecar-c" | "stm32g031-nucleo" | "donglet-g030" + | "sidecar-c" | "sidecar-d" | "stm32g031-nucleo" | "donglet-g030" | "donglet-g031" | "oxcon2023g0" | "stm32g070" | "stm32g0b1" => { let cfg = FlashProgramConfig::new(chip_dir.join("openocd.cfg")); @@ -213,7 +213,9 @@ pub fn chip_name(board: &str) -> anyhow::Result<&'static str> { "stm32h7b3i-dk" => "STM32H7B3IITx", "gemini-bu-1" | "gimletlet-1" | "gimletlet-2" | "gimlet-b" | "gimlet-c" | "gimlet-d" | "gimlet-e" | "gimlet-f" | "psc-a" - | "psc-b" | "psc-c" | "sidecar-b" | "sidecar-c" => "STM32H753ZITx", + | "psc-b" | "psc-c" | "sidecar-b" | "sidecar-c" | "sidecar-d" => { + "STM32H753ZITx" + } "donglet-g030" => "STM32G030F6Px", "donglet-g031" => "STM32G031F8Px", "stm32g031-nucleo" => "STM32G031Y8Yx", diff --git a/drv/fpga-server/src/main.rs b/drv/fpga-server/src/main.rs index bfb9a7591..19fc7aa65 100644 --- a/drv/fpga-server/src/main.rs +++ b/drv/fpga-server/src/main.rs @@ -67,7 +67,8 @@ fn main() -> ! { if #[cfg(all(feature = "mainboard", feature = "front_io"))] { compile_error!("Cannot enable both mainboard and front_io simultaneously"); } else if #[cfg(all(any(target_board = "sidecar-b", - target_board = "sidecar-c"), + target_board = "sidecar-c", + target_board = "sidecar-d"), feature = "mainboard"))] { let configuration_port = spi.device(drv_spi_api::devices::ECP5_MAINBOARD_FPGA); @@ -88,7 +89,8 @@ fn main() -> ! { let devices = [ecp5::Ecp5::new(driver)]; } else if #[cfg(all(any(target_board = "sidecar-b", - target_board = "sidecar-c"), + target_board = "sidecar-c", + target_board = "sidecar-d"), feature = "front_io"))] { let configuration_port = spi.device(drv_spi_api::devices::ECP5_FRONT_IO_FPGA); diff --git a/drv/sidecar-front-io/build.rs b/drv/sidecar-front-io/build.rs index d45a1f5ad..98ba6465c 100644 --- a/drv/sidecar-front-io/build.rs +++ b/drv/sidecar-front-io/build.rs @@ -9,7 +9,7 @@ fn main() -> Result<(), Box> { build_util::expose_target_board(); let board = build_util::env_var("HUBRIS_BOARD")?; - if board != "sidecar-b" && board != "sidecar-c" { + if board != "sidecar-b" && board != "sidecar-c" && board != "sidecar-d" { panic!("unknown target board"); } diff --git a/drv/sidecar-front-io/src/leds.rs b/drv/sidecar-front-io/src/leds.rs index a8b2098e6..ffd73d1af 100644 --- a/drv/sidecar-front-io/src/leds.rs +++ b/drv/sidecar-front-io/src/leds.rs @@ -188,7 +188,7 @@ const LED_MAP: LedMap = LedMap([ controller: LedController::Left, output: 1, }, - #[cfg(target_board = "sidecar-c")] + #[cfg(any(target_board = "sidecar-c", target_board = "sidecar-d"))] // Port 16 LedLocation { controller: LedController::Left, @@ -200,7 +200,7 @@ const LED_MAP: LedMap = LedMap([ controller: LedController::Left, output: 3, }, - #[cfg(target_board = "sidecar-c")] + #[cfg(any(target_board = "sidecar-c", target_board = "sidecar-d"))] // Port 17 LedLocation { controller: LedController::Left, @@ -212,7 +212,7 @@ const LED_MAP: LedMap = LedMap([ controller: LedController::Left, output: 5, }, - #[cfg(target_board = "sidecar-c")] + #[cfg(any(target_board = "sidecar-c", target_board = "sidecar-d"))] // Port 18 LedLocation { controller: LedController::Left, @@ -224,7 +224,7 @@ const LED_MAP: LedMap = LedMap([ controller: LedController::Left, output: 7, }, - #[cfg(target_board = "sidecar-c")] + #[cfg(any(target_board = "sidecar-c", target_board = "sidecar-d"))] // Port 19 LedLocation { controller: LedController::Left, diff --git a/drv/sidecar-mainboard-controller/build.rs b/drv/sidecar-mainboard-controller/build.rs index b844d98db..66793c7ac 100644 --- a/drv/sidecar-mainboard-controller/build.rs +++ b/drv/sidecar-mainboard-controller/build.rs @@ -20,7 +20,8 @@ fn main() -> Result<(), Box> { if cfg!(feature = "bitstream") { // Check that a valid bitstream is available for this board. let board = build_util::env_var("HUBRIS_BOARD")?; - if board != "sidecar-b" && board != "sidecar-c" { + if board != "sidecar-b" && board != "sidecar-c" && board != "sidecar-d" + { panic!("unknown target board"); } diff --git a/drv/sidecar-mainboard-controller/sidecar_mainboard_controller_rev_c.bit b/drv/sidecar-mainboard-controller/sidecar_mainboard_controller_rev_c_d.bit similarity index 100% rename from drv/sidecar-mainboard-controller/sidecar_mainboard_controller_rev_c.bit rename to drv/sidecar-mainboard-controller/sidecar_mainboard_controller_rev_c_d.bit diff --git a/drv/sidecar-seq-server/src/clock_generator.rs b/drv/sidecar-seq-server/src/clock_generator.rs index 2e457a9e7..80f0d57a1 100644 --- a/drv/sidecar-seq-server/src/clock_generator.rs +++ b/drv/sidecar-seq-server/src/clock_generator.rs @@ -5,8 +5,12 @@ use crate::*; #[cfg_attr( - any(target_board = "sidecar-b", target_board = "sidecar-c"), - path = "clock_generator_payload_bc.rs" + any( + target_board = "sidecar-b", + target_board = "sidecar-c", + target_board = "sidecar-d" + ), + path = "clock_generator_payload_bcd.rs" )] mod payload; diff --git a/drv/sidecar-seq-server/src/clock_generator_payload_bc.rs b/drv/sidecar-seq-server/src/clock_generator_payload_bcd.rs similarity index 100% rename from drv/sidecar-seq-server/src/clock_generator_payload_bc.rs rename to drv/sidecar-seq-server/src/clock_generator_payload_bcd.rs diff --git a/drv/sidecar-seq-server/src/clock_generator_payload_bc_pcie_common_ref.rs b/drv/sidecar-seq-server/src/clock_generator_payload_bcd_pcie_common_ref.rs similarity index 100% rename from drv/sidecar-seq-server/src/clock_generator_payload_bc_pcie_common_ref.rs rename to drv/sidecar-seq-server/src/clock_generator_payload_bcd_pcie_common_ref.rs diff --git a/drv/stm32h7-sprot-server/src/main.rs b/drv/stm32h7-sprot-server/src/main.rs index f7633fc8a..e3da14281 100644 --- a/drv/stm32h7-sprot-server/src/main.rs +++ b/drv/stm32h7-sprot-server/src/main.rs @@ -111,6 +111,7 @@ cfg_if::cfg_if! { target_board = "gimlet-f", target_board = "sidecar-b", target_board = "sidecar-c", + target_board = "sidecar-d", target_board = "psc-a", target_board = "psc-b", target_board = "psc-c", diff --git a/task/monorail-server/src/bsp/sidecar_bc.rs b/task/monorail-server/src/bsp/sidecar_bcd.rs similarity index 100% rename from task/monorail-server/src/bsp/sidecar_bc.rs rename to task/monorail-server/src/bsp/sidecar_bcd.rs diff --git a/task/monorail-server/src/main.rs b/task/monorail-server/src/main.rs index b1ea34a42..6c2218423 100644 --- a/task/monorail-server/src/main.rs +++ b/task/monorail-server/src/main.rs @@ -5,8 +5,14 @@ #![no_std] #![no_main] -#[cfg_attr(target_board = "sidecar-b", path = "bsp/sidecar_bc.rs")] -#[cfg_attr(target_board = "sidecar-c", path = "bsp/sidecar_bc.rs")] +#[cfg_attr( + any( + target_board = "sidecar-b", + target_board = "sidecar-c", + target_board = "sidecar-d" + ), + path = "bsp/sidecar_bcd.rs" +)] mod bsp; mod server; diff --git a/task/net/src/bsp/sidecar_bc.rs b/task/net/src/bsp/sidecar_bcd.rs similarity index 100% rename from task/net/src/bsp/sidecar_bc.rs rename to task/net/src/bsp/sidecar_bcd.rs diff --git a/task/net/src/main.rs b/task/net/src/main.rs index 1366c4c95..376fd9a37 100644 --- a/task/net/src/main.rs +++ b/task/net/src/main.rs @@ -17,8 +17,14 @@ mod server; any(target_board = "nucleo-h743zi2", target_board = "nucleo-h753zi"), path = "bsp/nucleo_h7.rs" )] -#[cfg_attr(target_board = "sidecar-b", path = "bsp/sidecar_bc.rs")] -#[cfg_attr(target_board = "sidecar-c", path = "bsp/sidecar_bc.rs")] +#[cfg_attr( + any( + target_board = "sidecar-b", + target_board = "sidecar-c", + target_board = "sidecar-d", + ), + path = "bsp/sidecar_bcd.rs" +)] #[cfg_attr( any( target_board = "gimlet-b", diff --git a/task/packrat/build.rs b/task/packrat/build.rs index 00b4d3025..cae97e704 100644 --- a/task/packrat/build.rs +++ b/task/packrat/build.rs @@ -28,7 +28,7 @@ fn main() -> Result<(), Box> { "packrat's `gimlet` feature should not be enabled when ", "building for PSCs", )), - Some("sidecar-b" | "sidecar-c") => panic!(concat!( + Some("sidecar-b" | "sidecar-c" | "sidecar-d") => panic!(concat!( "packrat's `gimlet` feature should not be enabled when ", "building for sidecars", )), diff --git a/task/power/src/bsp/sidecar_bc.rs b/task/power/src/bsp/sidecar_bcd.rs similarity index 100% rename from task/power/src/bsp/sidecar_bc.rs rename to task/power/src/bsp/sidecar_bcd.rs diff --git a/task/power/src/main.rs b/task/power/src/main.rs index a889d03ee..1cfaea47a 100644 --- a/task/power/src/main.rs +++ b/task/power/src/main.rs @@ -395,8 +395,12 @@ macro_rules! mwocp68_controller { path = "bsp/psc_abc.rs" )] #[cfg_attr( - any(target_board = "sidecar-b", target_board = "sidecar-c",), - path = "bsp/sidecar_bc.rs" + any( + target_board = "sidecar-b", + target_board = "sidecar-c", + target_board = "sidecar-d" + ), + path = "bsp/sidecar_bcd.rs" )] #[cfg_attr(target_board = "gimletlet-2", path = "bsp/gimletlet_2.rs")] mod bsp; diff --git a/task/thermal/src/bsp/sidecar_bc.rs b/task/thermal/src/bsp/sidecar_bcd.rs similarity index 100% rename from task/thermal/src/bsp/sidecar_bc.rs rename to task/thermal/src/bsp/sidecar_bcd.rs diff --git a/task/thermal/src/main.rs b/task/thermal/src/main.rs index cd3036b2c..a869bbf1d 100644 --- a/task/thermal/src/main.rs +++ b/task/thermal/src/main.rs @@ -23,8 +23,12 @@ path = "bsp/gimlet_bcdef.rs" )] #[cfg_attr( - any(target_board = "sidecar-b", target_board = "sidecar-c"), - path = "bsp/sidecar_bc.rs" + any( + target_board = "sidecar-b", + target_board = "sidecar-c", + target_board = "sidecar-d" + ), + path = "bsp/sidecar_bcd.rs" )] mod bsp; mod control;