mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-10 16:25:37 +00:00
Merge pull request #143 from ferrous-systems/hello-explanation
point out parts of a embedded program in hello.rs, Cargo.toml
This commit is contained in:
commit
e9e2f15d65
2 changed files with 12 additions and 1 deletions
|
@ -6,10 +6,13 @@ rustflags = [
|
|||
]
|
||||
|
||||
[target.thumbv7em-none-eabihf]
|
||||
# set custom cargo runner to flash & run on embedded target when we call `cargo run`
|
||||
# for more information, check out https://github.com/knurling-rs/probe-run
|
||||
runner = "probe-run --chip nRF52840_xxAA"
|
||||
rustflags = [
|
||||
"-C", "link-arg=-Tlink.x",
|
||||
]
|
||||
|
||||
[build]
|
||||
# cross-compile to this target
|
||||
target = "thumbv7em-none-eabihf" # = ARM Cortex-M4
|
|
@ -1,12 +1,20 @@
|
|||
#![no_main]
|
||||
// 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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue