Clean up diffs and remove "running from git" steps

This commit is contained in:
datdenkikniet
2023-05-01 14:49:44 +02:00
parent 28f7130291
commit 39eaa23d3b
3 changed files with 11 additions and 62 deletions
+3 -55
View File
@@ -106,8 +106,8 @@ You will need to not just specify the `rp-hal` HAL, but a BSP (board support cra
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 ``` diff
// my-app/src/lib.rs # my-app/src/lib.rs
-// use some_hal as _; // memory layout -use some_hal as _; // memory layout
+use nrf52840_hal as _; // memory layout +use nrf52840_hal as _; // memory layout
``` ```
@@ -116,6 +116,7 @@ Now that you have selected a HAL, fix the HAL import in `src/lib.rs`
In `src/bin/minimal.rs`, edit the `rtic::app` macro into a valid form. In `src/bin/minimal.rs`, edit the `rtic::app` macro into a valid form.
``` diff ``` diff
# my-app/src/bin/minimal.rs
\#[rtic::app( \#[rtic::app(
- // TODO: Replace `some_hal::pac` with the path to the PAC - // TODO: Replace `some_hal::pac` with the path to the PAC
- device = some_hal::pac, - device = some_hal::pac,
@@ -165,62 +166,9 @@ If you're running out of memory (`flip-link` bails with an overflow error), you
$ DEFMT_BRTT_BUFFER_SIZE=64 cargo rb hello $ DEFMT_BRTT_BUFFER_SIZE=64 cargo rb hello
``` ```
#### (10. Set `rust-analyzer.linkedProjects`)
If you are using [rust-analyzer] with VS Code for IDE-like features you can add following configuration to your `.vscode/settings.json` to make it work transparently across workspaces. Find the details of this option in the [RA docs].
```json
{
"rust-analyzer.linkedProjects": [
"Cargo.toml",
"firmware/Cargo.toml",
]
}
```
[RA docs]: https://rust-analyzer.github.io/manual.html#configuration [RA docs]: https://rust-analyzer.github.io/manual.html#configuration
[rust-analyzer]: https://rust-analyzer.github.io/ [rust-analyzer]: https://rust-analyzer.github.io/
## Trying out the git version of defmt
This template is configured to use the latest crates.io release (the "stable" release) of the `defmt` framework.
To use the git version (the "development" version) of `defmt` follow these steps:
1. Install the *git* version of `probe-run`
``` console
$ cargo install --git https://github.com/knurling-rs/probe-run --branch main
```
2. Check which defmt version `probe-run` supports
``` console
$ probe-run --version
0.2.0 (aa585f2 2021-02-22)
supported defmt version: 60c6447f8ecbc4ff023378ba6905bcd0de1e679f
```
In the example output, the supported version is `60c6447f8ecbc4ff023378ba6905bcd0de1e679f`
3. Switch defmt dependencies to git: uncomment the last part of the root `Cargo.toml` and enter the hash reported by `probe-run --version`:
``` diff
-# [patch.crates-io]
-# defmt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
-# defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
-# defmt-test = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
-# panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
+[patch.crates-io]
+defmt = { git = "https://github.com/knurling-rs/defmt", rev = "60c6447f8ecbc4ff023378ba6905bcd0de1e679f" }
+defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "60c6447f8ecbc4ff023378ba6905bcd0de1e679f" }
+defmt-test = { git = "https://github.com/knurling-rs/defmt", rev = "60c6447f8ecbc4ff023378ba6905bcd0de1e679f" }
+panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "60c6447f8ecbc4ff023378ba6905bcd0de1e679f" }
```
You are now using the git version of `defmt`!
**NOTE** there may have been breaking changes between the crates.io version and the git version; you'll need to fix those in the source code.
## Support ## Support
`app-template` is part of the [Knurling] project, [Ferrous Systems]' effort at `app-template` is part of the [Knurling] project, [Ferrous Systems]' effort at
+1 -1
View File
@@ -38,7 +38,7 @@ sd -s -- '--chip $CHIP' '--chip nRF52840_xxAA' .cargo/config.toml
sd -s '# target = "thumbv7em-none-eabihf"' 'target = "thumbv7em-none-eabihf"' .cargo/config.toml sd -s '# target = "thumbv7em-none-eabihf"' 'target = "thumbv7em-none-eabihf"' .cargo/config.toml
sd -s '$RTIC_BACKEND' 'thumbv7-backend' Cargo.toml sd -s '$RTIC_BACKEND' 'thumbv7-backend' Cargo.toml
sd -s '# some-hal = "1.2.3"' 'nrf52840-hal = "0.16.0"' Cargo.toml sd -s '# some-hal = "1.2.3"' 'nrf52840-hal = "0.16.0"' Cargo.toml
sd -s '// use some_hal as _;' 'use nrf52840_hal as _;' src/lib.rs sd -s 'use some_hal as _;' 'use nrf52840_hal as _;' src/lib.rs
sd -s 'some_hal::pac' 'nrf52840_hal::pac' src/bin/minimal.rs sd -s 'some_hal::pac' 'nrf52840_hal::pac' src/bin/minimal.rs
sd -s 'FreeInterrupt1, ...' 'SWI0_EGU0' src/bin/minimal.rs sd -s 'FreeInterrupt1, ...' 'SWI0_EGU0' src/bin/minimal.rs
+3 -2
View File
@@ -4,10 +4,11 @@
use core::sync::atomic::{AtomicUsize, Ordering}; use core::sync::atomic::{AtomicUsize, Ordering};
use defmt_brtt as _; // global logger use defmt_brtt as _; // global logger
// TODO(6) Import your HAL
// use some_hal as _; // memory layout
use panic_probe as _; use panic_probe as _;
// TODO(6) Import your HAL
use some_hal as _; // memory layout
// same panicking *behavior* as `panic-probe` but doesn't print a panic message // same panicking *behavior* as `panic-probe` but doesn't print a panic message
// this prevents the panic message being printed *twice* when `defmt::panic` is invoked // this prevents the panic message being printed *twice* when `defmt::panic` is invoked
#[defmt::panic_handler] #[defmt::panic_handler]