Skip to content

Commit

Permalink
Sidecar: Add support for rev D mainboard (#1607)
Browse files Browse the repository at this point in the history
Fixes #1606
  • Loading branch information
arjenroodselaar authored Jan 31, 2024
1 parent 2f5bc53 commit e702b7d
Show file tree
Hide file tree
Showing 25 changed files with 78 additions and 24 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/build-boards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down Expand Up @@ -234,4 +246,3 @@ jobs:
app_toml: ${{ matrix.app_toml }}
image: ${{ matrix.image }}
os: ${{ inputs.os }}

2 changes: 1 addition & 1 deletion app/sidecar/rev-c.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 2 additions & 0 deletions app/sidecar/rev-d-dev.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name = "sidecar-d-dev"
inherit = ["rev-d.toml", "dev.toml"]
2 changes: 2 additions & 0 deletions app/sidecar/rev-d-lab.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name = "sidecar-d-lab"
inherit = ["rev-d-dev.toml", "lab.toml"]
7 changes: 7 additions & 0 deletions app/sidecar/rev-d.toml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 2 additions & 0 deletions app/sidecar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
6 changes: 4 additions & 2 deletions build/xtask/src/flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

Expand Down Expand Up @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions drv/fpga-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drv/sidecar-front-io/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
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");
}

Expand Down
8 changes: 4 additions & 4 deletions drv/sidecar-front-io/src/leds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion drv/sidecar-mainboard-controller/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
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");
}

Expand Down
8 changes: 6 additions & 2 deletions drv/sidecar-seq-server/src/clock_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions drv/stm32h7-sprot-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
File renamed without changes.
10 changes: 8 additions & 2 deletions task/monorail-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
File renamed without changes.
10 changes: 8 additions & 2 deletions task/net/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion task/packrat/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
"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",
)),
Expand Down
File renamed without changes.
8 changes: 6 additions & 2 deletions task/power/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
File renamed without changes.
8 changes: 6 additions & 2 deletions task/thermal/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e702b7d

Please sign in to comment.