Skip to content

Commit

Permalink
feat(rt): make the custom panic handler optional
Browse files Browse the repository at this point in the history
  • Loading branch information
ROMemories committed Mar 4, 2024
1 parent 5da0e60 commit 0808ec1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ embassy-usb = { version = "0.1", default-features = false }

linkme = { version = "0.3.21", features = ["used_linker"] }

riot-rs = { path = "src/riot-rs" }
riot-rs = { path = "src/riot-rs", default-features = false }
riot-rs-rt = { path = "src/riot-rs-rt" }
riot-rs-runqueue = { path = "src/riot-rs-runqueue" }

Expand Down
1 change: 1 addition & 0 deletions src/riot-rs-rt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ rtt-target = { version = "0.4.0", optional = true }
threading = ["dep:riot-rs-threads"]
debug-console = []
silent-panic = []
_panic-handler = []

[dev-dependencies]
riot-rs-boards = { path = "../riot-rs-boards" }
5 changes: 2 additions & 3 deletions src/riot-rs-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#![reexport_test_harness_main = "test_main"]
pub mod testing;

use core::panic::PanicInfo;

pub mod debug;
pub use debug::*;

Expand Down Expand Up @@ -47,8 +45,9 @@ const ISR_STACKSIZE: usize =
#[used(linker)]
static ISR_STACK: [u8; ISR_STACKSIZE] = [0u8; ISR_STACKSIZE];

#[cfg(feature = "_panic-handler")]
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
fn panic(_info: &core::panic::PanicInfo) -> ! {
#[cfg(not(feature = "silent-panic"))]
{
debug::println!("panic: {}\n", _info);
Expand Down
2 changes: 2 additions & 0 deletions src/riot-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ riot-rs-threads = { path = "../riot-rs-threads", optional = true }
static_cell = { workspace = true }

[features]
default = ["riot-rs-rt/_panic-handler"]

debug-console = ["riot-rs-rt/debug-console"]
net = ["riot-rs-embassy/net"]
# Allows to have no boards selected, useful to run platform-independent tooling
Expand Down

0 comments on commit 0808ec1

Please sign in to comment.