From d15168068bcad6dc0e7fd3f744ae0b148bfbc03a Mon Sep 17 00:00:00 2001 From: Ian Pickering Date: Wed, 13 Feb 2019 18:27:27 -0800 Subject: [PATCH] Add __IRQ_HANDLER symbol to hello_magic example The hello_magic example does not depend on the gba crate, but the crt0 now assumes that the symbol for the interrupt handler which is defined in it will be present, as interrupts ought to be handled in some manner. If neither the symbol or the crate are added then the linker will give an error, but if anything in the gba crate is used also then the symbol will be brought in, so defining it manually also would cause a duplicate definition error. In the future something like cortex-m-rt's `exception!` macro could be used to better document how to define this symbol (all their examples depend on at least one symbol from their runtime library, so they don't have this problem). --- examples/hello_magic.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/hello_magic.rs b/examples/hello_magic.rs index 75eb6bc..8aa3c55 100644 --- a/examples/hello_magic.rs +++ b/examples/hello_magic.rs @@ -16,3 +16,8 @@ fn main(_argc: isize, _argv: *const *const u8) -> isize { loop {} } } + +#[no_mangle] +static __IRQ_HANDLER: extern "C" fn() = irq_handler; + +extern "C" fn irq_handler() {}