2021-04-19 09:21:21 +00:00
|
|
|
|
// this program does not use the standard library to avoid heap allocations.
|
|
|
|
|
// only the `core` library functions are available.
|
2020-06-09 09:52:27 +00:00
|
|
|
|
#![no_std]
|
2021-04-19 09:21:21 +00:00
|
|
|
|
// this program uses a custom entry point instead of `fn main()`
|
|
|
|
|
#![no_main]
|
2020-06-09 09:52:27 +00:00
|
|
|
|
|
|
|
|
|
use cortex_m::asm;
|
|
|
|
|
use cortex_m_rt::entry;
|
2021-04-08 12:16:26 +00:00
|
|
|
|
// this imports `beginner/apps/lib.rs` to retrieve our global logger + panicking-behavior
|
|
|
|
|
use apps as _;
|
2020-06-09 09:52:27 +00:00
|
|
|
|
|
2021-04-19 09:55:11 +00:00
|
|
|
|
// the custom entry point
|
|
|
|
|
// vvvvv
|
2020-06-09 09:52:27 +00:00
|
|
|
|
#[entry]
|
|
|
|
|
fn main() -> ! {
|
2021-04-19 09:21:21 +00:00
|
|
|
|
// ˆˆˆ
|
2021-04-19 09:55:11 +00:00
|
|
|
|
// ! is the 'never' type: this function never returns
|
2021-04-19 09:21:21 +00:00
|
|
|
|
|
2020-06-09 09:52:27 +00:00
|
|
|
|
// initializes the peripherals
|
|
|
|
|
dk::init().unwrap();
|
|
|
|
|
|
2022-01-07 16:24:21 +00:00
|
|
|
|
defmt::println!("Hello, world!"); // :wave:
|
2020-06-09 09:52:27 +00:00
|
|
|
|
|
|
|
|
|
loop {
|
|
|
|
|
// breakpoint: halts the program's execution
|
|
|
|
|
asm::bkpt();
|
|
|
|
|
}
|
|
|
|
|
}
|