cortex_m - Rust (original) (raw)

Expand description

Low level access to Cortex-M processors

This crate provides:

§Optional features

§inline-asm

When this feature is enabled the implementation of all the functions inside the asm andregister modules use inline assembly (asm!) instead of external assembly (FFI into separate assembly files pre-compiled using arm-none-eabi-gcc). The advantages of enabling inline-asmare:

The disadvantage is that inline-asm requires a Rust version at least 1.59 to use the asm!()macro. In the future 0.8 and above versions of cortex-m, this feature will always be enabled.

§critical-section-single-core

This feature enables a critical-sectionimplementation suitable for single-core targets, based on disabling interrupts globally.

It is unsound to enable it on multi-core targets or for code running in unprivileged mode, and may cause functional problems in systems where some interrupts must be not be disabled or critical sections are managed as part of an RTOS. In these cases, you should use a target-specific implementation instead, typically provided by a HAL or RTOS crate.

§cm7-r0p1

This feature enables workarounds for errata found on Cortex-M7 chips with revision r0p1. Some functions in this crate only work correctly on those chips if this Cargo feature is enabled (the functions are documented accordingly).

§linker-plugin-lto

This feature links against prebuilt assembly blobs that are compatible with Linker-Plugin LTO. This allows inlining assembly routines into the caller, even without the inline-asm feature, and works on stable Rust (but note the drawbacks below!).

If you want to use this feature, you need to be aware of a few things:

§Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.38 and up. It _might_compile with older versions but that may change in any new patch release.

pub use crate::peripheral::[Peripherals](peripheral/struct.Peripherals.html "struct cortex_m::peripheral::Peripherals");

asm

Miscellaneous assembly instructions

cmse

Cortex-M Security Extensions

delay

A delay driver based on SysTick.

interrupt

Interrupts

itm

Instrumentation Trace Macrocell

peripheral

Core peripherals.

prelude

Prelude

register

Processor core registers

iprint

Macro for sending a formatted string through an ITM channel

iprintln

Macro for sending a formatted string through an ITM channel, with a newline.

singleton

Macro to create a mutable reference to a statically allocated value