Python based flash/verify tool for the CH55x MCUs
This script is based on work done by:
2.2 Fixed flash/erase block ranges, bargraph, added udev install script.
2.1 Added serial port option for bootloader v.2.31 + hardware reboot into bootloader.
2.0 Fixed flashing algorithm for bootloader v.2.31
1.0 Initial version
Succesfull tests:
Succesfull tests:
Logging and Serial port option is not implemented for Bootloader v.1.1.
python3 -m pip install --user pyusb pyserial
python3 chflasher.py [-h] [--version] [-p PORT] [-f FILE] [-w | -v | -d | -e]
[-s] [--log LOG]
optional arguments:
-h, --help show this help message and exit
--version Show version.
-p PORT, --port PORT serial port
-f FILE, --file FILE The target file to be flashed.
-w, --write Write file to flash, verify and exit the bootloader
-v, --verify Verify flash against the provided file.
-d, --detect Detect chip and bootloader version.
-e, --erase Erase flash.
-s, --start_app Reset and start application.
--log LOG Log opeations to file.
On Linux if you make the script executable:
chmod +x chflasher.py
you can omit the python3 command and run the srcipt directly.
write, verify the blink.bin file and exit the bootloader:
python3 chflasher.py -w -f blink.bin -s
write, verify the blink bin file and exit the bootloader, log operations in the write.log file:
python3 chflasher.py -w -f blink.bin -s --log write.log
verify the flash against the blink.bin file:
python3 chflasher.py -v -f blink.bin
erase the flash:
python3 chflasher.py -e
detect chip and bootloader version:
python3 chflasher.py -d
show help/usage:
python3 chflasher.py -h
To make use of a serial port instead of USB provide the additional parameter:
-p PORT
ie on Linux:
python3 chflasher.py -p /dev/ttyUSB0 -w -f blink.bin
or in Windows:
python3 chflasher.py -p COM5 -w -f blink.bin
Copyright 07.2021 by Piotr Zapart
www.hexefx.com