stm32-rs / stm32l4xx-hal

A Hardware abstraction layer for the stm32l432xx series chips written in rust.
157 stars 104 forks source link

Compilation error while using interrupts #337

Closed crespum closed 1 year ago

crespum commented 1 year ago

This IRQ example returns the following compilation error (I'm using version 0.7.1):

   Compiling rust-obradoiro v0.1.0 (/proxectos/rust-obradoiro)
error[E0432]: unresolved import `crate::hal::interrupt`
  --> src/main.rs:11:5
   |
11 |     interrupt,
   |     ^^^^^^^^^ no `interrupt` in the root
   |
   = help: consider importing one of these items instead:
           cortex_m::interrupt
           crate::stm32::interrupt
           stm32l4xx_hal::pac::interrupt

error: cannot determine resolution for the attribute macro `interrupt`
  --> src/main.rs:71:3
   |
71 | #[interrupt]
   |   ^^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

warning: unused import: `cortex_m::interrupt`
  --> src/main.rs:17:5
   |
17 | use cortex_m::interrupt;
   |     ^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

For more information about this error, try `rustc --explain E0432`.
warning: `rust-obradoiro` (bin "rust-obradoiro") generated 1 warning
error: could not compile `rust-obradoiro` due to 2 previous errors; 1 warning emitted

I've tried the imports mentioned above, though some don't seem to exist. Neither of them work.

crespum commented 1 year ago

I realized I was missing enabling the rt feature in Cargo.toml:

[dependencies.stm32l4xx-hal]
features = ["rt", "stm32l452"]

Interrupts are still not working though.