address review issues

This commit is contained in:
Mirabellensaft 2023-03-14 18:15:53 +01:00
parent 2c2358a333
commit 3e1dca1d4b

View file

@ -13,8 +13,8 @@ Generate your own PAC from an SVD file.
## Tasks
* Install `svd2rust` and `form` via cargo.
* Download the [nrf-svd] file and place it into `down-the-stack/dk-pac`.
* Run svd2rust on the file using the `cortex-m` flag.
* Download the [nrf-svd][svd] file and place it into `down-the-stack/dk-pac`.
* Run `svd2rust` on the file using the `cortex-m` flag.
* Format the generated file to make it readable.
* Split the file into its modules using `form`.
* Check the documentation.
@ -29,7 +29,7 @@ cargo install svd2rust
cargo install form
```
✅ Download https://github.com/NordicSemiconductor/nrfx/blob/master/mdk/nrf52.svd (This version has an error: writeonce needs to be changed to writeOnce)
✅ Download [nrf-svd][svd](This version has an error: writeonce needs to be changed to writeOnce)
Place the file into `down-the-stack/dk-pac`. Note how we provide a `Cargo.toml` file, as it will not be generated by svd2rust.
✅ In the terminal, go to the file's location. Run `svd2rust` with the SVD file to generate a PAC using the `cortex-m` flag.
@ -42,6 +42,8 @@ If you check the folder `down-the-stack/dk-pac` now, you see three new files:
* device.x - linker sections(?)
* build.rs - linker script
✅ Make an `/src` and move the generated `lib.rs` into it.
✅ Open the generated `lib.rs` with an editor.
Notice how it's barely correctly formatted.
@ -54,14 +56,12 @@ cargo doc --open
✅ Format the crate using `cargo fmt`.
This does not change to the docs, but `lib.rs` is a bit more readable.
✅ Use form to process the `lib.rs` to split it into modules, so that each module in in it's own file.
```terminal
form -i src/lib.rs -o src/
```
Re-run `cargo fmt`.
✅ Re-run `cargo fmt`.
[nrf svd]: (https://github.com/NordicSemiconductor/nrfx/blob/master/mdk/nrf52.svd )
[svd]: (https://github.com/NordicSemiconductor/nrfx/blob/master/mdk/nrf52.svd )