I want to write a program for the STM32F3Discovery board using rust and the cortex-m-rt
and stm32f30x
crates. More precisely I want to implement an external interrupt for which I want to use the #[interrupt]
attribute. But there seems to be a problem with the reexport.
The cortex-m-rt documentation on interrupts says that the #[interrupt]
attribute should not be used directly but rather the re-export in the device crate should be used:
extern crate device;
// the attribute comes from the device crate not from cortex-m-rt
use device::interrupt;
#[interrupt]
fn USART1() {
// ..
}
And indeed the documentation for the stm32f3x crate shows that this attribute from the cortex-m-rt crate is re-exported. However, compiling:
#![no_main]
#![no_std]
use cortex_m_rt::entry;
extern crate stm32f30x;
use stm32f30x::interrupt;
or
#![no_main]
#![no_std]
use cortex_m_rt::entry;
use stm32f30x::interrupt;
gives the error
error[E0432]: unresolved import `stm32f30x::interrupt`
--> srcmain.rs:9:5
|
9 | use stm32f30x::interrupt;
| ^^^^^^^^^^^---------
| | |
| | help: a similar name exists in the module (notice the capitalization): `Interrupt`
| no `interrupt` in the root
I have no idea why this happens, as the example I followed did the same. My dependencies in Cargo.toml look like the following:
[dependencies]
stm32f30x = "0.8.0"
cortex-m-rt = "0.6.3"
cortex-m = "0.6.3"
I am gratefull for any help :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…