Commit 178d909
committed
Implement proper manifestation according to the spec
The initial behavior of entering dfuMANIFEST-SYNC was incorrect, sorry about
that. I've now thoroughly read the DFU spec, which actually states that
dfuMANIFEST-SYNC shall be entered *twice* after a download operation if
bitMainfestationTolerant = 1 (i.e. DFU_WILL_DETACH == 0), once after the
download completes, which begins manifestation by transitioning to dfuMANIFEST,
and again after manifestation has completed successfully, and only after that
should the transition to dfuIDLE be made. This means that there should be *two*
DFU_GETSTATUS calls from the host, and indeed dfu-util does exactly this
(verified using Wireshark).
Manifesting on USB reset or on detach is not according to spec. It should only
happen right after a download operation has finished. For this I've overhauled
the dfu_on_manifest_request() function to work as it should with both
DFU_WILL_DETACH == 1 and DFU_WILL_DETACH == 0. Validation should actually be
part of manifestation, and I've now added it as the manifestation callback
(since there is no other manifestation work to be done). The scb_reset_system()
call in the USB reset callback is what you need to perform detach-by-USB-reset,
but to avoid having random reset calls in multiple places it makes much more
sense to call the actual dfu_on_detach_complete() callback which will then
perform the reset. The USB reset callback should also not validate, e.g. a
blank flash with just the bootloader should not trigger a firmware error
status, so I've removed that logic.1 parent 191a092 commit 178d909
3 files changed
Lines changed: 38 additions & 53 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 35 | + | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
| |||
75 | 72 | | |
76 | 73 | | |
77 | 74 | | |
78 | | - | |
| 75 | + | |
79 | 76 | | |
80 | 77 | | |
81 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | 136 | | |
140 | 137 | | |
141 | 138 | | |
| |||
151 | 148 | | |
152 | 149 | | |
153 | 150 | | |
154 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
155 | 159 | | |
156 | 160 | | |
157 | | - | |
158 | | - | |
159 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
160 | 167 | | |
161 | 168 | | |
162 | 169 | | |
| |||
190 | 197 | | |
191 | 198 | | |
192 | 199 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
200 | 206 | | |
201 | | - | |
202 | 207 | | |
203 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
204 | 212 | | |
205 | 213 | | |
206 | 214 | | |
| |||
317 | 325 | | |
318 | 326 | | |
319 | 327 | | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
| 328 | + | |
325 | 329 | | |
326 | 330 | | |
327 | 331 | | |
| |||
355 | 359 | | |
356 | 360 | | |
357 | 361 | | |
358 | | - | |
359 | | - | |
360 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
361 | 365 | | |
362 | 366 | | |
363 | 367 | | |
364 | 368 | | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
384 | 372 | | |
385 | 373 | | |
386 | 374 | | |
387 | | - | |
| 375 | + | |
388 | 376 | | |
389 | 377 | | |
390 | 378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
0 commit comments