Skip to content

Commit

Permalink
sysctrl: print example names
Browse files Browse the repository at this point in the history
  • Loading branch information
hegza committed Mar 20, 2024
1 parent 191fbea commit 818b273
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/sysctrl/hello-sysctrl/examples/uart0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
#![no_main]

use headsail_bsp::{rt::entry, uart::uart_write};
use hello_sysctrl::print_example_name;
use panic_halt as _;

#[entry]
fn main() -> ! {
print_example_name!();
uart_write("Hello world!");
loop {}
}
12 changes: 12 additions & 0 deletions examples/sysctrl/hello-sysctrl/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
#![no_std]
#![no_main]

/// Print the name of the current file, i.e., test name.
///
/// This must be a macro to make sure core::file matches the file this is
/// invoked in.
#[macro_export]
macro_rules! print_example_name {
() => {
use headsail_bsp::sprintln;
sprintln!("[{}]", core::file!());
};
}

0 comments on commit 818b273

Please sign in to comment.