Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
lmbollen committed Oct 18, 2024
1 parent 797ba86 commit 0f8ec05
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 13 deletions.
2 changes: 0 additions & 2 deletions firmware-binaries/clock-control/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
//
// SPDX-License-Identifier: Apache-2.0

use core::panic::PanicInfo;

use bittide_sys::{
callisto::{self, ControlConfig, ControlSt, ReframingState},
clock_control::{ClockControl, SpeedChange},
Expand Down
8 changes: 8 additions & 0 deletions firmware-binaries/examples/hello/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ fn main() -> ! {
uart.send(c);
}
}

#[panic_handler]
fn panic_handler(_info: &core::panic::PanicInfo) -> ! {
test_failure();
loop {
continue;
}
}
2 changes: 1 addition & 1 deletion firmware-binaries/examples/smoltcp_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = ["Google LLC"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bittide-sys = { path = "../../../firmware-support/bittide-sys" }
bittide-sys = { path = "../../../firmware-support/bittide-sys", features = ["panic_handler_log"]}
riscv-rt = "0.11.0"
riscv = "^0.10"
heapless = { version = "0.8", default-features = false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ authors = ["Google LLC"]

[dependencies]
riscv-rt = "0.11.0"
bittide-sys = { path = "../../../firmware-support/bittide-sys" }
bittide-sys = { path = "../../../firmware-support/bittide-sys", features = ["panic_handler_log"]}
ufmt = "0.2.0"
2 changes: 0 additions & 2 deletions firmware-binaries/test-cases/axi_stream_self_test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
//
// SPDX-License-Identifier: Apache-2.0

use ufmt::uwriteln;

use bittide_sys::axi::self_test::self_test;
use bittide_sys::axi::{AxiRx, AxiTx};
use bittide_sys::uart::Uart;
Expand Down
2 changes: 1 addition & 1 deletion firmware-binaries/test-cases/capture_ugn_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ authors = ["Google LLC"]

[dependencies]
riscv-rt = "0.11.0"
bittide-sys = { path = "../../../firmware-support/bittide-sys" }
bittide-sys = { path = "../../../firmware-support/bittide-sys", features = ["panic_handler_log"]}
ufmt = "0.2.0"
2 changes: 1 addition & 1 deletion firmware-binaries/test-cases/dna_port_e2_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ authors = ["Google LLC"]

[dependencies]
riscv-rt = "0.11.0"
bittide-sys = { path = "../../../firmware-support/bittide-sys" }
bittide-sys = { path = "../../../firmware-support/bittide-sys", features = ["panic_handler_log"]}
ufmt = "0.2.0"
2 changes: 1 addition & 1 deletion firmware-binaries/test-cases/time_self_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ authors = ["Google LLC"]

[dependencies]
riscv-rt = "0.11.0"
bittide-sys = { path = "../../../firmware-support/bittide-sys" }
bittide-sys = { path = "../../../firmware-support/bittide-sys", default-features = false }
ufmt = "0.2.0"
1 change: 1 addition & 0 deletions firmware-support/bittide-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ resolver = "2"

[features]
default = []
panic_handler_log = []

[dependencies]
fdt = "0.1.0"
Expand Down
6 changes: 3 additions & 3 deletions firmware-support/bittide-sys/src/uart/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use crate::{time, uart};
// compatible with (dependencies of) the log crate.
use core::fmt::Write;
use log::LevelFilter;

use core::panic::PanicInfo;
use log::error;
use ufmt::uwriteln;


/// A global logger instance to be used with the `log` crate.
///
/// Use `set_logger` to set the `Uart` instance to be used for logging.
Expand Down Expand Up @@ -92,8 +92,8 @@ impl log::Log for UartLogger {
unsafe impl core::marker::Send for UartLogger {}
unsafe impl core::marker::Sync for UartLogger {}

#[panic_handler]
fn panic_handler(info: &PanicInfo) -> ! {
#[cfg_attr(feature = "panic_handler_log", panic_handler)]
pub fn panic_handler(info: &PanicInfo) -> ! {
unsafe {
match LOGGER.uart {
Some(ref mut uart) => {
Expand Down
2 changes: 1 addition & 1 deletion host-tools/callisto-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bittide-sys = { path = "../../firmware-support/bittide-sys" }
bittide-sys = { path = "../../firmware-support/bittide-sys", default-features = false, features = []}

[lib]
crate-type = ["staticlib"]

0 comments on commit 0f8ec05

Please sign in to comment.