ofrak icon indicating copy to clipboard operation
ofrak copied to clipboard

Uf2 support

Open sjossi opened this issue 3 years ago • 4 comments

Link to Related Issue(s) UF2 unpacker support was requested in #17.

Please describe the changes in your request. Implemented the Unpacker and Packer for UF2, using Microsoft Opencode's UF2 utilities. Their python module is not packaged in pypi, but I created the required setup.{py,cfg} files in a fork, and am asking for it to be merged as discussed in microsoft/uf2#42

sjossi avatar Sep 16 '22 18:09 sjossi

Regarding using the CLI. Are you sure that their global variables become a problem? From what I understand they should be exposed in the module just like anything else, so even importing uf2conv should not break. Otherwise even the existing code should have failed, right? @whyitfor

sjossi avatar Sep 21 '22 20:09 sjossi

Converting to Draft again, so I can make the Unpacker unpack into a CodeRegion or MemoryRegion.

sjossi avatar Oct 03 '22 20:10 sjossi

I'm packing and unpacking fully manually now and return contingent CodeRegions. As discussed, we fail at multiple Family_IDs, but that would be a small change (I almost had it half done, but then simplified to get it done).

Also, currently we don't support any embedded files and further information because it was not in the original scope. But extending the Unpacker should be quite easy, I purposely left the if/else in to make it obvious how and where to implement it.

I had more tests that I ran jankily. I will parametrize the tests and check in a few more sample files (from https://arcade.makecode.com/ and other sources that don't obviously use uf2conv.py.)

sjossi avatar Oct 07 '22 23:10 sjossi

Fixed the notebook tests, so all checks pass now. Assinging Edward for code review

sjossi avatar Oct 10 '22 15:10 sjossi

@EdwardLarson Thanks again for the review, I implemented all fixes. Please have a quick look.

sjossi avatar Oct 21 '22 16:10 sjossi