问题描述
我想使用 rust 和 cortex-m-rt
和 stm32f30x
板条箱为 STM32F3Discovery 板编写程序。更准确地说,我想实现一个我想使用 #[interrupt]
属性的外部中断。但是转口好像有问题。
cortex-m-rt documentation on interrupts 表示不应直接使用 #[interrupt]
属性,而应使用设备箱中的重新导出:
extern crate device;
// the attribute comes from the device crate not from cortex-m-rt
use device::interrupt;
#[interrupt]
fn USART1() {
// ..
}
事实上,stm32f3x crate 的文档显示 cortex-m-rt 箱中的这个属性被重新导出。但是,编译:
#![no_main]
#![no_std]
use cortex_m_rt::entry;
extern crate stm32f30x;
use stm32f30x::interrupt;
或
#![no_main]
#![no_std]
use cortex_m_rt::entry;
use stm32f30x::interrupt;
给出错误
error[E0432]: unresolved import `stm32f30x::interrupt`
--> src\main.rs:9:5
|
9 | use stm32f30x::interrupt;
| ^^^^^^^^^^^---------
| | |
| | help: a similar name exists in the module (notice the capitalization): `Interrupt`
| no `interrupt` in the root
我不知道为什么会发生这种情况,因为 example I followed 也是如此。我在 Cargo.toml 中的依赖项如下所示:
[dependencies]
stm32f30x = "0.8.0"
cortex-m-rt = "0.6.3"
cortex-m = "0.6.3"
我很感激任何帮助:)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)