~ruther/avr-device

dbbbc6efba02077eed5c3a0b3ab0adee66e58a68 — Rahix 5 years ago a2c8437
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>
3 files changed, 9 insertions(+), 2 deletions(-)

M .gitignore
M Makefile
M src/lib.rs
M .gitignore => .gitignore +1 -0
@@ 6,4 6,5 @@ Cargo.lock
svd/
.deps/
src/devices/*/*
src/generic.rs
__pycache__/

M Makefile => Makefile +3 -2
@@ 32,8 32,9 @@ svd/%.patched.svd: svd/%.bare.svd patch/svdpatch.py
src/devices/%/mod.full.rs: svd/%.patched.svd
	@mkdir -p $(@D)
	@echo -e "\tSVD2RUST\t$*"
	@cd $(@D); svd2rust --target none -i $(realpath $<)
	@cd $(@D); svd2rust --generic_mod --target none -i $(realpath $<)
	@mv $(@D)/lib.rs $@
	@mv $(@D)/generic.rs $(@D)/../../generic.rs

src/devices/%/mod.rs: src/devices/%/mod.full.rs
	@echo -e "\tFORM\t\t$*"


@@ 45,7 46,7 @@ src/devices/%/mod.rs: src/devices/%/mod.full.rs
	@sed -i'' -e "1,7d" $@
	@# Remove DEVICE_PERIPHERALS declaration and replace it with a reference
	@# to the global version
	@sed -i'' -e '/^\#\[allow(renamed_and_removed_lints)\]/,+3cuse crate::devices::DEVICE_PERIPHERALS;' $@
	@sed -i'' -e '/^\#\[no_mangle\]/,+1cuse crate::devices::DEVICE_PERIPHERALS;' $@
	@echo -e "\tGEN-VECTOR\t>macros/src/vector.rs"
	@./gen-intr-lut.sh src/devices/*/interrupt.rs >macros/src/vector.rs


M src/lib.rs => src/lib.rs +5 -0
@@ 18,6 18,11 @@

pub mod interrupt;

#[allow(unused_imports)]
use generic::*;
#[doc = r"Common register and bit access and modify traits"]
pub mod generic;

#[cfg(feature = "rt")]
pub use avr_device_macros::interrupt;


Do not follow this link