-
Notifications
You must be signed in to change notification settings - Fork 149
Building AVRDUDE for Windows using MSYS2
If you prefer to use MSYS2 as your development environment, you may build AVRDUDE directly in MSYS2.
MSYS2 can also be used to build native Windows binaries, i.e. executables that do not require any MSYS2 DLLs to execute. If you want to create native Windows binaries, make sure that you do not use the MSYS environment. Instead, use a Windows compatible environment, such as MINGW32 or MINGW64.
The MSYS2 stock libraries, such as libusb-1.0, libusb-win32, or libftdi may require the use of Zadig to switch drivers, whereas the the custom libraries of the MSVC builds do not require the switching of drivers as much as possible. The official avrdude Windows release will use MSVC builds. If you have trouble connecting to your USB devices, see Troubleshooting USB devices in Windows.
32bit MSYS2 mingw32 build has been removed after avrdude 7.3 release (since commit https://github.com/avrdudes/avrdude/commit/cdfc88dfc47dffc4322993b9c32e84bbc41e4bf6) because MSYS2 removed 32bit binaries for libusb, libusb-compat-git and libftdi.
Update the package database first:
pacman -Syu
For 32-bit builds, use the MINGW32 environment and install
pacman -S --needed base-devel git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-pkgconf
pacman -S --needed mingw-w64-i686-libelf mingw-w64-i686-libusb mingw-w64-i686-libusb-compat-git mingw-w64-i686-libusb-win32 mingw-w64-i686-hidapi mingw-w64-i686-libftdi mingw-w64-i686-readline mingw-w64-i686-ncurses mingw-w64-i686-termcap mingw-w64-i686-libserialport
For 64-bit builds, use the MINGW64 environment and install
pacman -S --needed base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-pkgconf
pacman -S --needed mingw-w64-x86_64-libelf mingw-w64-x86_64-libusb mingw-w64-x86_64-libusb-compat-git mingw-w64-x86_64-libusb-win32 mingw-w64-x86_64-hidapi mingw-w64-x86_64-libftdi mingw-w64-x86_64-readline mingw-w64-x86_64-ncurses mingw-w64-x86_64-termcap mingw-w64-x86_64-libserialport
Please take note minimum required version for CMake is 3.14.
For 32-bit builds, use the MINGW32 environment and run the following commands:
git clone https://github.com/avrdudes/avrdude.git
cd avrdude
cmake -G"MSYS Makefiles" -D CMAKE_BUILD_TYPE=RelWithDebInfo -B build_mingw32
cmake --build build_mingw32
For 64-bit builds, use the MINGW64 environment and run the following commands:
git clone https://github.com/avrdudes/avrdude.git
cd avrdude
cmake -G"MSYS Makefiles" -D CMAKE_BUILD_TYPE=RelWithDebInfo -B build_mingw64
cmake --build build_mingw64
Known limitation of the above MSYS2 mingw build
-
You will have to use Zadig to swtich the FTDI vendor driver if you use libftdi based programmer (eg: ft232h, ft2232h, arduino-ft232r)
-
https://github.com/avrdudes/avrdude/issues/1271 (timeout may be more likely to happen for urclock in terminal mode)
-
https://github.com/avrdudes/avrdude/issues/1594 (not working with SNAP and PICKit 4 under Windows 7)