diff options
| author | Ulf Lilleengen <[email protected]> | 2024-02-09 08:46:03 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-02-09 08:46:03 +0000 |
| commit | 460cf79513d7fbcd7910ea96dbcaf320d97f593e (patch) | |
| tree | 6aab6bd8d55ae8d4ad1f7267cf75bef851f3a8a0 | |
| parent | b326ee19bbd65e553e6891c08f623e5acdd95375 (diff) | |
| parent | cbdc49ef8d92606f917d1df0d88e4baef7bb23df (diff) | |
Merge pull request #2548 from plaes/faq-fixes
Faq fixes due to embassy-time crate split
| -rw-r--r-- | docs/modules/ROOT/pages/best_practices.adoc | 6 | ||||
| -rw-r--r-- | docs/modules/ROOT/pages/faq.adoc | 12 |
2 files changed, 11 insertions, 7 deletions
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 @@ | |||
| 3 | Over 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. | 3 | Over 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 |
| 6 | It 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. | 6 | It may be tempting to pass arrays or wrappers, like link:https://docs.rs/heapless/latest/heapless/[`heapless::Vec`], |
| 7 | This, however, can easily blow up your stack if you are not careful. | 7 | to a function or return one just like you would with a `std::Vec`. However, in most embedded applications you don't |
| 8 | want to spend resources on an allocator and end up placing buffers on the stack. This, however, can easily blow up | ||
| 9 | your stack if you are not careful. | ||
| 8 | 10 | ||
| 9 | Consider the following example: | 11 | Consider the following example: |
| 10 | [,rust] | 12 | [,rust] |
diff --git a/docs/modules/ROOT/pages/faq.adoc b/docs/modules/ROOT/pages/faq.adoc index 05ff7c598..7fb81e2ca 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 | ||
| 30 | You are likely missing some features of the `embassy-executor` crate. | 30 | You are likely missing some features of the `embassy-executor` crate. |
| 31 | 31 | ||
| 32 | For Cortex-M targets, consider making sure that ALL of the following features are active in your `Cargo.toml` for the `embassy-executor` crate: | 32 | For 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 | ||
| 38 | For ESP32, consider using the executors and `#[main]` macro provided by your appropriate link:https://crates.io/crates/esp-hal-common[HAL crate]. | 37 | For ESP32, consider using the executors and `#[main]` macro provided by your appropriate link:https://crates.io/crates/esp-hal-common[HAL crate]. |
| 39 | 38 | ||
| @@ -125,15 +124,18 @@ You have multiple versions of the same crate in your dependency tree. This means | |||
| 125 | embassy crates are coming from crates.io, and some from git, each of them pulling in a different set | 124 | embassy crates are coming from crates.io, and some from git, each of them pulling in a different set |
| 126 | of dependencies. | 125 | of dependencies. |
| 127 | 126 | ||
| 128 | To resolve this issue, make sure to only use a single source for all your embassy crates! To do this, | 127 | To resolve this issue, make sure to only use a single source for all your embassy crates! |
| 129 | you should patch your dependencies to use git sources using `[patch.crates.io]` and maybe `[patch.'https://github.com/embassy-rs/embassy.git']`. | 128 | To do this, you should patch your dependencies to use git sources using `[patch.crates.io]` |
| 129 | and maybe `[patch.'https://github.com/embassy-rs/embassy.git']`. | ||
| 130 | 130 | ||
| 131 | Example: | 131 | Example: |
| 132 | 132 | ||
| 133 | [source,toml] | 133 | [source,toml] |
| 134 | ---- | 134 | ---- |
| 135 | [patch.crates-io] | 135 | [patch.crates-io] |
| 136 | embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" } | 136 | embassy-time-queue-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" } |
| 137 | embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" } | ||
| 138 | # embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" } | ||
| 137 | ---- | 139 | ---- |
| 138 | 140 | ||
| 139 | Note that the git revision should match any other embassy patches or git dependencies that you are using! | 141 | Note that the git revision should match any other embassy patches or git dependencies that you are using! |
