Skip to content

Commit 99956f5

Browse files
committed
Put the panic handler behind a feature flag
1 parent 3b4fc12 commit 99956f5

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ repository = "https://github.com/probe-rs/flash-algorithm"
99
description = "A crate to write CMSIS-DAP flash algorithms for flashing embedded targets."
1010

1111
[dependencies]
12+
13+
[features]
14+
default = ["panic-handler"]
15+
panic-handler = []

src/lib.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
//! Implement a [CMSIS-Pack] flash algorithm in Rust
2+
//!
3+
//! [CMSIS-Pack]: https://open-cmsis-pack.github.io/Open-CMSIS-Pack-Spec/main/html/flashAlgorithm.html
4+
//!
5+
//! # Feature flags
6+
//!
7+
//! - `panic-handler` this is enabled by default and includes a simple loop panic
8+
//! handler. Disable this feature flag if you would prefer to use a different
9+
//! handler.
10+
111
#![no_std]
212
#![no_main]
313
#![macro_use]
414

5-
#[cfg(not(test))]
15+
#[cfg(all(not(test), feature = "panic-handler"))]
616
#[panic_handler]
717
fn panic(_info: &core::panic::PanicInfo) -> ! {
818
unsafe {

0 commit comments

Comments
 (0)