From 04189cc6844d7d43305a57464713defb5a46d85c Mon Sep 17 00:00:00 2001 From: John van der Koijk <33966414+jvanderk@users.noreply.github.com> Date: Sun, 20 Feb 2022 19:21:25 +0100 Subject: Mostly editorial review. --- book/en/src/by-example/app_init.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'book/en/src/by-example/app_init.md') diff --git a/book/en/src/by-example/app_init.md b/book/en/src/by-example/app_init.md index 22c4a28..5bf6200 100644 --- a/book/en/src/by-example/app_init.md +++ b/book/en/src/by-example/app_init.md @@ -1,13 +1,18 @@ # App initialization and the `#[init]` task An RTIC application requires an `init` task setting up the system. The corresponding `init` function must have the -signature `fn(init::Context) -> (Shared, Local, init::Monotonics)`, where `Shared` and `Local` are the resource +signature `fn(init::Context) -> (Shared, Local, init::Monotonics)`, where `Shared` and `Local` are resource structures defined by the user. -The `init` task executes after system reset (after the optionally defined `pre-init` and internal RTIC -initialization). The `init` task runs *with interrupts disabled* and has exclusive access to Cortex-M (the -`bare_metal::CriticalSection` token is available as `cs`) while device specific peripherals are available through -the `core` and `device` fields of `init::Context`. +The `init` task executes after system reset, [after an optionally defined `pre-init` code section][pre-init] and an always occurring internal RTIC +initialization. + +[pre-init]: https://docs.rs/cortex-m-rt/latest/cortex_m_rt/attr.pre_init.html + +The `init` and optional `pre-init` tasks runs *with interrupts disabled* and have exclusive access to Cortex-M (the +`bare_metal::CriticalSection` token is available as `cs`). + +Device specific peripherals are available through the `core` and `device` fields of `init::Context`. ## Example @@ -15,7 +20,7 @@ The example below shows the types of the `core`, `device` and `cs` fields, and s variable with `'static` lifetime. Such variables can be delegated from the `init` task to other tasks of the RTIC application. -The `device` field is available when the `peripherals` argument is set to the default value `true`. +The `device` field is only available when the `peripherals` argument is set to the default value `true`. In the rare case you want to implement an ultra-slim application you can explicitly set `peripherals` to `false`. ``` rust -- cgit v1.2.3