Skip to content
Open
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
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,34 @@ jobs:
run: |
./cargo.sh clippy --all-features -- -Dwarnings

rust-tests:
name: Rust Tests
runs-on: [self-hosted, compute]
defaults:
run:
shell: git-nix-shell {0} --ignore-environment
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=15g
needs: [build]

steps:
- name: Checkout
uses: actions/checkout@v4

- run: cache pull cargo
- run: cache pull build

- name: Run Rust tests (debug mode, little endian)
run: |
cd firmware-support/bittide-hal
cargo test --locked

- name: Run Rust tests (release mode, little endian)
run: |
cd firmware-support/bittide-hal
cargo test --locked --release

firmware-support-tests:
name: Firmware Support Unit Tests
runs-on: [self-hosted, compute]
Expand Down Expand Up @@ -753,6 +781,7 @@ jobs:
firmware-support-tests,
generate-control-reports,
haskell-tests,
rust-tests,
lint,
mdbook,
rust-lints,
Expand Down
4 changes: 4 additions & 0 deletions firmware-binaries/Cargo.lock

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

6 changes: 4 additions & 2 deletions firmware-binaries/demos/clock-control/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//
// SPDX-License-Identifier: Apache-2.0

use bittide_hal::manual_additions::unsigned::Unsigned;
use core::panic::PanicInfo;
use itertools::izip;

Expand Down Expand Up @@ -68,7 +69,7 @@ fn main() -> ! {
)
.map(|(i, counter)| {
if domain_diff_counters.enable(i).unwrap_or(false) {
Some(counter)
Some(counter.into_inner())
} else {
None
}
Expand All @@ -81,7 +82,8 @@ fn main() -> ! {

// Store debug information. Stop capturing samples if we are stable to
// reduce plot sizes.
let has_sense_of_global_time = freeze.number_of_sync_pulses_seen() != 0;
let has_sense_of_global_time =
freeze.number_of_sync_pulses_seen() != Unsigned::new(0).unwrap();
if !prev_all_stable && has_sense_of_global_time {
sample_store.store(&freeze, stability, callisto.accumulated_speed_requests);
}
Expand Down
5 changes: 3 additions & 2 deletions firmware-binaries/demos/soft-ugn-mu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ license = "Apache-2.0"
authors = ["Google LLC"]

[dependencies]
riscv-rt = "0.11.0"
bittide-macros = { path = "../../../firmware-support/bittide-macros" }
bittide-hal = { path = "../../../firmware-support/bittide-hal" }
bittide-sys = { path = "../../../firmware-support/bittide-sys" }
riscv-rt = "0.11.0"
ufmt = "0.2.0"
bittide-hal = { path = "../../../firmware-support/bittide-hal" }

[build-dependencies]
memmap-generate = { path = "../../../firmware-support/memmap-generate" }
Expand Down
10 changes: 5 additions & 5 deletions firmware-binaries/demos/soft-ugn-mu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
//
// SPDX-License-Identifier: Apache-2.0

use bittide_hal::hals::soft_ugn_demo_mu::DeviceInstances;
use bittide_hal::manual_additions::calendar::RingbufferCalendar;
use bittide_hal::shared_devices::Uart;
use bittide_sys::link_startup::LinkStartup;
use bittide_sys::stability_detector::Stability;
use bittide_hal::{
hals::soft_ugn_demo_mu::DeviceInstances, manual_additions::calendar::RingbufferCalendar,
shared_devices::Uart,
};
use bittide_sys::{link_startup::LinkStartup, stability_detector::Stability};
use core::panic::PanicInfo;
use ufmt::uwriteln;

Expand Down
3 changes: 1 addition & 2 deletions firmware-binaries/demos/switch-demo1-mu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
// SPDX-License-Identifier: Apache-2.0

use bittide_hal::hals::switch_demo_mu::DeviceInstances;
use bittide_sys::link_startup::LinkStartup;
use bittide_sys::stability_detector::Stability;
use bittide_sys::{link_startup::LinkStartup, stability_detector::Stability};
use core::panic::PanicInfo;
use ufmt::uwriteln;

Expand Down
2 changes: 1 addition & 1 deletion firmware-binaries/demos/switch-demo2-mu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fn main() -> ! {
"Capture UGN {}: local = {}, remote = {}",
i,
capture_ugn.local_counter(),
capture_ugn.remote_counter()
capture_ugn.remote_counter(),
)
.unwrap();
*done = true;
Expand Down
2 changes: 1 addition & 1 deletion firmware-binaries/hitl-tests/clock-board/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn check_frequency(
domain_diff_counters.set_enable(0, false);

let diff = match (start, end) {
(Some(s), Some(e)) => e - s,
(Some(s), Some(e)) => e.into_inner() - s.into_inner(),
_ => return Err(FrequencyCheckError::CounterInaccessible),
};

Expand Down
4 changes: 2 additions & 2 deletions firmware-binaries/sim-tests/capture_ugn_test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ fn main() -> ! {
}
uwriteln!(
uart,
"(0x{:16X},0x{:16X})",
"({},{})",
capture_ugn.local_counter(),
capture_ugn.remote_counter()
capture_ugn.remote_counter(),
)
.unwrap();
loop {
Expand Down
2 changes: 1 addition & 1 deletion firmware-binaries/sim-tests/clock-control-wb/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn main() -> ! {
writeln!(uart, "]").unwrap();

// Mark end of transmission - should hopefully be unique enough?
for _ in 0..cc.link_mask_pop_count() {
for _ in 0..cc.link_mask_pop_count().into_inner() {
cc.set_change_speed(SpeedChange::NoChange);
}

Expand Down
5 changes: 3 additions & 2 deletions firmware-binaries/sim-tests/elastic_buffer_wb_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ authors = ["Google LLC"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
riscv-rt = "0.11.0"
bittide-sys = { path = "../../../firmware-support/bittide-sys" }
bittide-hal = { path = "../../../firmware-support/bittide-hal" }
bittide-macros = { path = "../../../firmware-support/bittide-macros" }
bittide-sys = { path = "../../../firmware-support/bittide-sys" }
riscv-rt = "0.11.0"
ufmt = "0.2.0"

[build-dependencies]
Expand Down
Loading
Loading