Skip to content

Commit c99696d

Browse files
author
Lotte Steenbrink
authored
Merge pull request #27 from knurling-rs/how-to-switch-to-git-version
document how to switch to the git version of defmt
2 parents 43b3690 + e4f6307 commit c99696d

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,10 @@ incremental = false
4848
lto = 'fat'
4949
opt-level = 3 # <-
5050
overflow-checks = false # <-
51+
52+
# uncomment this to switch from the crates.io version of defmt to its git version
53+
# check app-template's README for instructions
54+
# [patch.crates-io]
55+
# defmt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
56+
# defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
57+
# panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,44 @@ $ echo $?
131131
0
132132
```
133133

134+
## Trying out the git version of defmt
135+
136+
This template is configured to use the latest crates.io release (the "stable" release) of the `defmt` framework.
137+
To use the git version (the "development" version) of `defmt` follow these steps:
138+
139+
1. Install the *git* version of `probe-run`
140+
141+
``` console
142+
$ cargo install --git https://github.com/knurling-rs/probe-run --branch main
143+
```
144+
145+
2. Check which defmt version `probe-run` supports
146+
147+
``` console
148+
$ probe-run --version
149+
probe-run 0.1.4 (3521a42 2020-11-12)
150+
supported defmt version: 3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4
151+
```
152+
153+
In the example output, the supported version is `3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4`
154+
155+
3. Switch defmt dependencies to git: uncomment the last part of the root `Cargo.toml` and enter the hash reported by `probe-run --version`:
156+
157+
``` diff
158+
-# [patch.crates-io]
159+
-# defmt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
160+
-# defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
161+
-# panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
162+
+[patch.crates-io]
163+
+defmt = { git = "https://github.com/knurling-rs/defmt", rev = "3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4" }
164+
+defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4" }
165+
+panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4" }
166+
```
167+
168+
You are now using the git version of `defmt`!
169+
170+
**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.
171+
134172
## Support
135173

136174
`app-template` is part of the [Knurling] project, [Ferrous Systems]' effort at

0 commit comments

Comments
 (0)