Skip to content

no function or associated item named unmask found for struct cortex_m::peripheral::NVIC in the current scope #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TDHolmes opened this issue Jun 3, 2020 · 1 comment

Comments

@TDHolmes
Copy link
Contributor

TDHolmes commented Jun 3, 2020

I'm trying to write up an example app for an interrupt based sleeping timer, but when I try to compile this app as an example for the feather_m0 board, I get:

error[E0599]: no function or associated item named `unmask` found for struct `cortex_m::peripheral::NVIC` in the current scope
  --> examples/NVIC_repro.rs:30:15
   |
30 |         NVIC::unmask(interrupt::TC4);
   |               ^^^^^^ function or associated item not found in `cortex_m::peripheral::NVIC`

Here is a minimal repro of the issue, with unnecessary bits cut out:

#![no_std]
#![no_main]

extern crate cortex_m;
extern crate feather_m0 as hal;
extern crate panic_halt;

use hal::clock::GenericClockController;
use hal::entry;
use hal::pac::{interrupt, CorePeripherals, Peripherals};
use hal::prelude::*;

use cortex_m::peripheral::NVIC;

#[entry]
fn main() -> ! {
    // Configure all of our peripherals/clocks
    let mut peripherals = Peripherals::take().unwrap();
    let mut core = CorePeripherals::take().unwrap();
    let mut clocks = GenericClockController::with_external_32kosc(
        peripherals.GCLK,
        &mut peripherals.PM,
        &mut peripherals.SYSCTRL,
        &mut peripherals.NVMCTRL,
    );

    // enable interrupts
    unsafe {
        core.NVIC.set_priority(interrupt::TC4, 2);
        NVIC::unmask(interrupt::TC4);
    };
    loop {}
}

However, when I instead put this into a standalone binary app, I do not see the issue. Any ideas as to what is going on? Here is a fork of atsamd adding what I'm trying to do. To repro, check this branch out and run cargo build --example sleeping_timer from boards/feather_m0.

It might end up being an issue on the atsamd end, but I thought since the import issues seem to be coming from cortex-m, I'd start with this crate.

@TDHolmes
Copy link
Contributor Author

After some cargo clean'ing and updating my nightly compiler, this no longer occurs.

adamgreig pushed a commit that referenced this issue Jan 12, 2022
221: Version 0.6.11 r=therealprof a=jonas-schievink



Co-authored-by: Jonas Schievink <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant