Skip to content

Comments

DFU file support#45

Merged
Ralim merged 16 commits intomasterfrom
ralim
Aug 1, 2023
Merged

DFU file support#45
Ralim merged 16 commits intomasterfrom
ralim

Conversation

@Ralim
Copy link
Collaborator

@Ralim Ralim commented Aug 1, 2023

Hia,
This brings in a base for .dfu file support.
These are great as they are basically a standard for putting headers on .bin files for us to know things like address.

This has been tested locally with the .dfu files from IronOS but more testing ongoing.

Ralim added 9 commits August 1, 2023 07:44
Just grabbing first one for now

Expose crc

Update CMakeLists.txt

Test DFU file

Split crc function

Fixup

Zero init struct
Dont null the pointer 🤦
correct fread

Adding tests

Create dfu_file.h

Format

Scratching out more parsing

Basic port parser

Scratching fread wrapper
Update CMakeLists.txt
Update dfu_file.c
@robertlipe
Copy link
Collaborator

Cool change! Saving people from BL download protocol is a great idea.
UF2, too, or just DFU?

@Ralim
Copy link
Collaborator Author

Ralim commented Aug 1, 2023

I have no motivation to add UF2, if someone wants to make a PR; this should make it easier (once I get it all cleaned up and do more testing). What would the use case for UF2 be here?

@robertlipe
Copy link
Collaborator

Agreed. They're pretty close, technically, and this moves the ball pretty far. Skimming the code, it's a great update.

UF2 has a lot of tooling & developer mindshar right nowe. RP2040 (? Pi Zero?) burns it into mask rom as the official flasher. NIfty thing is that it can do containers, as for resources (icons) to store at different addresses, multiple images for different devices (V1, V2 of similar hardware or different compile images for different memory layouts) in the same file that are sussed out at load time, etc. The device is somewhat responsible for choosing it own adventure on which parts of the image to request and load. It's sector/block/page oriented instead of a stream of bytes. Incremental flashing to reduce sector wear.

I helped on an STM32.implementation. It's pretty clever.

Its better thought out than you expect a Microsoft technology to be.

"Don't care" is perfectly legit. :-)

@Ralim Ralim marked this pull request as ready for review August 1, 2023 11:48
@Ralim
Copy link
Collaborator Author

Ralim commented Aug 1, 2023

So this all seems to work for me locally. Going to get @gamelaster to poke the windows builds as I dont have a Windows machine here.

@Ralim
Copy link
Collaborator Author

Ralim commented Aug 1, 2023

@robertlipe

Yeah this should set us up for handling more in the future. I gues only refactor outstanding would maybe be to support multiple chunks. But that can wait to see if we get a need for it.

I'm definitely in the dont really care bucket at the moment for a new format, but if someone gives a good use case; I'm happy to look into it.

I think UF2 could be good option later on; but will wait for a use to show up :)

@Ralim Ralim merged commit f1b93a1 into master Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants