diff options
| author | Barnaby Walters <[email protected]> | 2023-12-05 01:01:50 +0100 |
|---|---|---|
| committer | Barnaby Walters <[email protected]> | 2023-12-05 01:01:50 +0100 |
| commit | a76dd2d70ff85f83b7fe1b0771b12f313682e901 (patch) | |
| tree | d6e9fc2fe2a9504bc3147c512e452886f4920291 /docs/modules/ROOT/pages/getting_started.adoc | |
| parent | 85d5f42562ca9374e3200d652616af9533346c5e (diff) | |
Moved content from the wiki to the docs
New: delaying_a_task.adoc, copied as-is from the wiki and placed in the
navigation until we have a better place for it (or remove/replace it)
index: Tweaked the structure, added some content from the wiki, and made
some general copy edits to improve clarity.
getting_started.adoc: Corrected various out-of-date information, added
troubleshooting tips from the wiki, added some new information, various
other small edits.
basic_application.adoc: Corrected out-of-date information, various clarifications
and edits.
After these changes, IMO most of the content on the github wiki is no longer
necessary and can be removed for clarity. The few sections I didn‘t integrate
or copy over were either out of date or unfinished.
Diffstat (limited to 'docs/modules/ROOT/pages/getting_started.adoc')
| -rw-r--r-- | docs/modules/ROOT/pages/getting_started.adoc | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/docs/modules/ROOT/pages/getting_started.adoc b/docs/modules/ROOT/pages/getting_started.adoc index 2c6f4b1ee..ab819ac2a 100644 --- a/docs/modules/ROOT/pages/getting_started.adoc +++ b/docs/modules/ROOT/pages/getting_started.adoc | |||
| @@ -9,7 +9,9 @@ If you don't have any supported board, don't worry: you can also run embassy on | |||
| 9 | 9 | ||
| 10 | == Getting a board with examples | 10 | == Getting a board with examples |
| 11 | 11 | ||
| 12 | Embassy supports many microcontroller families, but the easiest ways to get started is if you have one of the more common development kits. | 12 | Embassy supports many microcontroller families, but the quickest way to get started is by using a board which Embassy has existing example code for. |
| 13 | |||
| 14 | This list is non-exhaustive. If your board isn’t included here, check the link:https://github.com/embassy-rs/embassy/tree/main/examples[examples folder] to see if example code has been written for it. | ||
| 13 | 15 | ||
| 14 | === nRF kits | 16 | === nRF kits |
| 15 | 17 | ||
| @@ -36,7 +38,7 @@ Embassy supports many microcontroller families, but the easiest ways to get star | |||
| 36 | 38 | ||
| 37 | == Running an example | 39 | == Running an example |
| 38 | 40 | ||
| 39 | First you need to clone the [github repository]; | 41 | First you need to clone the link:https://github.com/embassy-rs/embassy[github repository]; |
| 40 | 42 | ||
| 41 | [source, bash] | 43 | [source, bash] |
| 42 | ---- | 44 | ---- |
| @@ -44,17 +46,80 @@ git clone https://github.com/embassy-rs/embassy.git | |||
| 44 | cd embassy | 46 | cd embassy |
| 45 | ---- | 47 | ---- |
| 46 | 48 | ||
| 47 | You can run an example by opening a terminal and entering the following commands: | 49 | Once you have a copy of the repository, find examples folder for your board and, and build an example program. `blinky` is a good choice as all it does is blink an LED – the embedded world’s equivalent of “Hello World”. |
| 48 | 50 | ||
| 49 | [source, bash] | 51 | [source, bash] |
| 50 | ---- | 52 | ---- |
| 51 | cd examples/nrf52840 | 53 | cd examples/nrf52840 |
| 54 | cargo build --bin blinky --release | ||
| 55 | ---- | ||
| 56 | |||
| 57 | Once you’ve confirmed you can build the example, connect your computer to your board with a debug probe and run it on hardware: | ||
| 58 | |||
| 59 | [source, bash] | ||
| 60 | ---- | ||
| 52 | cargo run --bin blinky --release | 61 | cargo run --bin blinky --release |
| 53 | ---- | 62 | ---- |
| 54 | 63 | ||
| 64 | If everything worked correctly, you should see a blinking LED on your board, and debug output similar to this on your computer: | ||
| 65 | |||
| 66 | [source] | ||
| 67 | ---- | ||
| 68 | Finished dev [unoptimized + debuginfo] target(s) in 1m 56s | ||
| 69 | Running `probe-run --chip STM32F407VGTx target/thumbv7em-none-eabi/debug/blinky` | ||
| 70 | (HOST) INFO flashing program (71.36 KiB) | ||
| 71 | (HOST) INFO success! | ||
| 72 | ──────────────────────────────────────────────────────────────────────────────── | ||
| 73 | 0 INFO Hello World! | ||
| 74 | └─ blinky::__embassy_main::task::{generator#0} @ src/bin/blinky.rs:18 | ||
| 75 | 1 INFO high | ||
| 76 | └─ blinky::__embassy_main::task::{generator#0} @ src/bin/blinky.rs:23 | ||
| 77 | 2 INFO low | ||
| 78 | └─ blinky::__embassy_main::task::{generator#0} @ src/bin/blinky.rs:27 | ||
| 79 | 3 INFO high | ||
| 80 | └─ blinky::__embassy_main::task::{generator#0} @ src/bin/blinky.rs:23 | ||
| 81 | 4 INFO low | ||
| 82 | └─ blinky::__embassy_main::task::{generator#0} @ src/bin/blinky.rs:27 | ||
| 83 | ---- | ||
| 84 | |||
| 85 | NOTE: How does the `cargo run` command know how to connect to our board and program it? In each `examples` folder, there’s a `.cargo/config.toml` file which tells cargo to use link:https://probe.rs/[probe-rs] as the runner for ARM binaries in that folder. probe-rs handles communication with the debug probe and MCU. In order for this to work, probe-rs needs to know which chip it’s programming, so you’ll have to edit this file if you want to run examples on other chips. | ||
| 86 | |||
| 87 | === It didn’t work! | ||
| 88 | |||
| 89 | If you hare having issues when running `cargo run --release`, please check the following: | ||
| 90 | |||
| 91 | * You are specifying the correct `--chip on the command line``, OR | ||
| 92 | * You have set `.cargo/config.toml`'s run line to the correct chip, AND | ||
| 93 | * You have changed `examples/Cargo.toml`'s HAL (e.g. embassy-stm32) dependency's feature to use the correct chip (replace the existing stm32xxxx feature) | ||
| 94 | |||
| 95 | At this point the project should run. If you do not see a blinky LED for blinky, for example, be sure to check the code is toggling your board's LED pin. | ||
| 96 | |||
| 97 | If you are trying to run an example with `cargo run --release` and you see the following output: | ||
| 98 | [source] | ||
| 99 | ---- | ||
| 100 | 0.000000 INFO Hello World! | ||
| 101 | └─ <invalid location: defmt frame-index: 14> | ||
| 102 | 0.000000 DEBUG rcc: Clocks { sys: Hertz(80000000), apb1: Hertz(80000000), apb1_tim: Hertz(80000000), apb2: Hertz(80000000), apb2_tim: Hertz(80000000), ahb1: Hertz(80000000), ahb2: Hertz(80000000), ahb3: Hertz(80000000) } | ||
| 103 | └─ <invalid location: defmt frame-index: 124> | ||
| 104 | 0.000061 TRACE allocating type=Interrupt mps=8 interval_ms=255, dir=In | ||
| 105 | └─ <invalid location: defmt frame-index: 68> | ||
| 106 | 0.000091 TRACE index=1 | ||
| 107 | └─ <invalid location: defmt frame-index: 72> | ||
| 108 | ---- | ||
| 109 | |||
| 110 | To get rid of the frame-index error add the following to your `Cargo.toml`: | ||
| 111 | |||
| 112 | [source,toml] | ||
| 113 | ---- | ||
| 114 | [profile.release] | ||
| 115 | debug = 2 | ||
| 116 | ---- | ||
| 117 | |||
| 118 | If you’re still having problems, check the link:https://embassy.dev/book/dev/faq.html[FAQ], or ask for help in the link:https://matrix.to/#/#embassy-rs:matrix.org[Embassy Chat Room]. | ||
| 119 | |||
| 55 | == What's next? | 120 | == What's next? |
| 56 | 121 | ||
| 57 | Congratulations, you have your first Embassy application running! Here are some alternatives on where to go from here: | 122 | Congratulations, you have your first Embassy application running! Here are some suggestions for where to go from here: |
| 58 | 123 | ||
| 59 | * Read more about the xref:runtime.adoc[executor]. | 124 | * Read more about the xref:runtime.adoc[executor]. |
| 60 | * Read more about the xref:hal.adoc[HAL]. | 125 | * Read more about the xref:hal.adoc[HAL]. |
