svd2rust icon indicating copy to clipboard operation
svd2rust copied to clipboard

Unclear how to use `#[interrupt]` macro without deprecated `--reexport-interrupt` flag

Open qwandor opened this issue 1 year ago • 3 comments

According to the documentation of svd2rust, the --reexport-interrupt flag is deprecated. However according to the documentation of cortex-m-rt, the #[interrupt] macro should only be used via the svd2rust reexport, and indeed it fails to compile when used directly, with a confusing error.

How is the interrupt macro supposed to be used without the --reexport-interrupt flag passed to svd2rust? This should at least be documented clearly in the svd2rust documentation.

qwandor avatar Mar 26 '24 15:03 qwandor

There have been planned some changes in cortex-m-rt 0.8 like moving interrupt in independent crate. But it is not done yet. Ask @adamgreig.

burrbull avatar Mar 26 '24 16:03 burrbull

I also stumbled into the issue, wondering why I could not use the interrupt macro, and I had to rebuild with the --reexport-interrupt flag.

robamu avatar Jun 25 '24 12:06 robamu

You can use it without the flag. But you have to import your PAC's Interrupt enum as interrupt.

use hal::pac::Interrupt as interrupt;
use cortex_m_rt::interrupt;

That's basically what the --reexport-interrupt flag does as well. Not sure if there's any value in doing this over using the deprecated flag for now.

royb3 avatar Aug 14 '24 09:08 royb3