cortex-m-rt — Crate 詳細
cortex-m-rt
Mature no_std
Cortex-M 向けランタイム(スタートアップ)crate。リセットベクタ・例外ベクタの定義、#[entry] によるエントリポイント指定、例外ハンドラ登録などを提供します。
Runtime and startup support for Cortex-M microcontrollers (reset/exception vectors, #[entry], exception handlers).
コード例
#[entry] でエントリポイントを定義し、#[exception] で例外ハンドラを登録できます。
#![no_std]#![no_main]
use cortex_m_rt::{entry, exception, ExceptionFrame};use {defmt_rtt as _, panic_probe as _};
#[entry]fn main() -> ! { defmt::info!("boot"); loop { cortex_m::asm::wfi(); }}
#[exception]fn HardFault(ef: &ExceptionFrame) -> ! { defmt::error!("HardFault: pc={=u32}", ef.pc); loop { cortex_m::asm::bkpt(); }}