Building Blackmagic Probe on Windows

A while ago I wrote a blog describing how to build the firmware for the Blackmagic Probe (BMP) on Windows. Since that time I have crowdfunded a wireless version of BMP, my ctxLink debug probe, since I do all my development on Windows I have gained more experience building this project. This blog is an attempt to collect everything I have learned during this process into one place, and also to try to simplify both the building and debugging of the BMP, and therefore the ctxLink, firmware.

The tools required

My goal while developing ctxLink was to not only have a simple method of building the firmware, but also to have GUI-based debugging. One of the most popular, and probably fastest growing, integrated development environments (IDE) is Microsoft Visual Studio Code (VSCode). It is being adopted across a broad range of technology domains, from web-based through to desktop applications. It has extensions for C/C++ development and an extension that enables embedded system development for the ARM Cortex-M. So, if you wish to use a similar environment a future blog will have instructions for setting up VSCode for Cortex-M development.

GNU ARM Toolchain

To build the BMP firmware the GNU ARM compiler toolchain is required. A binary for Windows is available for download here.

After installing the compiler toolchain it is important to check that the PATH environment variable has been correctly set. To test this open a command window and type “arm-none-eabi-gcc –version”. The command should display the version information of the compiler.

If the command is not found, add the path to the installation “bin” folder to the PATH environment variable.

Other tools

To build the embedded firmware for the BMP the Cygwin environment is required. Note that this requirement is to make available some utilities normally found on Unix. we will not be using the Cygwin terminal environment for the build process. To begin, download the Cygwin setup program that matches your Windows system from here and run it.

For the initial installation I just installed the default packages and did not add anything to them. Once this is done add the path to the Cygwin “bin” folder to the PATH environment variable.

Next, run the Cygwin setup program again and add the following packages to the installation:

  • cygwin-devel
  • libftdi1
  • libftdi1-debuginfo
  • libftdi1-devel
  • libpkgconf3
  • pkg-config
  • pkgconf

Clone the BMP repository

We are now ready to get the source for the BMP, it is found on Github at this URL.

Building the firmware

BMP uses the library libOpenCM3, and the repository cloned above has a submodule for the libOpenCM3 commit that BMP has been tested against. Building libOpenCM3 on Windows is now much easier since the maintainer of the BMP firmware has updated the libOpenCM3 submodule used and libOpenCM3 has addressed the Windows build issues.

Open a command window and navigate to the BMP root folder and type “make clean”. This will produce a series of “CLNHDR” commands, followed by cleaning of each library variant. This may take a while, especially the last stage which is cleaning the “docs” for libOpenCM3.

Finally, we are ready to build the libOpenCM3 libraries and the firmware of the BMP. Navigate to the BMP root folder type “make” to build the libraries and the firmware.

NOTE: The last step will build all the libOpenCM3 libraries as well as BMP, this takes a while and if you wish you may simply build the STM32F1 library and then BMP separately. Navigate to the “libopencm3/lib/stm32/f1” folder, and execute “make clean” and then “make PREFIX=arm-none-eabi-“. This will build the “libopencm3_stm32f1.a” library. To build the BMP firmware navigate to the BMP root folder and then into “src”, type “make” and the BMP firmware will be built.


I tried to keep careful notes as I refined this process and also to test which tools are required. Unfortunately, as I am sure you know, when you are deep in a development cycle it is hard to always makes notes. Sometimes we just have to fix a problem and move on. So, if you find and problems using this process please let me know by using the contact form on this site.

The BMP repository also includes a couple of pc-based versions of BMP, one uses an FTDI interface to the target system and the other is a tool for developing and debugging additions to the BMP itself. A future blog (already in progress) will describe how to build these powerful tools.

I will try to get the second part of this blog describing setting up VSCode online as soon as work allows … happy coding.