aboutsummaryrefslogtreecommitdiff
path: root/docs/modules/ROOT
diff options
context:
space:
mode:
authorKarun Koppula <[email protected]>2024-03-07 15:20:29 -0500
committerGitHub <[email protected]>2024-03-07 15:20:29 -0500
commit54751b7a5093b7960e42cee1bc9a850f9c4b7a8f (patch)
treedf08df503f2b441c5b62306d50532403fe4c19c9 /docs/modules/ROOT
parent3b1d87050e2a30b598e92979b6f202b67664a29c (diff)
parentb2d236ee390081ec6aeef1a27da06098f9febbf9 (diff)
Merge branch 'main' into karun/main_octospi_implementation
Diffstat (limited to 'docs/modules/ROOT')
-rw-r--r--docs/modules/ROOT/examples/basic/src/main.rs3
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs4
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs13
-rw-r--r--docs/modules/ROOT/pages/basic_application.adoc15
-rw-r--r--docs/modules/ROOT/pages/best_practices.adoc6
-rw-r--r--docs/modules/ROOT/pages/embassy_in_the_wild.adoc2
-rw-r--r--docs/modules/ROOT/pages/faq.adoc40
-rw-r--r--docs/modules/ROOT/pages/getting_started.adoc31
-rw-r--r--docs/modules/ROOT/pages/new_project.adoc25
-rw-r--r--docs/modules/ROOT/pages/project_structure.adoc9
10 files changed, 101 insertions, 47 deletions
diff --git a/docs/modules/ROOT/examples/basic/src/main.rs b/docs/modules/ROOT/examples/basic/src/main.rs
index 2a4ee5968..4412712c8 100644
--- a/docs/modules/ROOT/examples/basic/src/main.rs
+++ b/docs/modules/ROOT/examples/basic/src/main.rs
@@ -4,12 +4,11 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_nrf::gpio::{Level, Output, OutputDrive}; 6use embassy_nrf::gpio::{Level, Output, OutputDrive};
7use embassy_nrf::peripherals::P0_13;
8use embassy_time::{Duration, Timer}; 7use embassy_time::{Duration, Timer};
9use {defmt_rtt as _, panic_probe as _}; // global logger 8use {defmt_rtt as _, panic_probe as _}; // global logger
10 9
11#[embassy_executor::task] 10#[embassy_executor::task]
12async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) { 11async fn blinker(mut led: Output<'static>, interval: Duration) {
13 loop { 12 loop {
14 led.set_high(); 13 led.set_high();
15 Timer::after(interval).await; 14 Timer::after(interval).await;
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs
index e6753be28..004602816 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs
@@ -3,14 +3,14 @@
3 3
4use embassy_executor::Spawner; 4use embassy_executor::Spawner;
5use embassy_stm32::exti::ExtiInput; 5use embassy_stm32::exti::ExtiInput;
6use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; 6use embassy_stm32::gpio::{Level, Output, Pull, Speed};
7use {defmt_rtt as _, panic_probe as _}; 7use {defmt_rtt as _, panic_probe as _};
8 8
9#[embassy_executor::main] 9#[embassy_executor::main]
10async fn main(_spawner: Spawner) { 10async fn main(_spawner: Spawner) {
11 let p = embassy_stm32::init(Default::default()); 11 let p = embassy_stm32::init(Default::default());
12 let mut led = Output::new(p.PB14, Level::Low, Speed::VeryHigh); 12 let mut led = Output::new(p.PB14, Level::Low, Speed::VeryHigh);
13 let mut button = ExtiInput::new(Input::new(p.PC13, Pull::Up), p.EXTI13); 13 let mut button = ExtiInput::new(p.PC13, p.EXTI13, Pull::Up);
14 14
15 loop { 15 loop {
16 button.wait_for_any_edge().await; 16 button.wait_for_any_edge().await;
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 aecba0755..743c9d99b 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
@@ -6,13 +6,12 @@ use core::cell::RefCell;
6use cortex_m::interrupt::Mutex; 6use cortex_m::interrupt::Mutex;
7use cortex_m::peripheral::NVIC; 7use cortex_m::peripheral::NVIC;
8use cortex_m_rt::entry; 8use cortex_m_rt::entry;
9use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed}; 9use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
10use embassy_stm32::peripherals::{PB14, PC13};
11use embassy_stm32::{interrupt, pac}; 10use embassy_stm32::{interrupt, pac};
12use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
13 12
14static BUTTON: Mutex<RefCell<Option<Input<'static, PC13>>>> = Mutex::new(RefCell::new(None)); 13static BUTTON: Mutex<RefCell<Option<Input<'static>>>> = Mutex::new(RefCell::new(None));
15static LED: Mutex<RefCell<Option<Output<'static, PB14>>>> = Mutex::new(RefCell::new(None)); 14static LED: Mutex<RefCell<Option<Output<'static>>>> = Mutex::new(RefCell::new(None));
16 15
17#[entry] 16#[entry]
18fn main() -> ! { 17fn main() -> ! {
@@ -62,14 +61,14 @@ fn EXTI15_10() {
62 61
63const PORT: u8 = 2; 62const PORT: u8 = 2;
64const PIN: usize = 13; 63const PIN: usize = 13;
65fn check_interrupt<P: Pin>(_pin: &mut Input<'static, P>) -> bool { 64fn check_interrupt(_pin: &mut Input<'static>) -> bool {
66 let exti = pac::EXTI; 65 let exti = pac::EXTI;
67 let pin = PIN; 66 let pin = PIN;
68 let lines = exti.pr(0).read(); 67 let lines = exti.pr(0).read();
69 lines.line(pin) 68 lines.line(pin)
70} 69}
71 70
72fn clear_interrupt<P: Pin>(_pin: &mut Input<'static, P>) { 71fn clear_interrupt(_pin: &mut Input<'static>) {
73 let exti = pac::EXTI; 72 let exti = pac::EXTI;
74 let pin = PIN; 73 let pin = PIN;
75 let mut lines = exti.pr(0).read(); 74 let mut lines = exti.pr(0).read();
@@ -77,7 +76,7 @@ fn clear_interrupt<P: Pin>(_pin: &mut Input<'static, P>) {
77 exti.pr(0).write_value(lines); 76 exti.pr(0).write_value(lines);
78} 77}
79 78
80fn enable_interrupt<P: Pin>(_pin: &mut Input<'static, P>) { 79fn enable_interrupt(_pin: &mut Input<'static>) {
81 cortex_m::interrupt::free(|_| { 80 cortex_m::interrupt::free(|_| {
82 let rcc = pac::RCC; 81 let rcc = pac::RCC;
83 rcc.apb2enr().modify(|w| w.set_syscfgen(true)); 82 rcc.apb2enr().modify(|w| w.set_syscfgen(true));
diff --git a/docs/modules/ROOT/pages/basic_application.adoc b/docs/modules/ROOT/pages/basic_application.adoc
index 95792d5a0..d5aad806d 100644
--- a/docs/modules/ROOT/pages/basic_application.adoc
+++ b/docs/modules/ROOT/pages/basic_application.adoc
@@ -17,22 +17,13 @@ The first thing you’ll notice are two attributes at the top of the file. These
17include::example$basic/src/main.rs[lines="1..2"] 17include::example$basic/src/main.rs[lines="1..2"]
18---- 18----
19 19
20=== Rust Nightly
21
22The next declaration is a Rust Unstable feature, which means that Embassy requires Rust Nightly:
23
24[source,rust]
25----
26include::example$basic/src/main.rs[lines="3"]
27----
28
29=== Dealing with errors 20=== Dealing with errors
30 21
31Then, 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: 22Then, 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:
32 23
33[source,rust] 24[source,rust]
34---- 25----
35include::example$basic/src/main.rs[lines="10"] 26include::example$basic/src/main.rs[lines="8"]
36---- 27----
37 28
38=== Task declaration 29=== Task declaration
@@ -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----
44include::example$basic/src/main.rs[lines="12..20"] 35include::example$basic/src/main.rs[lines="10..18"]
45---- 36----
46 37
47An 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. 38An 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----
59include::example$basic/src/main.rs[lines="22..-1"] 50include::example$basic/src/main.rs[lines="20..-1"]
60---- 51----
61 52
62What 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: 53What 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/best_practices.adoc b/docs/modules/ROOT/pages/best_practices.adoc
index 1e02f9ba9..bfcedec06 100644
--- a/docs/modules/ROOT/pages/best_practices.adoc
+++ b/docs/modules/ROOT/pages/best_practices.adoc
@@ -3,8 +3,10 @@
3Over time, a couple of best practices have emerged. The following list should serve as a guideline for developers writing embedded software in _Rust_, especially in the context of the _Embassy_ framework. 3Over time, a couple of best practices have emerged. The following list should serve as a guideline for developers writing embedded software in _Rust_, especially in the context of the _Embassy_ framework.
4 4
5== Passing Buffers by Reference 5== Passing Buffers by Reference
6It may be tempting to pass arrays or wrappers, like link:https://docs.rs/heapless/latest/heapless/[`heapless::Vec`], to a function or return one just like you would with a `std::Vec`. However, in most embedded applications you don't want to spend ressources on an allocator and end up placing buffers on the stack. 6It may be tempting to pass arrays or wrappers, like link:https://docs.rs/heapless/latest/heapless/[`heapless::Vec`],
7This, however, can easily blow up your stack if you are not careful. 7to a function or return one just like you would with a `std::Vec`. However, in most embedded applications you don't
8want to spend resources on an allocator and end up placing buffers on the stack. This, however, can easily blow up
9your stack if you are not careful.
8 10
9Consider the following example: 11Consider the following example:
10[,rust] 12[,rust]
diff --git a/docs/modules/ROOT/pages/embassy_in_the_wild.adoc b/docs/modules/ROOT/pages/embassy_in_the_wild.adoc
index a1c31bfc7..85ad7f4a2 100644
--- a/docs/modules/ROOT/pages/embassy_in_the_wild.adoc
+++ b/docs/modules/ROOT/pages/embassy_in_the_wild.adoc
@@ -7,3 +7,5 @@ Here are known examples of real-world projects which make use of Embassy. Feel f
7* link:https://github.com/card-io-ecg/card-io-fw[Card/IO firmware] - firmware for an open source ECG device 7* link:https://github.com/card-io-ecg/card-io-fw[Card/IO firmware] - firmware for an open source ECG device
8** Targets the ESP32-S3 or ESP32-C6 MCU 8** Targets the ESP32-S3 or ESP32-C6 MCU
9* The link:https://github.com/lora-rs/lora-rs[lora-rs] project includes link:https://github.com/lora-rs/lora-rs/tree/main/examples/stm32l0/src/bin[various standalone examples] for NRF52840, RP2040, STM32L0 and STM32WL 9* The link:https://github.com/lora-rs/lora-rs[lora-rs] project includes link:https://github.com/lora-rs/lora-rs/tree/main/examples/stm32l0/src/bin[various standalone examples] for NRF52840, RP2040, STM32L0 and STM32WL
10** link:https://github.com/matoushybl/air-force-one[Air force one: A simple air quality monitoring system]
11*** Targets nRF52 and uses nrf-softdevice
diff --git a/docs/modules/ROOT/pages/faq.adoc b/docs/modules/ROOT/pages/faq.adoc
index 147f119b0..6b5e6d009 100644
--- a/docs/modules/ROOT/pages/faq.adoc
+++ b/docs/modules/ROOT/pages/faq.adoc
@@ -29,11 +29,10 @@ If you see an error like this:
29 29
30You are likely missing some features of the `embassy-executor` crate. 30You are likely missing some features of the `embassy-executor` crate.
31 31
32For Cortex-M targets, consider making sure that ALL of the following features are active in your `Cargo.toml` for the `embassy-executor` crate: 32For Cortex-M targets, check whether ALL of the following features are enabled in your `Cargo.toml` for the `embassy-executor` crate:
33 33
34* `arch-cortex-m` 34* `arch-cortex-m`
35* `executor-thread` 35* `executor-thread`
36* `nightly`
37 36
38For ESP32, consider using the executors and `#[main]` macro provided by your appropriate link:https://crates.io/crates/esp-hal-common[HAL crate]. 37For ESP32, consider using the executors and `#[main]` macro provided by your appropriate link:https://crates.io/crates/esp-hal-common[HAL crate].
39 38
@@ -44,11 +43,12 @@ The first step to managing your binary size is to set up your link:https://doc.r
44[source,toml] 43[source,toml]
45---- 44----
46[profile.release] 45[profile.release]
47debug = false
48lto = true 46lto = true
49opt-level = "s" 47opt-level = "s"
50incremental = false 48incremental = false
51codegen-units = 1 49codegen-units = 1
50# note: debug = true is okay - debuginfo isn't flashed to the device!
51debug = true
52---- 52----
53 53
54All of these flags are elaborated on in the Rust Book page linked above. 54All of these flags are elaborated on in the Rust Book page linked above.
@@ -118,21 +118,31 @@ features = [
118] 118]
119---- 119----
120 120
121If you are in the early project setup phase and not using anything from the HAL, make sure the HAL is explicitly used to prevent the linker removing it as dead code by adding this line to your source:
122
123[source,rust]
124----
125use embassy_stm32 as _;
126----
127
121== Error: `Only one package in the dependency graph may specify the same links value.` 128== Error: `Only one package in the dependency graph may specify the same links value.`
122 129
123You have multiple versions of the same crate in your dependency tree. This means that some of your 130You have multiple versions of the same crate in your dependency tree. This means that some of your
124embassy crates are coming from crates.io, and some from git, each of them pulling in a different set 131embassy crates are coming from crates.io, and some from git, each of them pulling in a different set
125of dependencies. 132of dependencies.
126 133
127To resolve this issue, make sure to only use a single source for all your embassy crates! To do this, 134To resolve this issue, make sure to only use a single source for all your embassy crates!
128you should patch your dependencies to use git sources using `[patch.crates.io]` and maybe `[patch.'https://github.com/embassy-rs/embassy.git']`. 135To do this, you should patch your dependencies to use git sources using `[patch.crates.io]`
136and maybe `[patch.'https://github.com/embassy-rs/embassy.git']`.
129 137
130Example: 138Example:
131 139
132[source,toml] 140[source,toml]
133---- 141----
134[patch.crates-io] 142[patch.crates-io]
135embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" } 143embassy-time-queue-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" }
144embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" }
145# embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" }
136---- 146----
137 147
138Note that the git revision should match any other embassy patches or git dependencies that you are using! 148Note that the git revision should match any other embassy patches or git dependencies that you are using!
@@ -180,3 +190,21 @@ Check out link:https://docs.embassy.dev/embassy-executor/git/cortex-m/index.html
180== Can I use manual ISRs alongside Embassy? 190== Can I use manual ISRs alongside Embassy?
181 191
182Yes! This can be useful if you need to respond to an event as fast as possible, and the latency caused by the usual “ISR, wake, return from ISR, context switch to woken task” flow is too much for your application. Simply define a `#[interrupt] fn INTERRUPT_NAME() {}` handler as you would link:https://docs.rust-embedded.org/book/start/interrupts.html[in any other embedded rust project]. 192Yes! This can be useful if you need to respond to an event as fast as possible, and the latency caused by the usual “ISR, wake, return from ISR, context switch to woken task” flow is too much for your application. Simply define a `#[interrupt] fn INTERRUPT_NAME() {}` handler as you would link:https://docs.rust-embedded.org/book/start/interrupts.html[in any other embedded rust project].
193
194== How can I measure resource usage (CPU, RAM, etc.)?
195
196=== For CPU Usage:
197
198There are a couple techniques that have been documented, generally you want to measure how long you are spending in the idle or low priority loop.
199
200We need to document specifically how to do this in embassy, but link:https://blog.japaric.io/cpu-monitor/[this older post] describes the general process.
201
202If you end up doing this, please update this section with more specific examples!
203
204=== For Static Memory Usage
205
206Tools like `cargo size` and `cargo nm` can tell you the size of any globals or other static usage. Specifically you will want to see the size of the `.data` and `.bss` sections, which together make up the total global/static memory usage.
207
208=== For Max Stack Usage
209
210Check out link:https://github.com/Dirbaio/cargo-call-stack/[`cargo-call-stack`] for statically calculating worst-case stack usage. There are some caveats and inaccuracies possible with this, but this is a good way to get the general idea. See link:https://github.com/dirbaio/cargo-call-stack#known-limitations[the README] for more details.
diff --git a/docs/modules/ROOT/pages/getting_started.adoc b/docs/modules/ROOT/pages/getting_started.adoc
index ab819ac2a..73cb5530d 100644
--- a/docs/modules/ROOT/pages/getting_started.adoc
+++ b/docs/modules/ROOT/pages/getting_started.adoc
@@ -3,7 +3,7 @@
3So you want to try Embassy, great! To get started, there are a few tools you need to install: 3So 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
8If you don't have any supported board, don't worry: you can also run embassy on your PC using the `std` examples. 8If 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
85NOTE: 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. 85NOTE: 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
89If you hare having issues when running `cargo run --release`, please check the following: 89If 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
95At 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. 95At 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
97If you are trying to run an example with `cargo run --release` and you see the following output: 97If you are trying to run an example with `+cargo run --release+` and you see the following output:
98[source] 98[source]
99---- 99----
1000.000000 INFO Hello World! 1000.000000 INFO Hello World!
@@ -115,6 +115,22 @@ To get rid of the frame-index error add the following to your `Cargo.toml`:
115debug = 2 115debug = 2
116---- 116----
117 117
118If you’re getting an extremely long error message containing something like the following:
119
120[source]
121----
122error[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
128Make 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
130If 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
132If 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
118If 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]. 134If 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].
diff --git a/docs/modules/ROOT/pages/new_project.adoc b/docs/modules/ROOT/pages/new_project.adoc
index ce139ed8d..320966bb6 100644
--- a/docs/modules/ROOT/pages/new_project.adoc
+++ b/docs/modules/ROOT/pages/new_project.adoc
@@ -1,6 +1,17 @@
1= Starting a new Embassy project 1= Starting a new Embassy project
2 2
3Once you’ve successfully xref:getting_started.adoc[run some example projects], the next step is to make a standalone Embassy project. The easiest way to do this is to adapt an example for a similar chip to the one you’re targeting. 3Once you’ve successfully xref:getting_started.adoc[run some example projects], the next step is to make a standalone Embassy project.
4
5There are some tools for generating Embassy projects: (WIP)
6
7==== CLI
8- link:https://github.com/adinack/cargo-embassy[cargo-embassy] (STM32 and NRF)
9
10==== cargo-generate
11- link:https://github.com/lulf/embassy-template[embassy-template] (STM32, NRF, and RP)
12- link:https://github.com/bentwire/embassy-rp2040-template[embassy-rp2040-template] (RP)
13
14But if you want to start from scratch:
4 15
5As an example, let’s create a new embassy project from scratch for a STM32G474. The same instructions are applicable for any supported chip with some minor changes. 16As an example, let’s create a new embassy project from scratch for a STM32G474. The same instructions are applicable for any supported chip with some minor changes.
6 17
@@ -166,13 +177,13 @@ should result in a blinking LED (if there’s one attached to the pin in `src/ma
166 Erasing sectors ✔ [00:00:00] [#########################################################] 18.00 KiB/18.00 KiB @ 54.09 KiB/s (eta 0s ) 177 Erasing sectors ✔ [00:00:00] [#########################################################] 18.00 KiB/18.00 KiB @ 54.09 KiB/s (eta 0s )
167 Programming pages ✔ [00:00:00] [#########################################################] 17.00 KiB/17.00 KiB @ 35.91 KiB/s (eta 0s ) Finished in 0.817s 178 Programming pages ✔ [00:00:00] [#########################################################] 17.00 KiB/17.00 KiB @ 35.91 KiB/s (eta 0s ) Finished in 0.817s
1680.000000 TRACE BDCR configured: 00008200 1790.000000 TRACE BDCR configured: 00008200
169└─ embassy_stm32::rcc::bd::{impl#3}::init::{closure#4} @ /home/you/.cargo/git/checkouts/embassy-9312dcb0ed774b29/7703f47/embassy-stm32/src/fmt.rs:117 180└─ embassy_stm32::rcc::bd::{impl#3}::init::{closure#4} @ /home/you/.cargo/git/checkouts/embassy-9312dcb0ed774b29/7703f47/embassy-stm32/src/fmt.rs:117
1700.000000 DEBUG rcc: Clocks { sys: Hertz(16000000), pclk1: Hertz(16000000), pclk1_tim: Hertz(16000000), pclk2: Hertz(16000000), pclk2_tim: Hertz(16000000), hclk1: Hertz(16000000), hclk2: Hertz(16000000), pll1_p: None, adc: None, adc34: None, rtc: Some(Hertz(32000)) } 1810.000000 DEBUG rcc: Clocks { sys: Hertz(16000000), pclk1: Hertz(16000000), pclk1_tim: Hertz(16000000), pclk2: Hertz(16000000), pclk2_tim: Hertz(16000000), hclk1: Hertz(16000000), hclk2: Hertz(16000000), pll1_p: None, adc: None, adc34: None, rtc: Some(Hertz(32000)) }
171└─ embassy_stm32::rcc::set_freqs @ /home/you/.cargo/git/checkouts/embassy-9312dcb0ed774b29/7703f47/embassy-stm32/src/fmt.rs:130 182└─ embassy_stm32::rcc::set_freqs @ /home/you/.cargo/git/checkouts/embassy-9312dcb0ed774b29/7703f47/embassy-stm32/src/fmt.rs:130
1720.000000 INFO Hello World! 1830.000000 INFO Hello World!
173└─ embassy_stm32g474::____embassy_main_task::{async_fn#0} @ src/main.rs:14 184└─ embassy_stm32g474::____embassy_main_task::{async_fn#0} @ src/main.rs:14
1740.000091 INFO high 1850.000091 INFO high
175└─ embassy_stm32g474::____embassy_main_task::{async_fn#0} @ src/main.rs:19 186└─ embassy_stm32g474::____embassy_main_task::{async_fn#0} @ src/main.rs:19
1760.300201 INFO low 1870.300201 INFO low
177└─ embassy_stm32g474::____embassy_main_task::{async_fn#0} @ src/main.rs:23 188└─ embassy_stm32g474::____embassy_main_task::{async_fn#0} @ src/main.rs:23
178---- \ No newline at end of file 189----
diff --git a/docs/modules/ROOT/pages/project_structure.adoc b/docs/modules/ROOT/pages/project_structure.adoc
index 61ffd05a6..2adfcc1df 100644
--- a/docs/modules/ROOT/pages/project_structure.adoc
+++ b/docs/modules/ROOT/pages/project_structure.adoc
@@ -38,13 +38,18 @@ DEFMT_LOG = "trace" # <- can change to info, warn, or error
38 38
39== build.rs 39== build.rs
40 40
41This is the build script for your project. It links defmt (what is defmt?) and the `memory.x` file if needed. This file is pretty specific for each chipset, just copy and paste from the corresponding link:https://github.com/embassy-rs/embassy/tree/main/examples[example]. 41This is the build script for your project. It links defmt (what is link:https://defmt.ferrous-systems.com[defmt]?) and the `memory.x` file if needed. This file is pretty specific for each chipset, just copy and paste from the corresponding link:https://github.com/embassy-rs/embassy/tree/main/examples[example].
42 42
43== Cargo.toml 43== Cargo.toml
44 44
45This is your manifest file, where you can configure all of the embassy components to use the features you need. 45This is your manifest file, where you can configure all of the embassy components to use the features you need.
46 46
47TODO: someone should exhaustively describe every feature for every component! 47==== Features
48===== Time
49- tick-hz-x: Configures the tick rate of `embassy-time`. Higher tick rate means higher precision, and higher CPU wakes.
50- defmt-timestamp-uptime: defmt log entries will display the uptime in seconds.
51
52...more to come
48 53
49== memory.x 54== memory.x
50 55