Skip to content

Added a section about incorrect linker config #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,33 @@ If you are measuring size using the right method and your program is still too
big then check out our section on optimizations.

> **TODO**(resources team) add link to the optimizations section

# I'm trying to follow the book but my program won't flash

It is quite common that by oversight the linker configuration is not suitable
for the target device. Indications for such a problem are loading errors in `gdb`:

```
(gdb) load
Loading section .vector_table, size 0x400 lma 0x0
Loading section .text, size 0x2064 lma 0x400
Load failed
```

Please note the `lma` which is the loading address and needs to match up with the
start address of the flash.

Similarly `openocd` will indicate such a problem:

```
...
auto erase enabled
Info : device id = 0x10036422
Info : flash size = 256kbytes
Warn : no flash bank found for address 0
wrote 0 bytes from file target/thumbv7em-none-eabihf/debug/examples/hello in 0.001434s (0.000 KiB/s)
```

If you see such a message you will need to check your linker configuration, usually in
`memory.x` for the correct addresses (and ideally also sizes). Please also note that
after a change you will need to `cargo clean` and rebuild to use the changed addresses.