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>
Add patches for ADC peripherals
Add a patch to fixup a few registers in the ADC peripheral
for ATmega328P, ATmega32U4, ATmega1280, and ATmega64.
ci: Fix nightly to 2020-07-12
Fix nightly to a version where rustfmt was still available.
Signed-off-by: Rahix <rahix@rahix.de>
make: Allow overriding rustup toolchain
Allow overriding the rustup toolchain used for rustfmt by invoking make
like this:
make RUSTUP_TOOLCHAIN=nightly-2020-07-12
This will (hopefully) help when working with nightly versions where
rustfmt is unavailable.
Signed-off-by: Rahix <rahix@rahix.de>
Use llvm_asm!() instead of asm!()
The asm!() feature was changed to a new syntax which this project did not yet
adopt. The old asm!() is now available as llvm_asm!(). Switch to that to
support nightly build.
See PR #27 for details.
README: Use ATmega64 as an up-to-date example
Signed-off-by: Rahix <rahix@rahix.de>
Add basic support for ATmega64
Pull in the ATDF file from Microchip and add all the necessary plumbing
around the code-base to make it compile. Not tested against real
hardware and no device-specific patches are included yet.
Signed-off-by: Rahix <rahix@rahix.de>
interrupts: Fix sed expressions for parsing interrupt list
The format for the interrupt sources changed which silently made
gen-intr-lut.sh no longer generate any interrupt names. Fix the
expressions so interrupt names are recognized again and the macro
can be used for generating interrupt definitions again.
Signed-off-by: Rahix <rahix@rahix.de>
make: Use a patchfile instead of weird sed expr
As reported in issue #24 the sed(1) expression used to patch the generated
`mod.rs` does not work on MacOS (BSD sed). Instead, use patch(1) and a small
patchfile to accomplish the same task.
Signed-off-by: Rahix <rahix@rahix.de>
gen-intr-lut: Switch to /usr/bin/env bash as interpreter
The location of the `bash` binary can vary between systems. Switch to
`/usr/bin/env bash` which is the recommended way to do it.
Ref: PR #22
Signed-off-by: Rahix <rahix@rahix.de>
Fix compatibility with svd2rust 1.16.1
svd2rust now generates a module containing generic descriptions which
the individual register definitions are based on. Fix the code
generation to deal with this module.
Signed-off-by: Rahix <rahix@rahix.de>
Improve build instructions
This commit changes the install-command for rustfmt to explicitly
install the nightly version. Ref #20.
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>
ci: Attempt building multple chips at once as well
Signed-off-by: Rahix <rahix@rahix.de>