aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorQuentin Smith <[email protected]>2023-07-17 21:31:43 -0400
committerQuentin Smith <[email protected]>2023-07-17 21:31:43 -0400
commit6f02403184eb7fb7990fb88fc9df9c4328a690a3 (patch)
tree748f510e190bb2724750507a6e69ed1a8e08cb20 /docs
parentd896f80405aa8963877049ed999e4aba25d6e2bb (diff)
parent6b5df4523aa1c4902f02e803450ae4b418e0e3ca (diff)
Merge remote-tracking branch 'origin/main' into nrf-pdm
Diffstat (limited to 'docs')
-rw-r--r--docs/modules/ROOT/examples/basic/Cargo.toml6
-rw-r--r--docs/modules/ROOT/examples/basic/build.rs35
-rw-r--r--docs/modules/ROOT/examples/basic/memory.x7
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/Cargo.toml1
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml5
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml3
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml1
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs24
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml3
-rw-r--r--docs/modules/ROOT/pages/basic_application.adoc23
-rw-r--r--docs/modules/ROOT/pages/bootloader.adoc68
-rw-r--r--docs/modules/ROOT/pages/getting_started.adoc4
-rw-r--r--docs/modules/ROOT/pages/layer_by_layer.adoc8
-rw-r--r--docs/modules/ROOT/pages/runtime.adoc2
-rw-r--r--docs/modules/ROOT/pages/stm32.adoc4
15 files changed, 140 insertions, 54 deletions
diff --git a/docs/modules/ROOT/examples/basic/Cargo.toml b/docs/modules/ROOT/examples/basic/Cargo.toml
index ae124a871..237ae0ac2 100644
--- a/docs/modules/ROOT/examples/basic/Cargo.toml
+++ b/docs/modules/ROOT/examples/basic/Cargo.toml
@@ -3,16 +3,16 @@ authors = ["Dario Nieuwenhuis <[email protected]>"]
3edition = "2018" 3edition = "2018"
4name = "embassy-basic-example" 4name = "embassy-basic-example"
5version = "0.1.0" 5version = "0.1.0"
6license = "MIT OR Apache-2.0"
6 7
7[dependencies] 8[dependencies]
8embassy-executor = { version = "0.1.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly"] } 9embassy-executor = { version = "0.2.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly", "integrated-timers", "arch-cortex-m", "executor-thread"] }
9embassy-time = { version = "0.1.0", path = "../../../../../embassy-time", features = ["defmt", "nightly"] } 10embassy-time = { version = "0.1.0", path = "../../../../../embassy-time", features = ["defmt", "nightly"] }
10embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "nightly"] } 11embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "nightly"] }
11 12
12defmt = "0.3" 13defmt = "0.3"
13defmt-rtt = "0.3" 14defmt-rtt = "0.3"
14 15
15cortex-m = "0.7.3" 16cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
16cortex-m-rt = "0.7.0" 17cortex-m-rt = "0.7.0"
17embedded-hal = "0.2.6"
18panic-probe = { version = "0.3", features = ["print-defmt"] } 18panic-probe = { version = "0.3", features = ["print-defmt"] }
diff --git a/docs/modules/ROOT/examples/basic/build.rs b/docs/modules/ROOT/examples/basic/build.rs
new file mode 100644
index 000000000..30691aa97
--- /dev/null
+++ b/docs/modules/ROOT/examples/basic/build.rs
@@ -0,0 +1,35 @@
1//! This build script copies the `memory.x` file from the crate root into
2//! a directory where the linker can always find it at build time.
3//! For many projects this is optional, as the linker always searches the
4//! project root directory -- wherever `Cargo.toml` is. However, if you
5//! are using a workspace or have a more complicated build setup, this
6//! build script becomes required. Additionally, by requesting that
7//! Cargo re-run the build script whenever `memory.x` is changed,
8//! updating `memory.x` ensures a rebuild of the application with the
9//! new memory settings.
10
11use std::env;
12use std::fs::File;
13use std::io::Write;
14use std::path::PathBuf;
15
16fn main() {
17 // Put `memory.x` in our output directory and ensure it's
18 // on the linker search path.
19 let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
20 File::create(out.join("memory.x"))
21 .unwrap()
22 .write_all(include_bytes!("memory.x"))
23 .unwrap();
24 println!("cargo:rustc-link-search={}", out.display());
25
26 // By default, Cargo will re-run a build script whenever
27 // any file in the project changes. By specifying `memory.x`
28 // here, we ensure the build script is only re-run when
29 // `memory.x` is changed.
30 println!("cargo:rerun-if-changed=memory.x");
31
32 println!("cargo:rustc-link-arg-bins=--nmagic");
33 println!("cargo:rustc-link-arg-bins=-Tlink.x");
34 println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
35}
diff --git a/docs/modules/ROOT/examples/basic/memory.x b/docs/modules/ROOT/examples/basic/memory.x
new file mode 100644
index 000000000..9b04edec0
--- /dev/null
+++ b/docs/modules/ROOT/examples/basic/memory.x
@@ -0,0 +1,7 @@
1MEMORY
2{
3 /* NOTE 1 K = 1 KiBi = 1024 bytes */
4 /* These values correspond to the NRF52840 with Softdevices S140 7.0.1 */
5 FLASH : ORIGIN = 0x00000000, LENGTH = 1024K
6 RAM : ORIGIN = 0x20000000, LENGTH = 256K
7}
diff --git a/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml
index 9048d9302..943249a17 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml
+++ b/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml
@@ -10,7 +10,6 @@ members = [
10[patch.crates-io] 10[patch.crates-io]
11embassy-executor = { path = "../../../../../embassy-executor" } 11embassy-executor = { path = "../../../../../embassy-executor" }
12embassy-stm32 = { path = "../../../../../embassy-stm32" } 12embassy-stm32 = { path = "../../../../../embassy-stm32" }
13stm32-metapac = { path = "../../../../../stm32-metapac" }
14 13
15[profile.release] 14[profile.release]
16codegen-units = 1 15codegen-units = 1
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml
index e2933076f..a7236ed5e 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml
@@ -2,12 +2,13 @@
2name = "blinky-async" 2name = "blinky-async"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7cortex-m = "0.7" 8cortex-m = "0.7"
8cortex-m-rt = "0.7" 9cortex-m-rt = "0.7"
9embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"], default-features = false } 10embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"] }
10embassy-executor = { version = "0.1.0", default-features = false, features = ["nightly"] } 11embassy-executor = { version = "0.2.0", features = ["nightly", "arch-cortex-m", "executor-thread"] }
11 12
12defmt = "0.3.0" 13defmt = "0.3.0"
13defmt-rtt = "0.3.0" 14defmt-rtt = "0.3.0"
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml
index dbd3aba8b..c15de2db2 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml
@@ -2,11 +2,12 @@
2name = "blinky-hal" 2name = "blinky-hal"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7cortex-m = "0.7" 8cortex-m = "0.7"
8cortex-m-rt = "0.7" 9cortex-m-rt = "0.7"
9embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x"], default-features = false } 10embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x"] }
10 11
11defmt = "0.3.0" 12defmt = "0.3.0"
12defmt-rtt = "0.3.0" 13defmt-rtt = "0.3.0"
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml
index 0dd326015..9733658b6 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml
@@ -2,6 +2,7 @@
2name = "blinky-irq" 2name = "blinky-irq"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7cortex-m = "0.7" 8cortex-m = "0.7"
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs
index 743d0c342..aecba0755 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs
@@ -20,13 +20,13 @@ fn main() -> ! {
20 let led = Output::new(p.PB14, Level::Low, Speed::Low); 20 let led = Output::new(p.PB14, Level::Low, Speed::Low);
21 let mut button = Input::new(p.PC13, Pull::Up); 21 let mut button = Input::new(p.PC13, Pull::Up);
22 22
23 cortex_m::interrupt::free(|cs| unsafe { 23 cortex_m::interrupt::free(|cs| {
24 enable_interrupt(&mut button); 24 enable_interrupt(&mut button);
25 25
26 LED.borrow(cs).borrow_mut().replace(led); 26 LED.borrow(cs).borrow_mut().replace(led);
27 BUTTON.borrow(cs).borrow_mut().replace(button); 27 BUTTON.borrow(cs).borrow_mut().replace(button);
28 28
29 NVIC::unmask(pac::Interrupt::EXTI15_10); 29 unsafe { NVIC::unmask(pac::Interrupt::EXTI15_10) };
30 }); 30 });
31 31
32 loop { 32 loop {
@@ -64,25 +64,21 @@ const PORT: u8 = 2;
64const PIN: usize = 13; 64const PIN: usize = 13;
65fn check_interrupt<P: Pin>(_pin: &mut Input<'static, P>) -> bool { 65fn check_interrupt<P: Pin>(_pin: &mut Input<'static, P>) -> bool {
66 let exti = pac::EXTI; 66 let exti = pac::EXTI;
67 unsafe { 67 let pin = PIN;
68 let pin = PIN; 68 let lines = exti.pr(0).read();
69 let lines = exti.pr(0).read(); 69 lines.line(pin)
70 lines.line(pin)
71 }
72} 70}
73 71
74fn clear_interrupt<P: Pin>(_pin: &mut Input<'static, P>) { 72fn clear_interrupt<P: Pin>(_pin: &mut Input<'static, P>) {
75 let exti = pac::EXTI; 73 let exti = pac::EXTI;
76 unsafe { 74 let pin = PIN;
77 let pin = PIN; 75 let mut lines = exti.pr(0).read();
78 let mut lines = exti.pr(0).read(); 76 lines.set_line(pin, true);
79 lines.set_line(pin, true); 77 exti.pr(0).write_value(lines);
80 exti.pr(0).write_value(lines);
81 }
82} 78}
83 79
84fn enable_interrupt<P: Pin>(_pin: &mut Input<'static, P>) { 80fn enable_interrupt<P: Pin>(_pin: &mut Input<'static, P>) {
85 cortex_m::interrupt::free(|_| unsafe { 81 cortex_m::interrupt::free(|_| {
86 let rcc = pac::RCC; 82 let rcc = pac::RCC;
87 rcc.apb2enr().modify(|w| w.set_syscfgen(true)); 83 rcc.apb2enr().modify(|w| w.set_syscfgen(true));
88 84
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml
index e7f4f5d1f..f872b94cb 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml
@@ -2,11 +2,12 @@
2name = "blinky-pac" 2name = "blinky-pac"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7cortex-m = "0.7" 8cortex-m = "0.7"
8cortex-m-rt = "0.7" 9cortex-m-rt = "0.7"
9stm32-metapac = { version = "0.1.0", features = ["stm32l475vg", "memory-x"] } 10stm32-metapac = { version = "1", features = ["stm32l475vg", "memory-x"] }
10 11
11defmt = "0.3.0" 12defmt = "0.3.0"
12defmt-rtt = "0.3.0" 13defmt-rtt = "0.3.0"
diff --git a/docs/modules/ROOT/pages/basic_application.adoc b/docs/modules/ROOT/pages/basic_application.adoc
index 4dc4a6359..3f4f16e28 100644
--- a/docs/modules/ROOT/pages/basic_application.adoc
+++ b/docs/modules/ROOT/pages/basic_application.adoc
@@ -21,7 +21,7 @@ Then, what follows are some declarations on how to deal with panics and faults.
21 21
22[source,rust] 22[source,rust]
23---- 23----
24include::example$basic/src/main.rs[lines="11..12"] 24include::example$basic/src/main.rs[lines="10"]
25---- 25----
26 26
27=== Task declaration 27=== Task declaration
@@ -30,7 +30,7 @@ After a bit of import declaration, the tasks run by the application should be de
30 30
31[source,rust] 31[source,rust]
32---- 32----
33include::example$basic/src/main.rs[lines="13..22"] 33include::example$basic/src/main.rs[lines="12..20"]
34---- 34----
35 35
36An embassy task must be declared `async`, and may NOT take generic arguments. In this case, we are handed the LED that should be blinked and the interval of the blinking. 36An embassy task must be declared `async`, and may NOT take generic arguments. In this case, we are handed the LED that should be blinked and the interval of the blinking.
@@ -45,23 +45,10 @@ The `Spawner` is the way the main application spawns other tasks. The `Periphera
45 45
46[source,rust] 46[source,rust]
47---- 47----
48include::example$basic/src/main.rs[lines="23..-1"] 48include::example$basic/src/main.rs[lines="22..-1"]
49---- 49----
50 50
51`#[embassy_executor::main]` takes an optional `config` parameter specifying a function that returns an instance of HAL's `Config` struct. For example: 51What happens when the `blinker` task has been spawned and main returns? Well, the main entry point is actually just like any other task, except that you can only have one and it takes some specific type arguments. The magic lies within the `#[embassy::main]` macro. The macro does the following:
52
53```rust
54fn embassy_config() -> embassy_nrf::config::Config {
55 embassy_nrf::config::Config::default()
56}
57
58#[embassy_executor::main(config = "embassy_config()")]
59async fn main(_spawner: Spawner, p: embassy_nrf::Peripherals) {
60 // ...
61}
62```
63
64What happens when the `blinker` task have been spawned and main returns? Well, the main entry point is actually just like any other task, except that you can only have one and it takes some specific type arguments. The magic lies within the `#[embassy::main]` macro. The macro does the following:
65 52
66. Creates an Embassy Executor 53. Creates an Embassy Executor
67. Initializes the microcontroller HAL to get the `Peripherals` 54. Initializes the microcontroller HAL to get the `Peripherals`
@@ -76,7 +63,7 @@ The project definition needs to contain the embassy dependencies:
76 63
77[source,toml] 64[source,toml]
78---- 65----
79include::example$basic/Cargo.toml[lines="8..9"] 66include::example$basic/Cargo.toml[lines="9..11"]
80---- 67----
81 68
82Depending on your microcontroller, you may need to replace `embassy-nrf` with something else (`embassy-stm32` for STM32. Remember to update feature flags as well). 69Depending on your microcontroller, you may need to replace `embassy-nrf` with something else (`embassy-stm32` for STM32. Remember to update feature flags as well).
diff --git a/docs/modules/ROOT/pages/bootloader.adoc b/docs/modules/ROOT/pages/bootloader.adoc
index ae92e9d5d..b7215e52a 100644
--- a/docs/modules/ROOT/pages/bootloader.adoc
+++ b/docs/modules/ROOT/pages/bootloader.adoc
@@ -6,7 +6,7 @@ The bootloader can be used either as a library or be flashed directly if you are
6 6
7By design, the bootloader does not provide any network capabilities. Networking capabilities for fetching new firmware can be provided by the user application, using the bootloader as a library for updating the firmware, or by using the bootloader as a library and adding this capability yourself. 7By design, the bootloader does not provide any network capabilities. Networking capabilities for fetching new firmware can be provided by the user application, using the bootloader as a library for updating the firmware, or by using the bootloader as a library and adding this capability yourself.
8 8
9The bootloader supports both internal and external flash by relying on the `embedded-storage` traits. 9The bootloader supports both internal and external flash by relying on the `embedded-storage` traits. The bootloader optionally supports the verification of firmware that has been digitally signed (recommended).
10 10
11 11
12== Hardware support 12== Hardware support
@@ -15,6 +15,7 @@ The bootloader supports
15 15
16* nRF52 with and without softdevice 16* nRF52 with and without softdevice
17* STM32 L4, WB, WL, L1, L0, F3, F7 and H7 17* STM32 L4, WB, WL, L1, L0, F3, F7 and H7
18* Raspberry Pi: RP2040
18 19
19In general, the bootloader works on any platform that implements the `embedded-storage` traits for its internal flash, but may require custom initialization code to work. 20In general, the bootloader works on any platform that implements the `embedded-storage` traits for its internal flash, but may require custom initialization code to work.
20 21
@@ -25,12 +26,69 @@ image::bootloader_flash.png[Bootloader flash layout]
25The bootloader divides the storage into 4 main partitions, configurable when creating the bootloader 26The bootloader divides the storage into 4 main partitions, configurable when creating the bootloader
26instance or via linker scripts: 27instance or via linker scripts:
27 28
28* BOOTLOADER - Where the bootloader is placed. The bootloader itself consumes about 8kB of flash. 29* BOOTLOADER - Where the bootloader is placed. The bootloader itself consumes about 8kB of flash, but if you need to debug it and have space available, increasing this to 24kB will allow you to run the bootloader with probe-rs.
29* ACTIVE - Where the main application is placed. The bootloader will attempt to load the application at the start of this partition. This partition is only written to by the bootloader. 30* ACTIVE - Where the main application is placed. The bootloader will attempt to load the application at the start of this partition. This partition is only written to by the bootloader. The size required for this partition depends on the size of your application.
30* DFU - Where the application-to-be-swapped is placed. This partition is written to by the application. 31* DFU - Where the application-to-be-swapped is placed. This partition is written to by the application. This partition must be at least 1 page bigger than the ACTIVE partition, since the swap algorithm uses the extra space to ensure power safe copy of data:
31* BOOTLOADER STATE - Where the bootloader stores the current state describing if the active and dfu partitions need to be swapped. When the new firmware has been written to the DFU partition, a flag is set to instruct the bootloader that the partitions should be swapped. 32+
33Partition Size~dfu~= Partition Size~active~+ Page Size~active~
34+
35All values are specified in bytes.
36
37* BOOTLOADER STATE - Where the bootloader stores the current state describing if the active and dfu partitions need to be swapped. When the new firmware has been written to the DFU partition, a magic field is written to instruct the bootloader that the partitions should be swapped. This partition must be able to store a magic field as well as the partition swap progress. The partition size given by:
38+
39Partition Size~state~ = Write Size~state~ + (2 × Partition Size~active~ / Page Size~active~)
40+
41All values are specified in bytes.
32 42
33The partitions for ACTIVE (+BOOTLOADER), DFU and BOOTLOADER_STATE may be placed in separate flash. The page size used by the bootloader is determined by the lowest common multiple of the ACTIVE and DFU page sizes. 43The partitions for ACTIVE (+BOOTLOADER), DFU and BOOTLOADER_STATE may be placed in separate flash. The page size used by the bootloader is determined by the lowest common multiple of the ACTIVE and DFU page sizes.
34The BOOTLOADER_STATE partition must be big enough to store one word per page in the ACTIVE and DFU partitions combined. 44The BOOTLOADER_STATE partition must be big enough to store one word per page in the ACTIVE and DFU partitions combined.
35 45
36The bootloader has a platform-agnostic part, which implements the power fail safe swapping algorithm given the boundaries set by the partitions. The platform-specific part is a minimal shim that provides additional functionality such as watchdogs or supporting the nRF52 softdevice. 46The bootloader has a platform-agnostic part, which implements the power fail safe swapping algorithm given the boundaries set by the partitions. The platform-specific part is a minimal shim that provides additional functionality such as watchdogs or supporting the nRF52 softdevice.
47
48=== FirmwareUpdater
49
50The `FirmwareUpdater` is an object for conveniently flashing firmware to the DFU partition and subsequently marking it as being ready for swapping with the active partition on the next reset. Its principle methods are `write_firmware`, which is called once per the size of the flash "write block" (typically 4KiB), and `mark_updated`, which is the final call.
51
52=== Verification
53
54The bootloader supports the verification of firmware that has been flashed to the DFU partition. Verification requires that firmware has been signed digitally using link:https://ed25519.cr.yp.to/[`ed25519`] signatures. With verification enabled, the `FirmwareUpdater::verify_and_mark_updated` method is called in place of `mark_updated`. A public key and signature are required, along with the actual length of the firmware that has been flashed. If verification fails then the firmware will not be marked as updated and therefore be rejected.
55
56Signatures are normally conveyed with the firmware to be updated and not written to flash. How signatures are provided is a firmware responsibility.
57
58To enable verification use either the `ed25519-dalek` or `ed25519-salty` features when depending on the `embassy-boot` crate. We recommend `ed25519-salty` at this time due to its small size.
59
60==== Tips on keys and signing with ed25519
61
62Ed25519 is a public key signature system where you are responsible for keeping the private key secure. We recommend embedding the *public* key in your program so that it can be easily passed to `verify_and_mark_updated`. An example declaration of the public key in your firmware:
63
64[source, rust]
65----
66static PUBLIC_SIGNING_KEY: &[u8] = include_bytes!("key.pub");
67----
68
69Signatures are often conveyed along with firmware by appending them.
70
71Ed25519 keys can be generated by a variety of tools. We recommend link:https://man.openbsd.org/signify[`signify`] as it is in wide use to sign and verify OpenBSD distributions, and is straightforward to use.
72
73The following set of Bash commands can be used to generate public and private keys on Unix platforms, and also generate a local `key.pub` file with the `signify` file headers removed. Declare a `SECRETS_DIR` environment variable in a secure location.
74
75[source, bash]
76----
77signify -G -n -p $SECRETS_DIR/key.pub -s $SECRETS_DIR/key.sec
78tail -n1 $SECRETS_DIR/key.pub | base64 -d -i - | dd ibs=10 skip=1 > key.pub
79chmod 700 $SECRETS_DIR/key.sec
80export SECRET_SIGNING_KEY=$(tail -n1 $SECRETS_DIR/key.sec)
81----
82
83Then, to sign your firmware given a declaration of `FIRMWARE_DIR` and a firmware filename of `myfirmware`:
84
85[source, bash]
86----
87shasum -a 512 -b $FIRMWARE_DIR/myfirmware > $SECRETS_DIR/message.txt
88cat $SECRETS_DIR/message.txt | dd ibs=128 count=1 | xxd -p -r > $SECRETS_DIR/message.txt
89signify -S -s $SECRETS_DIR/key.sec -m $SECRETS_DIR/message.txt -x $SECRETS_DIR/message.txt.sig
90cp $FIRMWARE_DIR/myfirmware $FIRMWARE_DIR/myfirmware+signed
91tail -n1 $SECRETS_DIR/message.txt.sig | base64 -d -i - | dd ibs=10 skip=1 >> $FIRMWARE_DIR/myfirmware+signed
92----
93
94Remember, guard the `$SECRETS_DIR/key.sec` key as compromising it means that another party can sign your firmware. \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/getting_started.adoc b/docs/modules/ROOT/pages/getting_started.adoc
index f3492a3d0..881e449b6 100644
--- a/docs/modules/ROOT/pages/getting_started.adoc
+++ b/docs/modules/ROOT/pages/getting_started.adoc
@@ -45,11 +45,11 @@ You can run an example by opening a terminal and entering the following commands
45 45
46[source, bash] 46[source, bash]
47---- 47----
48cd examples/nrf 48cd examples/nrf52840
49cargo run --bin blinky --release 49cargo run --bin blinky --release
50---- 50----
51 51
52== Whats next? 52== What's next?
53 53
54Congratulations, you have your first Embassy application running! Here are some alternatives on where to go from here: 54Congratulations, you have your first Embassy application running! Here are some alternatives on where to go from here:
55 55
diff --git a/docs/modules/ROOT/pages/layer_by_layer.adoc b/docs/modules/ROOT/pages/layer_by_layer.adoc
index a96dd9fe2..a78a64a97 100644
--- a/docs/modules/ROOT/pages/layer_by_layer.adoc
+++ b/docs/modules/ROOT/pages/layer_by_layer.adoc
@@ -8,7 +8,7 @@ The application we'll write is a simple 'push button, blink led' application, wh
8 8
9== PAC version 9== PAC version
10 10
11The PAC is the lowest API for accessing peripherals and registers, if you don't count reading/writing directly to memory addresses. It provide distinct types 11The PAC is the lowest API for accessing peripherals and registers, if you don't count reading/writing directly to memory addresses. It provides distinct types
12to make accessing peripheral registers easier, but it does not prevent you from writing unsafe code. 12to make accessing peripheral registers easier, but it does not prevent you from writing unsafe code.
13 13
14Writing an application using the PAC directly is therefore not recommended, but if the functionality you want to use is not exposed in the upper layers, that's what you need to use. 14Writing an application using the PAC directly is therefore not recommended, but if the functionality you want to use is not exposed in the upper layers, that's what you need to use.
@@ -20,13 +20,13 @@ The blinky app using PAC is shown below:
20include::example$layer-by-layer/blinky-pac/src/main.rs[] 20include::example$layer-by-layer/blinky-pac/src/main.rs[]
21---- 21----
22 22
23As you can see, there are a lot of code needed to enable the peripheral clocks, configuring the input pins and the output pins of the application. 23As you can see, a lot of code is needed to enable the peripheral clocks and to configure the input pins and the output pins of the application.
24 24
25Another downside of this application is that it is busy-looping while polling the button state. This prevents the microcontroller from utilizing any sleep mode to save power. 25Another downside of this application is that it is busy-looping while polling the button state. This prevents the microcontroller from utilizing any sleep mode to save power.
26 26
27== HAL version 27== HAL version
28 28
29To simplify our application, we can use the HAL instead. The HAL exposes higher level APIs that handle details such 29To simplify our application, we can use the HAL instead. The HAL exposes higher level APIs that handle details such as:
30 30
31* Automatically enabling the peripheral clock when you're using the peripheral 31* Automatically enabling the peripheral clock when you're using the peripheral
32* Deriving and applying register configuration from higher level types 32* Deriving and applying register configuration from higher level types
@@ -39,7 +39,7 @@ The HAL example is shown below:
39include::example$layer-by-layer/blinky-hal/src/main.rs[] 39include::example$layer-by-layer/blinky-hal/src/main.rs[]
40---- 40----
41 41
42As you can see, the application becomes a lot simpler, even without using any async code. The `Input` and `Output` hides all the details accessing the GPIO registers, and allow you to use a much simpler API to query the state of the button and toggle the LED output accordingly. 42As you can see, the application becomes a lot simpler, even without using any async code. The `Input` and `Output` types hide all the details of accessing the GPIO registers and allow you to use a much simpler API for querying the state of the button and toggling the LED output.
43 43
44The same downside from the PAC example still applies though: the application is busy looping and consuming more power than necessary. 44The same downside from the PAC example still applies though: the application is busy looping and consuming more power than necessary.
45 45
diff --git a/docs/modules/ROOT/pages/runtime.adoc b/docs/modules/ROOT/pages/runtime.adoc
index a7d6a8d0c..5096f5a43 100644
--- a/docs/modules/ROOT/pages/runtime.adoc
+++ b/docs/modules/ROOT/pages/runtime.adoc
@@ -20,7 +20,7 @@ IMPORTANT: The executor relies on tasks not blocking indefinitely, as this preve
20 20
21image::embassy_executor.png[Executor model] 21image::embassy_executor.png[Executor model]
22 22
23If you use the `#[embassy::main]` macro in your application, it creates the `Executor` for you and spawns the main entry point as the first task. You can also create the Executor manually, and you can in fact create multiple Executors. 23If you use the `#[embassy_executor::main]` macro in your application, it creates the `Executor` for you and spawns the main entry point as the first task. You can also create the Executor manually, and you can in fact create multiple Executors.
24 24
25 25
26== Interrupts 26== Interrupts
diff --git a/docs/modules/ROOT/pages/stm32.adoc b/docs/modules/ROOT/pages/stm32.adoc
index 8ed9ab04b..7bfc0592b 100644
--- a/docs/modules/ROOT/pages/stm32.adoc
+++ b/docs/modules/ROOT/pages/stm32.adoc
@@ -4,9 +4,9 @@ The link:https://github.com/embassy-rs/embassy/tree/master/embassy-stm32[Embassy
4 4
5== The infinite variant problem 5== The infinite variant problem
6 6
7STM32 microcontrollers comes in many families and flavors, and supporting all of them is a big undertaking. Embassy has taken advantage of the fact 7STM32 microcontrollers come in many families, and flavors and supporting all of them is a big undertaking. Embassy has taken advantage of the fact
8that the STM32 peripheral versions are shared across chip families. Instead of re-implementing the SPI 8that the STM32 peripheral versions are shared across chip families. Instead of re-implementing the SPI
9peripheral for every STM32 chip family, embassy have a single SPI implementation that depends on 9peripheral for every STM32 chip family, embassy has a single SPI implementation that depends on
10code-generated register types that are identical for STM32 families with the same version of a given peripheral. 10code-generated register types that are identical for STM32 families with the same version of a given peripheral.
11 11
12=== The metapac 12=== The metapac