GithubHelp home page GithubHelp logo

anushudupi / wch-isp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jmaselbas/wch-isp

0.0 0.0 0.0 130 KB

mirror of https://sr.ht/~jmaselbas/wch-isp/

Home Page: https://sr.ht/~jmaselbas/wch-isp/

License: GNU General Public License v2.0

C 87.85% Makefile 4.68% Roff 7.47%

wch-isp's Introduction

wch-isp

wch-isp is an utility to write firmware into the flash of WCH microcontrollers, over USB. This utility started as a rewrite in C of the rust tool wchisp.

usage: wch-isp [-VDnpr] [-d <uid>] COMMAND [ARG ...]
       wch-isp [-VDnpr] [-d <uid>] [flash|write|verify|reset] FILE
       wch-isp [-VDnpr] [-d <uid>] [erase|config|remove-wp]
       wch-isp [-VDnpr] [list]

options:
  -d <uid> Select the usb device that matches by uid first, else by index
  -n       No verify after writing to flash, done by default
  -p       Print a progress-bar during command operation
  -r       Reset after command completed
  -D       Print raw isp command (for debug)
  -V       Print version and exit

This utility has been tested on:

  • CH32V103
  • CH569W
  • CH32V307VCT6 (Board YD-CH32V307VCT6)

Examples

List detected device in bootloader mode:

$ wch-isp list
0: BTVER v2.7 UID 8d-ff-ba-e4-c2-84-09-69 [0x1069] CH569 (flash 448K)
1: BTVER v2.5 UID f2-3e-88-26-3b-38-b5-9d [0x1980] CH32V208WB (flash 128K)
2: BTVER v2.6 UID cd-ab-72-86-45-bc-84-ee [0x1931] CH32V203C8 (flash 64K)

Flash the firmware.bin file, -p enable the progress bar.

$ wch-isp -p flash firmware.bin
BTVER v2.5 UID f2-3e-88-26-3b-38-b5-9d [0x1980] CH32V208WB (flash 128K)
[####################################################] write 35392/35392
[####################################################] verify 35392/35392
flash done

Erase the device's flash, select the device by it's uid (option -d).

$ wch-isp -d f2-3e-88-26-3b-38-b5-9d erase
BTVER v2.5 UID f2-3e-88-26-3b-38-b5-9d [0x1980] CH32V208WB (flash 128K)
erase done

Dependency

wch-isp depends on libusb 1.0 or above.

How to build

Linux

You can, optionally, modify the Makefile to match your local setup. By default wch-isp will be installed in /usr/local/bin and udev rules (if installed) will go in /etc/udev/rules.d.

Afterwards enter the following commands to build and install wch-isp:

make
make install

wch-isp will likely require udev rules to have access to the USB bootloader. Default udev rules are provided and can be installed with this command:

make install-rules

Windows using MSYS2

On Windows the build is done using MSYS2 and mingw64, you can install this from https://www.msys2.org Then from the MSYS2 console install the dependencies:

pacman -S mingw-w64-x86_64-make mingw-w64-x86_64-pkgconf mingw-w64-x86_64-gcc mingw-w64-x86_64-libusb

Then build using make:

PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/mingw64/lib/pkgconfig" make

Then the wch-isp.exe binary can be run like so:

PATH="$PATH:/mingw64/bin" ./wch-isp.exe

wch-isp's People

Contributors

bvernoux avatar gsunwinder avatar jmaselbas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.