Skip to content

Commit 31f0520

Browse files
committed
Fix #19 - add step for memory.x
1 parent b131e11 commit 31f0520

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ In `.cargo/config.toml`, pick the right compilation target for your board.
7878
+target = "thumbv7em-none-eabihf" # Cortex-M4F (with FPU)
7979
```
8080

81-
### 4. Add a HAL as a dependency
81+
#### 4. Add a HAL as a dependency
8282

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

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

9696
#### 5. Import your HAL
9797

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

100100
``` diff
101101
// my-app/src/lib.rs
102102
-// use some_hal as _; // memory layout
103103
+use nrf52840_hal as _; // memory layout
104104
```
105105

106-
#### 6. run!
106+
#### 6. Get a linker script
107+
108+
Some HAL crates require that you copy over a file called `memory.x` from the HAL to the root of your project. For nrf52840-hal, the file is in the folder `nrf-hal/nrf52840-hal/`. You can get it from your local Cargo folder, the default location is:
109+
110+
```
111+
~/.cargo/registry/src/github.com-<long number>/nrf-hal/nrf52840-hal/memory.x
112+
```
113+
114+
You can also get the file from nrf-hal's [Github repository]. If you are using another HAL, you may need to write the file yourself. Check the documentation for the HAL you are using!
115+
116+
[Github repository]: https://github.com/nrf-rs/nrf-hal/tree/master/nrf52840-hal/
117+
118+
#### 7. Run!
107119

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

0 commit comments

Comments
 (0)