Uploading custom HEX firmware to MicroPython board
In my last post we setup System Workbench and setup some flashing LED code, we compiled it and uploaded it to the Pyboard. We had to generate a HEX file in System Workbench, generate a DFU file and then upload the DFU file to the board - phew! It's actually fairly simple to automate the DFU conversion and upload process. First, download the DFUSE-commandline utility, here:
https://github.com/BrieucDM/DFUSE-commandline
Now create a .BAT file in the DfuSeCommandlineMaster\BIN folder (or set the DfuSeCommandlineMaster\BIN folder as a system PATH, etc). In the batch file, insert the following lines:
C:\Users\Home\DfuSeCommandlineMaster\BIN\DfuFileMgr.exe C:\Users\Home\workspace\BlinkLED\Debug\BlinkLED.hex C:\Users\Home\workspace\BlinkLED\Debug\BlinkLED.dfu
C:\Users\Home\DfuSeCommandlineMaster\BIN\DfuSeCommand.exe -c -d --fn C:\Users\Home\workspace\BlinkLED\Debug\BlinkLED.dfu -l
pause
Obviously you'll need to change the paths to those appropriate to your machine. You'll need to set DFU low, and reset the Pyboard with DFU held low before running the batch file (I have a button connecting the DFU pin to GND for ease). I prefer to setup a shortcut on the desktop. I compile my program, press the DFU low button, reset and then run the above batch file to flash the program. Simple!
Comments
Post a Comment