Skip to content

Loading builds...

Changes

#2647 (Mar 12, 2026, 8:15:08 PM)

dfu: MANIFEST_SYNC: stay in MANIFEST_SYNC when manifestationIntolerant & completed

In theory a device which is manifestintolerant and completed the manifestation should
not reach MANIFEST_SYNC again.

Remove the state transistion to WAIT-RESET and stay in the current state and
wait for the main loop to change the state is safer.

Change-Id: I8c34a18e2336731126a8c01070d86e2547578e3d
lynxis at
dfu: protect USB_DFU_STATE_DFU_MANIFEST by a critical section

In the MANIFEST state, the IRQ won't move the state, but
to prevent incosistency between dfu_manifestation_complete &
dfu_state, use a critical section.

Change-Id: Idf5fb7d55b4051ba7e235dfa409a4de18a8f208c
lynxis at
Replace snprintf() to free 4 kb

Change-Id: Ide644648bda86d4ae77a6713d1e140a4b78ba835
lynxis at
dfu: download: flash the first block in manifest phase

To prevent half flashed applications, erase the first page
when dfu downloading starts and save the first block for later.
In manifest stage, flash the first block.
If the first 4 byte are 0xffffffff, the board won't boot
into application and go into the dfu bootloader.

Change-Id: I894f3ee71587ccb287e92d7025039954991c631f
lynxis at
dfu: flash: protect parsing of rc of flashing

Otherwise it is not guaranteed that both dfu_status and dfu_state
are in sync when the IRQ handler is running.

Change-Id: Ifc0d56d779ec31382855d6c367478104bc04e1e7
lynxis at
dfu: download: make variables between IRQ and main loop volatile

Both are access by IRQ and mainloop and are written by the IRQ handler.

Change-Id: Ic3dccd77eff7feb164f9f07047680eef3f7c2516
lynxis at
dfu: download: align download data buffer

The download data buffer is given to the usb stack.
Ensure the data buffer is dma capable to prevent an
additional memcpy() by the usb hal.

Change-Id: I01191a125aa62c2198e38d5e5fcd27d4e421c62e
lynxis at

#2644 (Mar 10, 2026, 10:05:07 AM)

Makefile: on clean: remove dfu & flash .o & .d files

Change-Id: I9705f15c41ea0df8b8486b6326264db36f797dd8
laforge at

#2643 (Mar 10, 2026, 9:45:07 AM)

dfu: make dfu_state/dfu_status volatile

Both variable might be changed from IRQ and from main loop.

Change-Id: I7ad5255064917c203cebe5ab54a5d457baa2f5ed
lynxis at
dfu: mainloop: work on a local copy of dfu_state

Prevent race conditions between main loop and irq.
Copy at the start of the loop the dfu state and work on it.

Change-Id: Ic146c8fa5ba25425cf785bae66f9c99b0faab944
lynxis at
dfu: irq: replace if(states) with a switch case

Improves the overview. No functional change.

Change-Id: Ic32fe16dff4b7bb933ec62e36a9c7c7829aece1b
lynxis at
dfu: usb_dfu() convert if() intos switch/case

Improves the overview of the handled states.
No functional change.

Change-Id: Ie0abcdb51612598e77cacf7772276919ded17d5a
lynxis at

#2628 (Feb 24, 2026, 7:25:07 PM)

dfu: fix bState transition/reporting order as per dfu spec

DFU spec wants the next state, not the current one.

Change-Id: I06519c73cdb0b082002632da9cfe7436c63f52b0
ewild at
dfu: make resp buffer static

USB dma uses a buffer depending on alignment, so this can be safe,
but it should not be depend on reading and knowing the asf source code...

Change-Id: I2f9336143190350817e6352b00751b35b1600b62
ewild at
dfu: do not reset itself

In theory USB_DFU_ATTRIBUTES_WILL_DETACH is nice, in practice
not so much, because usb uses control transfers and "waiting" for
status response completion after finishing flashing is cumbersome.
There is basically no advantage if the device resets itself, and
just waiting for the host to do it like most DFU devices
(and what the BL used to do in the beginning) works
around the status issue.

Right now dfu-utils is unhappy because the final get status never is answered because the response is submitted by the device, but the self reset immediately afterwards is faster, so it never arrives at the host.

Change-Id: I1b9e48470083597640918a8a1126922b31150153
benispeter at