microsoft / uf2

UF2 file format specification
Other
849 stars 164 forks source link

Convert to Python3. Use PEP8 naming conventions and formatting. #2

Closed ntoll closed 1 year ago

ntoll commented 7 years ago

I've been playing with CircuitPython and the Circuit Playground Express. Wanting to flash the device with a new build I ran across this script.

As a courtesy I've converted it from Python 2 (soon to be unsupported) to Python 3 (they tell me it's the future). I've also renamed a few things and changed formatting to conform roughly with the PEP8 Python style guide (https://www.python.org/dev/peps/pep-0008/).

There are no tests! However, I can only confirm the script converts a CircuitPython .bin file to .uf2 and that the device flashed with the resulting firmware.uf2 file works:

$ ./uf2conv.py ~/src/circuitpython/atmel-samd/build-circuitplayground_express/firmware.bin -o firmware.uf2

I've made a cursory check with my eyeball Mk.1 but YMMV with the other functionality. Please check.

Thanks for the tool, the usefulness of uf2 and I hope this is helpful. :-)

mmoskal commented 6 years ago

I think you might have patched an old version, without .hex file support.

mmoskal commented 1 year ago

python3 conversion was done later