aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/examples/override-exception.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <bors[bot]@users.noreply.github.com> 2018-09-06 00:44:19 +0000
committerGravatar bors[bot] <bors[bot]@users.noreply.github.com> 2018-09-06 00:44:19 +0000
commit7854e96f69f98570504c701ae860175efc7a25d9 (patch)
treeeaf897d43263606e24b6cca9f5f6620498648dc6 /cortex-m-rt/examples/override-exception.rs
parent0fb051055a0340ad6c5b59d18183c260468e455f (diff)
parent31713aba3f4a4aacd55d12b8a3435334ae61986a (diff)
downloadcortex-m-7854e96f69f98570504c701ae860175efc7a25d9.tar.gz
cortex-m-7854e96f69f98570504c701ae860175efc7a25d9.tar.zst
cortex-m-7854e96f69f98570504c701ae860175efc7a25d9.zip
Merge #90
90: turn macros into attributes r=adamgreig a=japaric This is a PoC implementation of RFC #82. Assuming that we are OK with this implementation we should add some compile fail tests (e.g. using a function with the wrong signature as the entry point) before landing this. Look at the diff of the examples to get an overview of the changes. cc @rust-embedded/cortex-m Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Diffstat (limited to 'cortex-m-rt/examples/override-exception.rs')
-rw-r--r--cortex-m-rt/examples/override-exception.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/cortex-m-rt/examples/override-exception.rs b/cortex-m-rt/examples/override-exception.rs
index 2f100a2..3e0af25 100644
--- a/cortex-m-rt/examples/override-exception.rs
+++ b/cortex-m-rt/examples/override-exception.rs
@@ -6,29 +6,24 @@
#![no_std]
extern crate cortex_m;
-#[macro_use(entry, exception)]
extern crate cortex_m_rt as rt;
extern crate panic_semihosting;
use cortex_m::asm;
-use rt::ExceptionFrame;
-
-// the program entry point
-entry!(main);
+use rt::{entry, exception, ExceptionFrame};
+#[entry]
fn main() -> ! {
loop {}
}
-exception!(*, default_handler);
-
-fn default_handler(_irqn: i16) {
+#[exception]
+fn DefaultHandler(_irqn: i16) {
asm::bkpt();
}
-exception!(HardFault, hard_fault);
-
-fn hard_fault(_ef: &ExceptionFrame) -> ! {
+#[exception]
+fn HardFault(_ef: &ExceptionFrame) -> ! {
asm::bkpt();
loop {}