Skip to content

Commit 08aab3e

Browse files
committed
Add risc-v support
1 parent 8af3d68 commit 08aab3e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ default = ["erase-chip", "panic-handler"]
1515
erase-chip = []
1616
panic-handler = []
1717
verify = []
18+
cortex-m = []
19+
risc-v = []

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@
1212
#![no_main]
1313
#![macro_use]
1414

15+
#[cfg(not(any(feature = "cortex-m", feature = "risc-v", feature = "panic-handler")))]
16+
compile_error!("Enable either the cortex-m or risc-v feature");
17+
1518
#[cfg(all(not(test), feature = "panic-handler"))]
1619
#[panic_handler]
1720
fn panic(_info: &core::panic::PanicInfo) -> ! {
1821
unsafe {
22+
#[cfg(feature = "cortex-m")]
1923
core::arch::asm!("udf #0");
24+
#[cfg(feature = "risc-v")]
25+
core::arch::asm!("UNIMP");
2026
core::hint::unreachable_unchecked();
2127
}
2228
}

0 commit comments

Comments
 (0)