usage: kflash.py [-h] [-p PORT] [-c CHIP] [-b BAUDRATE] [-l BOOTLOADER]
[-k KEY] [-v] [-t] [-B BOARD] [-n]
firmware
positional arguments:
firmware firmware bin path
optional arguments:
-h, --help show this help message and exit
-p PORT, --port PORT COM Port
-c CHIP, --chip CHIP SPI Flash type, 1 for in-chip, 0 for on-board
-b BAUDRATE, --baudrate BAUDRATE
UART baudrate for uploading firmware
-i, --isp choose which built-in ISP_PROG
-l BOOTLOADER, --bootloader BOOTLOADER
bootloader bin path
-k KEY, --key KEY AES key in hex, if you need encrypt your firmware.
-v, --verbose increase output verbosity
-t, --terminal Start a terminal after finish (Python miniterm)
-B BOARD, --Board BOARD
Select dev board, dan or kd233 or goD or goE, default dan
-n, --noansi Do not use ANSI colors, recommended in Windows CMDMaixgo with openec firmware, BOARD must choose -B goE, and should choose sencond com port.
with cmsis-dap firmware(before 2019.02.21), BOARD must use -B goE.
you can update new cmsis-dap firmware ,it is same as openec.
# Linux or macOS
python3 kflash.py firmware.bin
python3 kflash.py -t firmware.bin # Open a Serial Terminal After Finish
# Windows CMD or PowerShell
python kflash.py firmware.bin
python kflash.py -t firmware.bin # Open a Serial Terminal After Finish
python kflash.py -n -t firmware.bin # Open a Serial Terminal After Finish, do not use ANSI colors
# Windows Subsystem for Linux
sudo python3 kflash.py -p /dev/ttyS13 firmware.bin # ttyS13 Stands for the COM13 in Device Manager
sudo python3 kflash.py -p /dev/ttyS13 -t firmware.bin # Open a Serial Terminal After Finish- Python3
- PySerial
- Download and Install Python3 at python.org
- Download the get-pip.py at https://bootstrap.pypa.io/get-pip.py
- Start CMD or PowerShell Terminal and run the following command
python get-pip.py
python -mpip install pyserial# Install Homebrew, an awesome package manager for macOS
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install python
python3 -mpip3 install pyserialsudo apt update
sudo apt install python3 python3-pip
sudo pip3 install pyserialsudo dnf install python3
sudo python3 -m pip install pyserialsudo yum -y install epel-release
sudo yum -y install python36u python36u-pip
sudo ln -s /bin/python3.6 /usr/bin/python3
sudo ln -s /bin/pip3.6 /usr/bin/pip3
sudo pip3 install pyserialFor Windows Subsystem for Linux, you may have to use sudo due to its docker like feature
- Add your self to a dialout group to use usb-to-uart devices by
sudo usermod -a -G dialout $(whoami)- Logout, and log in.
- Check the COM Number for your device at the Device Manager, such as USB-SERIAL CH340(COM13).
python kflash.py -p COM13 firmware.bin- Check the COM Number for your device at the Device Manager, such as USB-SERIAL CH340(COM13).
sudo python3 kflash.py -p /dev/ttyS13 firmware.bin # You have to use *sudo* here- Check the USB Device Name, Usually presented as ttyUSB*
ls /dev/ttyUSB*- It will print :
$ ls /dev/ttyUSB*
/dev/ttyUSB0
/dev/ttyUSB2
/dev/ttyUSB13- Choose the one you think belongs to your device, or you may try multiple names.
python3 kflash.py -p /dev/ttyUSB13 firmware.bin- Check the USB Device Name, Usually presented as cu.*
ls /dev/cu.*- It will print :
$ ls /dev/ttyUSB*
/dev/cu.wchusbserial1410
/dev/cu.wchusbserial1437
/dev/cu.SLAB_USBtoUART2333- Choose the one you think belongs to your device, or you may try multiple names.
python3 kflash.py -p /dev/cu.wchusbserial1410 firmware.bin- For K210 and Sipeed Dan -> WCH CH34x USB2UART Chip