sel4_root_task/printing.rs
1//
2// Copyright 2024, Colias Group, LLC
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6
7use sel4::sel4_cfg_if;
8
9sel4_cfg_if! {
10 if #[sel4_cfg(PRINTING)] {
11 use sel4::debug_put_char;
12
13 pub use sel4_panicking_env::{debug_print, debug_println};
14 } else {
15 fn debug_put_char(_: u8) {}
16
17 // Create new no-op macros instead of re-exporting from sel4_panicking_env for the sake of
18 // performance.
19
20 /// No-op for this configuration.
21 #[macro_export]
22 macro_rules! debug_print {
23 ($($arg:tt)*) => {
24 // Avoid unused argument warnings without runtime cost
25 if false {
26 drop(format_args!($($arg)*))
27 }
28 };
29 }
30
31 /// No-op for this configuration.
32 #[macro_export]
33 macro_rules! debug_println {
34 () => {
35 ()
36 };
37 ($($arg:tt)*) => {
38 // Avoid unused argument warnings without runtime cost
39 if false {
40 drop(format_args!($($arg)*))
41 }
42 };
43 }
44 }
45}
46
47sel4_panicking_env::register_debug_put_char! {
48 #[linkage = "weak"]
49 debug_put_char
50}