我正在尝试为STM32F4Discovery编写一个多线程裸机应用程序,它使用的是面向大众的实时(RTFM)
crate
. 我从一个
example
this example
:
#![deny(unsafe_code)]
#![no_main]
#![no_std]
extern crate cortex_m;
extern crate cortex_m_rtfm as rtfm;
extern crate cortex_m_semihosting;
extern crate panic_semihosting;
extern crate stm32f4;
use stm32f4::stm32f407;
use rtfm::app;
app! {
device: stm32f407,
}
fn init(_p: init::Peripherals) {
}
fn idle() -> ! {
loop {
rtfm::wfi();
}
}
我可以让它编译,但与rust lld链接失败
= note: rust-lld: error: undefined symbol: main
我很困惑因为当我跑步的时候
cargo expand
我有一个主要功能:
fn main() {
#![allow(path_statements)]
let init: fn(init::Peripherals) = init;
rtfm::atomic(unsafe { &mut rtfm::Threshold::new(0) },
|_t|
unsafe {
let _late_resources =
init(init::Peripherals{core:
::stm32f407::CorePeripherals::steal(),
device:
::stm32f407::Peripherals::steal(),});
});
let idle: fn() -> ! = idle;
idle();
}
我刚接触Rust(事实上我希望通过这个项目来学习语言),不知道错误可能在哪里。