diff options
Diffstat (limited to 'docs/modules/ROOT')
| -rw-r--r-- | docs/modules/ROOT/pages/basic_application.adoc | 13 | ||||
| -rw-r--r-- | docs/modules/ROOT/pages/getting_started.adoc | 31 |
2 files changed, 26 insertions, 18 deletions
diff --git a/docs/modules/ROOT/pages/basic_application.adoc b/docs/modules/ROOT/pages/basic_application.adoc index 95792d5a0..02b8981c9 100644 --- a/docs/modules/ROOT/pages/basic_application.adoc +++ b/docs/modules/ROOT/pages/basic_application.adoc | |||
| @@ -17,15 +17,6 @@ The first thing you’ll notice are two attributes at the top of the file. These | |||
| 17 | include::example$basic/src/main.rs[lines="1..2"] | 17 | include::example$basic/src/main.rs[lines="1..2"] |
| 18 | ---- | 18 | ---- |
| 19 | 19 | ||
| 20 | === Rust Nightly | ||
| 21 | |||
| 22 | The next declaration is a Rust Unstable feature, which means that Embassy requires Rust Nightly: | ||
| 23 | |||
| 24 | [source,rust] | ||
| 25 | ---- | ||
| 26 | include::example$basic/src/main.rs[lines="3"] | ||
| 27 | ---- | ||
| 28 | |||
| 29 | === Dealing with errors | 20 | === Dealing with errors |
| 30 | 21 | ||
| 31 | Then, what follows are some declarations on how to deal with panics and faults. During development, a good practice is to rely on `defmt-rtt` and `panic-probe` to print diagnostics to the terminal: | 22 | Then, what follows are some declarations on how to deal with panics and faults. During development, a good practice is to rely on `defmt-rtt` and `panic-probe` to print diagnostics to the terminal: |
| @@ -41,7 +32,7 @@ After a bit of import declaration, the tasks run by the application should be de | |||
| 41 | 32 | ||
| 42 | [source,rust] | 33 | [source,rust] |
| 43 | ---- | 34 | ---- |
| 44 | include::example$basic/src/main.rs[lines="12..20"] | 35 | include::example$basic/src/main.rs[lines="10..18"] |
| 45 | ---- | 36 | ---- |
| 46 | 37 | ||
| 47 | An 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. | 38 | An 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. |
| @@ -56,7 +47,7 @@ We then initialize the HAL with a default config, which gives us a `Peripherals` | |||
| 56 | 47 | ||
| 57 | [source,rust] | 48 | [source,rust] |
| 58 | ---- | 49 | ---- |
| 59 | include::example$basic/src/main.rs[lines="22..-1"] | 50 | include::example$basic/src/main.rs[lines="20..-1"] |
| 60 | ---- | 51 | ---- |
| 61 | 52 | ||
| 62 | What 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_executor::main]` macro. The macro does the following: | 53 | What 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_executor::main]` macro. The macro does the following: |
diff --git a/docs/modules/ROOT/pages/getting_started.adoc b/docs/modules/ROOT/pages/getting_started.adoc index 24bde1c1f..73cb5530d 100644 --- a/docs/modules/ROOT/pages/getting_started.adoc +++ b/docs/modules/ROOT/pages/getting_started.adoc | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | So you want to try Embassy, great! To get started, there are a few tools you need to install: | 3 | So you want to try Embassy, great! To get started, there are a few tools you need to install: |
| 4 | 4 | ||
| 5 | * link:https://rustup.rs/[rustup] - the Rust toolchain is needed to compile Rust code. | 5 | * link:https://rustup.rs/[rustup] - the Rust toolchain is needed to compile Rust code. |
| 6 | * link:https://crates.io/crates/probe-rs[probe-rs] - to flash the firmware on your device. If you already have other tools like `OpenOCD` setup, you can use that as well. | 6 | * link:https://probe.rs/[probe-rs] - to flash the firmware on your device. If you already have other tools like `OpenOCD` setup, you can use that as well. |
| 7 | 7 | ||
| 8 | If you don't have any supported board, don't worry: you can also run embassy on your PC using the `std` examples. | 8 | If you don't have any supported board, don't worry: you can also run embassy on your PC using the `std` examples. |
| 9 | 9 | ||
| @@ -82,19 +82,19 @@ If everything worked correctly, you should see a blinking LED on your board, and | |||
| 82 | └─ blinky::__embassy_main::task::{generator#0} @ src/bin/blinky.rs:27 | 82 | └─ blinky::__embassy_main::task::{generator#0} @ src/bin/blinky.rs:27 |
| 83 | ---- | 83 | ---- |
| 84 | 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. | 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 | 86 | ||
| 87 | === It didn’t work! | 87 | === It didn’t work! |
| 88 | 88 | ||
| 89 | If you hare having issues when running `cargo run --release`, please check the following: | 89 | If you hare having issues when running `+cargo run --release+`, please check the following: |
| 90 | 90 | ||
| 91 | * You are specifying the correct `--chip` on the command line, OR | 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 | 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) | 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 | 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. | 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 | 96 | ||
| 97 | If you are trying to run an example with `cargo run --release` and you see the following output: | 97 | If you are trying to run an example with `+cargo run --release+` and you see the following output: |
| 98 | [source] | 98 | [source] |
| 99 | ---- | 99 | ---- |
| 100 | 0.000000 INFO Hello World! | 100 | 0.000000 INFO Hello World! |
| @@ -115,6 +115,22 @@ To get rid of the frame-index error add the following to your `Cargo.toml`: | |||
| 115 | debug = 2 | 115 | debug = 2 |
| 116 | ---- | 116 | ---- |
| 117 | 117 | ||
| 118 | If you’re getting an extremely long error message containing something like the following: | ||
| 119 | |||
| 120 | [source] | ||
| 121 | ---- | ||
| 122 | error[E0463]: can't find crate for `std` | ||
| 123 | | | ||
| 124 | = note: the `thumbv6m-none-eabi` target may not support the standard library | ||
| 125 | = note: `std` is required by `stable_deref_trait` because it does not declare `#![no_std]` | ||
| 126 | ---- | ||
| 127 | |||
| 128 | Make sure that you didn’t accidentally run `+cargo add probe-rs+` (which adds it as a dependency) instead of link:https://probe.rs/docs/getting-started/installation/[correctly installing probe-rs]. | ||
| 129 | |||
| 130 | If you’re using a raspberry pi pico-w, make sure you’re running `+cargo run --bin wifi_blinky --release+` rather than the regular blinky. The pico-w’s on-board LED is connected to the WiFi chip, which needs to be initialized before the LED can be blinked. | ||
| 131 | |||
| 132 | If you’re using an rp2040 debug probe (e.g. the pico probe) and are having issues after running `probe-rs info`, unplug and reconnect the probe, letting it power cycle. Running `probe-rs info` is link:https://github.com/probe-rs/probe-rs/issues/1849[known to put the pico probe into an unusable state]. | ||
| 133 | |||
| 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]. | 134 | 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 | 135 | ||
| 120 | == What's next? | 136 | == What's next? |
| @@ -124,3 +140,4 @@ Congratulations, you have your first Embassy application running! Here are some | |||
| 124 | * Read more about the xref:runtime.adoc[executor]. | 140 | * Read more about the xref:runtime.adoc[executor]. |
| 125 | * Read more about the xref:hal.adoc[HAL]. | 141 | * Read more about the xref:hal.adoc[HAL]. |
| 126 | * Start xref:basic_application.adoc[writing your application]. | 142 | * Start xref:basic_application.adoc[writing your application]. |
| 143 | * Learn how to xref:new_project.adoc[start a new embassy project by adapting an example]. | ||
