CH341A FlashROM for Windows
Version: 1.2-1094-g748575ab (2022-12-02)
I bought a device where the flash chip onboard happens to be an XM25QH128C
by XMC from the now world-famous Wuhan. Since FlashROM support for this chip was only added recently, none of the existing Windows builds around come with it. So I built the latest current version for my own use. Sharing it below for the benefit of the community.
Download: flashrom-1.2-1094-outsyde-20221202-ch341a_spi-win64.zip (Mirror: Mega.nz)
Usage Notes
- Works with the usual “driver” (really just an
.inf
file for VID:PID1A86:5512
), which is included in the ZIP as well. Credit for it goes to @flashrom I think, who also shared several builds here in the past. Might need to temporarily disable signature enforcement to install if you don’t already have it.- For driver installation issues, check the earlier posts in the thread: it’s been discussed extensively, and nothing’s changed since.
- Only dependency is on
libwinpthread-1.dll
, which should be in the same directory. If you get an error: “The application was unable to start correctly (0xc000007b)”, it means this DLL file is missing.- Other libraries (
libusb
) are linked statically.
- Other libraries (
- Output is verbose. Most warnings can be ignored unless there is an actual error. In particular: “Cannot detach the existing USB driver. Claiming the interface may fail.” is benign.
- Note that the best practice is to connect directly to a USB port on the system board, not shared with any other devices, and especially not through any USB hub.
- This build hasn’t been extensively tested, and since it’s just a snapshot cloned as-is from GitHub, it’s certainly not guaranteed to be stable. That being said, I tried reading and writing with a loose Winbond
W25Q64FV
I have lying around, and all worked fine (verifying too). For the record, I couldn’t check with an actualXM25QH128C
as I don’t have the device yet. Still:- I won’t be responsible if you run into issues. If you don’t need support for any of the newer chips (see below), consider using any of the earlier builds already battle-proven in many scenarios.
- Also included in the ZIP is the
ich_descriptors_tool.exe
tool, which builds together.
Updated Chip List
Over the version I was previously using (the one built and shared here by @flashrom), support has been added or expanded for over 60 chips:
- Atmel AT25SF128A
- Boya/BoHong Microelectronics B.25D16A B.25Q128AS
- Eon EN25F10 EN25QH128 EN25QH32B EN25QH64A EN25S64
- Fudan FM25F005 FM25F01 FM25F02(A) FM25F04(A) FM25Q08 FM25Q16 FM25Q32
- GigaDevice GD25LQ128C/GD25LQ128D/GD25LQ128E GD25Q256D/GD25Q256E GD25Q40(B)
- ISSI IS25LP064
- Intel 25F640S33B8 AT82802AB
- Macronix MX25L12833F/MX25L12835F/MX25L12865E/MX25L12873F MX25L1635D
- Macronix MX25L3233F/MX25L3273E MX25L5121E/MX25L6465E MX25L6473E MX25L6473F MX25U25635F MX66L1G45G
- Micron MT25QL256 MT25QU256
- Spansion S25FL128L S25FL128S_UL S25FL128S_US S25FL256L S25FL512S S25FS128S (Large & Small Sectors)
- Winbond W25Q32BV/W25Q32CV/W25Q32DV W25Q32FV W25Q32JV
- Winbond W25Q32BW/W25Q32CW/W25Q32DW W25Q32FW W25Q32JW…Q W25Q32JW…M
- Winbond W25Q64BV/W25Q64CV/W25Q64FV W25Q64JV-.Q W25Q64JV-.M W25Q64JW…M
- Winbond W25Q256FV W25Q256JV_Q W25Q256JW W25Q256JW_DTR W25Q512NW-IM W25X05
- XMC XM25QH64C XM25QU64C XM25QH128C XM25QU128C XM25QH256C XM25QU256C
Building from Source
I also couldn’t find any comprehensive and current build instructions for Windows, so here they are. To build, get MSys2 and run the following in the MSys2 MinGW64 shell:
pacman -Syu
pacman -S base-devel binutils git pactoys
pacboy -S cc libusb meson pkg-config
git clone https://github.com/flashrom/flashrom.git
cd flashrom && meson setup \
--auto-features=enabled --buildtype=plain \
-Ddefault_programmer_name=ch341a_spi \
-Dprogrammer=ch341a_spi,dummy -Dtests=disabled \
--default-library=static --prefer-static \
--prefix="${MINGW_PREFIX}" --wrap-mode=nodownload \
build
cd build && meson compile
- After building, remember to copy
libwinpthread-1.dll
you can find inmingw64/bin
directory together withflashrom.exe
if you want to use this build of FlashROM outside the MSys2 MinGW64 shell, or on another device. - Note: it’s almost certainly not necessary to install the whole
cc
meta-package, just faster to grab it all rather than figure out which parts are needed (if you’re a lazy person with a fast connection at least). As a matter of fact,binutils
might not be required either.
Enjoy!
PS Massive thanks to @flashrom for providing the earlier builds, which kept me going for years, without having to build it on my own.