rt: Implement cortex-m-rt-macros static mut conversion
Inside the entrypoint and interrupt handlers, perform a conversion which
turns `static mut`s into &mut references to the static. This is safe
because exception handlers and the entrypoint are guaranteed to not be
reentrant.
This is the same behavior as `cortex-m-rt` where it is documented in the
Rust Embedded Book [1].
[1]: https://docs.rust-embedded.org/book/start/exceptions.html
Cause an error in the #[entry] macro instead of avr-device
Include generated files instead of build-script
Signed-off-by: Rahix <rahix@rahix.de>
macros: Add a #[entry] macro
Add a #[entry] macro for declaring the entry-point of the program,
similar to what cortex-m-rt is doing.
Signed-off-by: Rahix <rahix@rahix.de>
Update proc-macro dependencies
Update to syn 1.0 and fix the interrupt macro to work well with the new
version.
Signed-off-by: Rahix <rahix@rahix.de>
Implement interrupts
This commit adds a new feature-flag `rt` which, when enabled, adds the
`#[interrupt]` procedural macro to define an interrupt handler. Unlike
the implementation in cortex-m, this version needs an attribute which is
the name of the chip the interrupt is for. In code, an interrupt
handler might look like this:
#![feature(abi_avr_interrupt)]
#[avr_device::interrupt(atmega32u4)]
fn INT6() {
// Do Something
}
Closes #1.
Signed-off-by: Rahix <rahix@rahix.de>