Microcontrollers

The cortex_m_rt crate provides (among other things) a reset handler for Cortex M microcontrollers.

  1. #![no_main]
  2. #![no_std]
  3. extern crate panic_halt as _;
  4. mod interrupts;
  5. use cortex_m_rt::entry;
  6. #[entry]
  7. fn main() -> ! {
  8.     loop {}
  9. }

Next we’ll look at how to access peripherals, with increasing levels of abstraction.

  • The cortex_m_rt::entry macro requires that the function have type fn() -> !, because returning to the reset handler doesn’t make sense.
  • Run the example with cargo embed --bin minimal