diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2019-04-21 20:25:59 +0200 |
|---|---|---|
| committer | Jorge Aparicio <jorge@japaric.io> | 2019-05-01 20:49:25 +0200 |
| commit | 3adc9c31f3fd46af7e3a42a5adba7471452f06e1 (patch) | |
| tree | abd96443848f086082fc3a1dbf794dba9a0ff501 /book/en/src/by-example/app.md | |
| parent | d538f5b17cf0ad482cd803d7fbaada3349d6485e (diff) | |
update the book
Diffstat (limited to 'book/en/src/by-example/app.md')
| -rw-r--r-- | book/en/src/by-example/app.md | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/book/en/src/by-example/app.md b/book/en/src/by-example/app.md index 996b8c1..d595570 100644 --- a/book/en/src/by-example/app.md +++ b/book/en/src/by-example/app.md @@ -28,15 +28,14 @@ not required to use the [`cortex_m_rt::entry`] attribute. Within the pseudo-module the `app` attribute expects to find an initialization function marked with the `init` attribute. This function must have signature -`[unsafe] fn()`. +`fn(init::Context) [-> init::LateResources]`. This initialization function will be the first part of the application to run. The `init` function will run *with interrupts disabled* and has exclusive access to Cortex-M and device specific peripherals through the `core` and `device` -variables, which are injected in the scope of `init` by the `app` attribute. Not -all Cortex-M peripherals are available in `core` because the RTFM runtime takes -ownership of some of them -- for more details see the [`rtfm::Peripherals`] -struct. +variables fields of `init::Context`. Not all Cortex-M peripherals are available +in `core` because the RTFM runtime takes ownership of some of them -- for more +details see the [`rtfm::Peripherals`] struct. `static mut` variables declared at the beginning of `init` will be transformed into `&'static mut` references that are safe to access. @@ -61,7 +60,7 @@ $ cargo run --example init A function marked with the `idle` attribute can optionally appear in the pseudo-module. This function is used as the special *idle task* and must have -signature `[unsafe] fn() - > !`. +signature `fn(idle::Context) - > !`. When present, the runtime will execute the `idle` task after `init`. Unlike `init`, `idle` will run *with interrupts enabled* and it's not allowed to return |
