Skip to content

Building AVRDUDE for Windows using Visual Studio

mcuee edited this page Feb 15, 2024 · 9 revisions

On Windows, using Microsoft Visual C from Visual Studio is the recommended way to build AVRDUDE.

Building AVRDUDE using this procedure provides you with the following benefits, compared to MSYS2, Cygwin, or MinGW cross-builds:

  • First class IDE support with Visual Studio.
  • Windows Debugging Symbols (PDB symbols).
  • Customized libraries for much improved Windows integration.
  • Statically linked libraries with no extra DLL dependencies.

Prerequisites

To build AVRDUDE using Visual Studio, you need Visual Studio 2019 or higher and the following workloads:

  • Desktop development with C++
  • C++ CMake tools for Windows (minimum required CMake version is 3.14)

For the scanner/parser generation, you need to install Flex 2.6 or higher and Bison 3.7 or higher. You can download WinFlexBison from GitHub. Make sure that the executables win_flex.exe and win_bison.exe are accessable through the Windows PATH variable.

Build Instructions

To build AVRDUDE for Windows, run the following commands inside a Developer Command Prompt for VS:

git clone https://github.com/avrdudes/avrdude.git
cd avrdude
cmake -D USE_EXTERNAL_LIBS=1 -B build_msvc
cmake --build build_msvc --config RelWithDebInfo

To build AVRDUDE for Windows using Visual Studio, do the following:

  • In Visual Studio, clone the AVRDUDE repository using the menu Git -> Clone Repository and specify the URL https://github.com/avrdudes/avrdude.git.
  • From the Solution Explorer, open the Folder view of the repository you just cloned.
  • From the menu Build, click Build All to build AVRDUDE.

When the project has been built successfully, you should have the files avrdude.exe and avrdude.conf in your out\build folder. The files may be located in a sub-folder, depending on the build system you are using.

Notes

The Visual Studio CMake project is different from the MSYS2 or Cygwin projects. As the required libraries libelf, libusb, libhidapi, and libftdi1 are not available via vcpkg, these libraries are made available via GitHub repositories instead. These repositories have been heavily customized for Windows, which means the compiled binaries behave differently than the ones compiled with stock libraries using MSYS2/MinGW or Cygwin.

To load the external libraries during the CMake build, the CMake option USE_EXTERNAL_LIBS needs to be set to True.

The most current build instructions for Microsoft Visual C can be viewed in the AVRDUDE build workflow at https://github.com/avrdudes/avrdude/blob/main/.github/workflows/build.yml. See the msvc job for details.

Know limitations of Visual Studio build

If you encounter the following issue under Windows, you may want to try out MSYS2 mingw64 build. https://github.com/avrdudes/avrdude/issues/1552 (no libserialport support)

  1. https://github.com/avrdudes/avrdude/issues/1253 (slow speed when using arduino-ft232r or similar programmer)

  2. https://github.com/avrdudes/avrdude/issues/968 (not working with USB Composite Device programer like USBASP with the FW from https://github.com/dioannidis/usbasp)

  3. https://github.com/avrdudes/avrdude/discussions/1440 (no support of CH341A)