Skip to content

Commit

Permalink
Rename bsp::uart as bsp::apb_uart (#61)
Browse files Browse the repository at this point in the history
* Rename bsp::uart as apb_uart

* Fixup: also update CI and README
  • Loading branch information
hegza authored Aug 20, 2024
1 parent 761c3e4 commit b6b41f0
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 34 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
run: cargo check -Fsysctrl-rt -Fvp
- name: Check BSP examples (-Fsysctrl-rt)
working-directory: ./examples/headsail-bsp
run: cargo check --examples -Fsysctrl-rt -Fpanic-uart
run: cargo check --examples -Fsysctrl-rt -Fpanic-apb-uart0
- name: Check BSP examples (-Fsysctrl-rt -Fvp)
working-directory: ./examples/headsail-bsp
run: cargo check --examples -Fsysctrl-rt -Fvp -Fpanic-uart
run: cargo check --examples -Fsysctrl-rt -Fvp -Fpanic-apb-uart0

- name: Check BSP (-Fhpc-rt)
working-directory: ./examples/headsail-bsp
Expand All @@ -52,10 +52,10 @@ jobs:
run: cargo check -Fhpc-rt -Fvp
- name: Check BSP examples (-Fhpc-rt)
working-directory: ./examples/headsail-bsp
run: cargo check --examples -Fhpc-rt -Fpanic-uart
run: cargo check --examples -Fhpc-rt -Fpanic-apb-uart0
- name: Check BSP examples (-Fhpc-rt -Fvp)
working-directory: ./examples/headsail-bsp
run: cargo check --examples -Fhpc-rt -Fvp -Fpanic-uart
run: cargo check --examples -Fhpc-rt -Fvp -Fpanic-apb-uart0

build-dla-example:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
run: rustup target add riscv64imac-unknown-none-elf riscv32im-unknown-none-elf
- name: Build FFI without RT on SysCtrl
working-directory: ./examples/headsail-bsp-ffi
run: cargo build --target=riscv32im-unknown-none-elf -Fpanic-uart
run: cargo build --target=riscv32im-unknown-none-elf -Fpanic-apb-uart0
- name: Build FFI without RT on HPC
working-directory: ./examples/headsail-bsp-ffi
run: cargo build --target=riscv64imac-unknown-none-elf -Fpanic-uart
run: cargo build --target=riscv64imac-unknown-none-elf -Fpanic-apb-uart0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

```sh
cd examples/headsail-bsp
cargo run --example uart0 -Fhpc-rt -Fpanic-uart --target riscv64imac-unknown-none-elf
cargo run --example uart0 -Fhpc-rt -Fpanic-apb-uart0 --target riscv64imac-unknown-none-elf
```

### Run DLA example
Expand Down
4 changes: 2 additions & 2 deletions examples/headsail-bsp-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ crate-type = ["staticlib"]
hpc-rt = ["headsail-bsp/hpc-rt", "rt"]
sysctrl-rt = ["headsail-bsp/sysctrl-rt", "rt"]

rt = ["headsail-bsp/panic-uart"]
panic-uart = ["headsail-bsp/panic-uart"]
rt = ["headsail-bsp/panic-apb-uart0"]
panic-apb-uart0 = ["headsail-bsp/panic-apb-uart0"]

[dependencies]
headsail-bsp = { version = "0.1.0", path = "../headsail-bsp" }
Expand Down
4 changes: 2 additions & 2 deletions examples/headsail-bsp-ffi/Justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build-sysctrl:
cargo build --target=riscv32im-unknown-none-elf -Fpanic-uart --release
cargo build --target=riscv32im-unknown-none-elf -Fpanic-apb-uart0 --release

build-hpc:
cargo build --target=riscv64imac-unknown-none-elf -Fpanic-uart --release
cargo build --target=riscv64imac-unknown-none-elf -Fpanic-apb-uart0 --release
2 changes: 1 addition & 1 deletion examples/headsail-bsp-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ unsafe fn rust_main() -> ! {

#[no_mangle]
pub extern "C" fn putc(byte: u8) {
headsail_bsp::uart::putc(byte)
headsail_bsp::apb_uart::putc(byte)
}
8 changes: 4 additions & 4 deletions examples/headsail-bsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sysctrl-rt = [
"riscv-rt/single-hart",
"riscv/critical-section-single-hart",
]
panic-uart = []
panic-apb-uart0 = []
hpc = []
sysctrl = []
alloc = ["dep:good_memory_allocator", "hpc"]
Expand All @@ -36,7 +36,7 @@ bit_field = "0.10.2"
[[example]]
name = "panic"
path = "examples/panic.rs"
required-features = ["panic-uart", "rt"]
required-features = ["panic-apb-uart0", "rt"]

[[example]]
name = "uart0"
Expand All @@ -61,12 +61,12 @@ required-features = ["alloc", "rt", "sdram"]
[[example]]
name = "timer0"
path = "examples/timer0.rs"
required-features = ["panic-uart", "rt"]
required-features = ["panic-apb-uart0", "rt"]

[[example]]
name = "interrupts"
path = "examples/interrupts.rs"
required-features = ["panic-uart", "hpc-rt"]
required-features = ["panic-apb-uart0", "hpc-rt"]

[profile.dev]
panic = "abort"
Expand Down
2 changes: 1 addition & 1 deletion examples/headsail-bsp/Justfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
run example target='riscv64imac':
cargo run --example {{example}} -Fhpc-rt -Fpanic-uart --target {{target}}-unknown-none-elf
cargo run --example {{example}} -Fhpc-rt -Fpanic-apb-uart0 --target {{target}}-unknown-none-elf
4 changes: 2 additions & 2 deletions examples/headsail-bsp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Minimal BSP for testing the virtual prototype.

```sh
# HPC
RUSTFLAGS="-C link-arg=-Tmem_hpc.x -C link-arg=-Tlink.x" cargo build --examples -Fpanic-uart -Fhpc-rt -Falloc --target riscv64imac-unknown-none-elf
RUSTFLAGS="-C link-arg=-Tmem_hpc.x -C link-arg=-Tlink.x" cargo build --examples -Fpanic-apb-uart0 -Fhpc-rt -Falloc --target riscv64imac-unknown-none-elf

# SysCtrl
RUSTFLAGS="-C link-arg=-Tmem_sysctrl.x -C link-arg=-Tlink.x" cargo build --examples -Fpanic-uart -Fsysctrl-rt --target riscv32im-unknown-none-elf
RUSTFLAGS="-C link-arg=-Tmem_sysctrl.x -C link-arg=-Tlink.x" cargo build --examples -Fpanic-apb-uart0 -Fsysctrl-rt --target riscv32im-unknown-none-elf
```

## Running examples
Expand Down
4 changes: 2 additions & 2 deletions examples/headsail-bsp/examples/uart0-read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#![no_main]

extern crate alloc;
use headsail_bsp::{init_alloc, rt::entry, sprint, sprintln, uart::uart_read_to_heap};
use headsail_bsp::{apb_uart::uart_read_to_heap, init_alloc, rt::entry, sprint, sprintln};

#[entry]
fn main() -> ! {
sprintln!("Connect to uart with: screen /tmp/uart0");
sprintln!("Connect to APB UART 0 with: screen /tmp/uart0");
init_alloc();
loop {
let res = uart_read_to_heap(8);
Expand Down
2 changes: 1 addition & 1 deletion examples/headsail-bsp/examples/uart0.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_std]
#![no_main]

use headsail_bsp::{rt::entry, uart::uart_write};
use headsail_bsp::{apb_uart::uart_write, rt::entry};

#[entry]
fn main() -> ! {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions examples/headsail-bsp/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! A light-weight memory map based board support package for Headsail.
#![no_std]

pub mod apb_uart;
pub mod sprintln;
#[cfg(feature = "sysctrl")]
pub mod sysctrl;
pub mod uart;
pub mod timer {
/*!
* Timer module for Headsail. When running on the Renode
Expand Down Expand Up @@ -40,7 +40,7 @@ pub mod alloc;
#[cfg(feature = "hpc")]
mod hpc;
mod mmap;
#[cfg(feature = "panic-uart")]
#[cfg(feature = "panic-apb-uart0")]
mod ufmt_panic;

/// # Safety
Expand Down
2 changes: 1 addition & 1 deletion examples/headsail-bsp/src/sprintln.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Macros to implement Rust-style print formatting using `print`/`println`
use crate::uart::uart_write;
use crate::apb_uart::uart_write;

pub struct Uart;

Expand Down
2 changes: 1 addition & 1 deletion examples/headsail-bsp/src/tb.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Common testbench definitions to retain a consistent test setup
use crate::uart::uart_write;
use crate::apb_uart::uart_write;

pub const TAG_FAIL: &str = "[FAIL]";
pub const TAG_PASS: &str = "[PASS]";
Expand Down
2 changes: 1 addition & 1 deletion examples/headsail-bsp/src/ufmt_panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl uDisplay for PanicInfoWrapper<'_> {
}
}

#[cfg(feature = "panic-uart")]
#[cfg(feature = "panic-apb-uart0")]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
sprintln!("{}", PanicInfoWrapper(info));
Expand Down
11 changes: 9 additions & 2 deletions examples/hpc/dla-driver-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ edition = "2021"
crate-type = ["staticlib"]

[dependencies]
dla-driver = { version = "0.1.0", path = "../dla-driver", features = ["hpc", "vp"] }
headsail-bsp = { version = "0.1.0", path = "../../headsail-bsp", features = ["alloc", "sdram", "panic-uart"]}
dla-driver = { version = "0.1.0", path = "../dla-driver", features = [
"hpc",
"vp",
] }
headsail-bsp = { version = "0.1.0", path = "../../headsail-bsp", features = [
"alloc",
"sdram",
"panic-apb-uart0",
] }

[build-dependencies]
cbindgen = "0.26.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/hpc/dla-driver/examples/validate_conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ extern crate alloc;
use dla_driver::utils::generate_output_tensor;
use dla_driver::*;
use headsail_bsp::{
init_alloc, rt::entry, sprint, sprintln, tb::report_fail, tb::report_ok, tb::report_pass,
uart::uart_read_to_heap,
apb_uart::uart_read_to_heap, init_alloc, rt::entry, sprint, sprintln, tb::report_fail,
tb::report_ok, tb::report_pass,
};
use panic_halt as _;

Expand Down
2 changes: 1 addition & 1 deletion examples/hpc/test-memory-maps/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
mod tests;

use bsp::{
apb_uart::putc,
riscv::asm::wfi,
rt::entry,
sprint, sprintln,
tb::{report_fail, report_pass},
uart::putc,
ufmt::{self, uDebug},
};
use panic_halt as _;
Expand Down
4 changes: 2 additions & 2 deletions examples/sysctrl/hello-sysctrl/examples/uart0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#![no_main]

#[cfg(feature = "asic")]
use headsail_bsp::uart::init_uart;
use headsail_bsp::{rt::entry, sysctrl::soc_ctrl, uart::uart_write};
use headsail_bsp::apb_uart::init_uart;
use headsail_bsp::{apb_uart::uart_write, rt::entry, sysctrl::soc_ctrl};
use panic_halt as _;

#[entry]
Expand Down

0 comments on commit b6b41f0

Please sign in to comment.