aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2024-04-04 05:05:25 +0000
committerGitHub <[email protected]>2024-04-04 05:05:25 +0000
commit027a1e6f32b11eb691d5e9ee3a3627b3be99e819 (patch)
treedb8fb40d94a90ff9133c1ec9dc15cf54ba0cfa02
parentf873e5944e4fe2915a30062eb54eba7ea3cfc2ed (diff)
parent446965a903112a9a09f67213abe46b9836d2bb2f (diff)
Merge pull request #2765 from davidzwa/patch-1
Update faq.adoc with memory.x definition helping hand
-rw-r--r--docs/modules/ROOT/pages/faq.adoc23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/modules/ROOT/pages/faq.adoc b/docs/modules/ROOT/pages/faq.adoc
index 6b5e6d009..c6b893de5 100644
--- a/docs/modules/ROOT/pages/faq.adoc
+++ b/docs/modules/ROOT/pages/faq.adoc
@@ -208,3 +208,26 @@ Tools like `cargo size` and `cargo nm` can tell you the size of any globals or o
208=== For Max Stack Usage 208=== For Max Stack Usage
209 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. 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.
211
212== The memory definition for my STM chip seems wrong, how do I define a `memory.x` file?
213
214It could happen that your project compiles, flashes but fails to run. The following situation can be true for your setup:
215
216The `memory.x` is generated automatically when enabling the `memory-x` feature on the `embassy-stm32` crate in the `Cargo.toml` file.
217This, in turn, uses `stm32-metapac` to generate the `memory.x` file for you. Unfortunately, more often than not this memory definition is not correct.
218
219You can override this by adding your own `memory.x` file. Such a file could look like this:
220```
221MEMORY
222{
223 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
224 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
225}
226
227_stack_start = ORIGIN(RAM) + LENGTH(RAM);
228```
229
230Please refer to the STM32 documentation for the specific values suitable for your board and setup. The STM32 Cube examples often contain a linker script `.ld` file.
231Look for the `MEMORY` section and try to determine the FLASH and RAM sizes and section start.
232
233If you find a case where the memory.x is wrong, please report it on [this Github issue](https://github.com/embassy-rs/stm32-data/issues/301) so other users are not caught by surprise.