Skip to content
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

Fix #19 - add step for memory.x #21

Merged
merged 2 commits into from
Nov 10, 2020
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
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ In `.cargo/config.toml`, pick the right compilation target for your board.
+target = "thumbv7em-none-eabihf" # Cortex-M4F (with FPU)
```

### 4. Add a HAL as a dependency
#### 4. Add a HAL as a dependency

In `Cargo.toml`, list the Hardware Abstraction Layer (HAL) for your board as a dependency.

Expand All @@ -95,15 +95,26 @@ For the nRF52840 you'll want to use the [`nrf52840-hal`].

#### 5. Import your HAL

Now that you have selected a HAL fix the HAL import in `src/lib.rs`
Now that you have selected a HAL, fix the HAL import in `src/lib.rs`

``` diff
// my-app/src/lib.rs
-// use some_hal as _; // memory layout
+use nrf52840_hal as _; // memory layout
```

#### 6. run!
#### (6. Get a linker script)

Some HAL crates require that you manually copy over a file called `memory.x` from the HAL to the root of your project. For nrf52840-hal, this is done automatically so no action is needed. For other HAL crates, you can get it from your local Cargo folder, the default location is under:

```
~/.cargo/registry/src/
```

Not all HALs provide a memory.x file, you may need to write it yourself. Check the documentation for the HAL you are using.


#### 7. Run!

You are now all set to `cargo-run` your first `defmt`-powered application!
There are some examples in the `src/bin` directory.
Expand Down