Microcontrollers
The cortex_m_rt crate provides (among other things) a reset handler for Cortex M microcontrollers.
1. ```
#![no_main]
```
2. ```
#![no_std]
```
4. ```
extern crate panic_halt as _;
```
6. ```
mod interrupts;
```
8. ```
use cortex_m_rt::entry;
```
10. ```
#[entry]
```
11. ```
fn main() -> ! {
```
12. ```
loop {}
```
13. ```
}
```
Next we’ll look at how to access peripherals, with increasing levels of abstraction.
- The
cortex_m_rt::entrymacro requires that the function have typefn() -> !, because returning to the reset handler doesn’t make sense. - Run the example with
cargo embed --bin minimal
