mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2024-05-14 14:32:56 +00:00
28 lines
651 B
Rust
28 lines
651 B
Rust
// this program does not use the standard library to avoid heap allocations.
|
||
// only the `core` library functions are available.
|
||
#![no_std]
|
||
// this program uses a custom entry point instead of `fn main()`
|
||
#![no_main]
|
||
|
||
use cortex_m::asm;
|
||
use cortex_m_rt::entry;
|
||
use panic_log as _; // the panicking behavior
|
||
|
||
// the custom entry point
|
||
// vvvvv
|
||
#[entry]
|
||
fn main() -> ! {
|
||
// ˆˆˆ
|
||
// ! is the 'never' type: this function never returns
|
||
|
||
// initializes the peripherals
|
||
dk::init().unwrap();
|
||
|
||
log::info!("Hello, world!"); // :wave:
|
||
|
||
loop {
|
||
// breakpoint: halts the program's execution
|
||
asm::bkpt();
|
||
}
|
||
}
|