Skip to content

Commit b7c71eb

Browse files
authored
Merge pull request #5 from rust-embedded/debugging-wrong-linker-config
Added a section about incorrect linker config
2 parents c812200 + 424ca44 commit b7c71eb

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

faq.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,33 @@ If you are measuring size using the right method and your program is still too
267267
big then check out our section on optimizations.
268268

269269
> **TODO**(resources team) add link to the optimizations section
270+
271+
# I'm trying to follow the book but my program won't flash
272+
273+
It is quite common that by oversight the linker configuration is not suitable
274+
for the target device. Indications for such a problem are loading errors in `gdb`:
275+
276+
```
277+
(gdb) load
278+
Loading section .vector_table, size 0x400 lma 0x0
279+
Loading section .text, size 0x2064 lma 0x400
280+
Load failed
281+
```
282+
283+
Please note the `lma` which is the loading address and needs to match up with the
284+
start address of the flash.
285+
286+
Similarly `openocd` will indicate such a problem:
287+
288+
```
289+
...
290+
auto erase enabled
291+
Info : device id = 0x10036422
292+
Info : flash size = 256kbytes
293+
Warn : no flash bank found for address 0
294+
wrote 0 bytes from file target/thumbv7em-none-eabihf/debug/examples/hello in 0.001434s (0.000 KiB/s)
295+
```
296+
297+
If you see such a message you will need to check your linker configuration, usually in
298+
`memory.x` for the correct addresses (and ideally also sizes). Please also note that
299+
after a change you will need to `cargo clean` and rebuild to use the changed addresses.

0 commit comments

Comments
 (0)