Skip to content

Build Instructions under Windows 10 (MSYS2)

Risto edited this page Oct 18, 2021 · 67 revisions

The document here is meant to help you develop or test changes to EdgeTX on your PC, not to build flight/radio safe version of binaries.


Setting up the build environment for EdgeTX

The following assumes, you have a fresh installation of 64-bit Windows 10 with all updates installed (tested with English version 21H1 at the time of writing).

Download and install Visual C++ Redistributable

As a preliminary step, we need Visual C++ Redistributable for Visual Studio 2013 installed. You can fetch it directly from Microsoft: https://www.microsoft.com/en-us/download/details.aspx?id=40784

Pick the vcredist_x64.exe to download (you can click on the images to open them bigger):

Install the downloaded file with administrative credentials.

Download and install the MSYS2

https://www.msys2.org/

Install Minimal SYStem 2 (MSYS2), using non-administrative account, to default location C:\msys64.

During installation, accept the default settings and allow at the end of the installation MSYS to be run.

In the MSYS window, that opened, enter the following line to update MSYS2 package manager database plus base packages and then press Enter:

pacman -Syu

Note the capital S in the command parameters!

When asked to proceed, with the installation, enter capital Y and press Enter:

After the package database and base packages are updated, confirm, again by entering capital Y + Enter that the window is being closed next:

From the Windows Start menu, look for MSYS2 64bit and open from that folder MSYS2 MSYS (violet icon). A new terminal window should pop up. Here we update the remaining base packages with:

pacman -Su

Similarly to above, when asked to proceed, with the installation, enter capital Y and press Enter:

After a while, the updates should finish:

Issue:

pacman -S --noconfirm git make mingw-w64-x86_64-toolchain

and wait for the installation to finish (this can take some minutes).

Close the MSYS2 MSYS terminal by entering exit or pressing Ctrl+D.

Prepare the MSYS2 MinGW build environment for EdgeTX

Start via Start menu the MSYS2 MinGW 64-bit (blue icon). Enter the following command, all in a single line and press Enter:

pacman -S --noconfirm mingw-w64-x86_64-cmake mingw-w64-x86_64-python-pip mingw-w64-x86_64-arm-none-eabi-gcc mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-zlib mingw-w64-x86_64-libtiff mingw-w64-x86_64-freetype mingw-w64-x86_64-lcms2 mingw-w64-x86_64-libwebp mingw-w64-x86_64-openjpeg2 mingw-w64-x86_64-libimagequant mingw-w64-x86_64-libraqm mingw-w64-x86_64-SDL mingw-w64-x86_64-nsis mingw-w64-x86_64-clang

The installation can take many minutes, depending on your Internet and PC speed. When finished, you should be greeted with a bash prompt again:

Install first the Python wheel packaging standard using pip. Enter:

pip install wheel

Next install the required Python packages (do not combine this line with the wheel installation above on a single line. wheel should be installed first):

pip install pillow==7.2.0 clang==6.0.0 pyppmd==0.16.1 aqtinstall

After the installation finishes, issue:

aqt install-qt windows desktop 5.12.9 win64_mingw73

Wait for the installation to finish. Close the terminal with Ctrl+D again. This concludes the build setup preparations.

Building firmware and binaries

Start a new instance of MSYS2 MinGW 64-bit (blue icon).

We will first create a folder edgetx in the current user home to put the various EdgeTX flavors in the sub-directories there to have a tidy files and folder hierarchy. Enter the following command:

mkdir edgetx && cd ~/edgetx

We will next fetch the EdgeTX source files from the GitHub main development branch into local subfolder /edgetx/edgetx_main in current user home and prepare a build output directory. Issue, in the same terminal window as above, the following commands, one at a time:

git clone --recursive -b main https://github.com/EdgeTX/edgetx.git edgetx_main
cd edgetx_main && mkdir build-output && cd build-output

To build EdgeTX, we need to minimally specify the radio target, but can further select or de-select a number of build-time options. The following command will create a text-file list of all options for you to look at and saves it in current user home directory:

cmake -G "MSYS Makefiles" -DCMAKE_PREFIX_PATH=$HOME/5.12.9/mingw73_64 -DSDL_LIBRARY_PATH=/mingw64/bin/ -LAH ../ > ~/edgetx/edgetx_main-cmake-options.txt

You can use any text editor, even Notepad w/o better alternative, to view the file. On your Windows system it is saved inside your MSYS2 installation to: C:\msys64\home\<username>\edgetx.

As an example, we will build next for RadioMaster TX16S (PCB=X10, PCBREV=TX16S), mode 2 default stick (DEFAULT_MODE=2), global variables enabled (GVARS=YES), servo output unit as microseconds (PPM_UNIT=US), opted to save memory and build without helicopter mixes (HELI=NO), include Lua scripting support (LUA=YES), include support for NMEA GPS connected to AUX2 (INTERNAL_GPS=YES) and selected the type as a Release build without debug symbols included (CMAKE_BUILD_TYPE=Release). The CMake command for this is (issue the following without line breaks and be sure to include at the end the two dots and a slash exactly as here listed):

cmake -G "MSYS Makefiles" -DCMAKE_PREFIX_PATH=$HOME/5.12.9/mingw73_64 -DSDL_LIBRARY_PATH=/mingw64/bin/ -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DHELI=NO -DLUA=YES -DINTERNAL_GPS=YES -DCMAKE_BUILD_TYPE=Release ../

Do note that the installer packaging at the end of the page, only works when built without the debug symbols. Be sure not to forget the ../ at the end of the line to specify that the main CMakeLists.txt can be found one folder up!

To build for other radios, you just need to select another build target by specifying appropriate values for PCB and PCBREV for your radio. As a tip, which values to use, have a look at a Python script according to your radio manufacturer in a file named build-<radio-manufacturer>.py under https://github.com/EdgeTX/edgetx/tree/main/tools

The CMake generates the makefile that is required in the next steps to build the so called targets.

Building firmware for the radio

To build firmware target, issue:

make -j`nproc` firmware

This process can take some minutes to complete (the parameter -j'nproc' instructs the make to use as many parallel threads as the current system has CPU cores. This speeds up the build quite significantly). If successful, you should find firmware.bin binary in the C:\msys64\home\<username>\edgetx\edgetx_main\build-output folder that you can flash to your TX16S.

It's a good idea to rename the binaries, so that it is easier later to see the target radio and which options were baked into it. For this, issue in the build folder, e.g.:

mv firmware.bin fw_edgetx_main_tx16s_lua-ppmus-mode2-gps_release.bin

See EdgeTX User Wiki for numerous ways to flash the binary to your radio. Do not forget, that you will need to prepare a EdgeTX microSD card and fill it with the content according to your radio type from https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest

The following page lists which zip file you need: https://github.com/EdgeTX/edgetx-sdcard

You can also use EdgeTX Flasher to help you to create the SD card content.

Building Windows programs

Step 1 - Building EdgeTX Companion binary

To build Companion binary, issue in the same terminal as opened previously:

make -j`nproc` companion

This can take a while to build.

Step 2 - Building full simulator binary

To build simulator binary, issue in the same terminal as opened previously:

make -j`nproc` simulator

If you just built Companion in a previous step, then this will be quite quick process, otherwise it might make some time.

Step 3 - Building radio simulator library

The CMake line above determines for which radio the library is being built. As we specified TX16S (-DPCB=X10 -DPCBREV=TX16S above), the next command will build TX16S dynamic-link-library (DLL):

make -j`nproc` libsimulator

If you want to build simulator libraries for other radio targets, just re-run the CMake line and make libsimulator command from this section.

Step 4 - Creating an installer

To create an installer, issue:

make installer

This creates under build directory companion subfolder binary companion-windows-2.6.0.exe. Thus, in C:\msys64\home\<username>\edgetx\edgetx_main\build-output\companion, an installer that you can use to install EdgeTX Companion on your system.

Step 5 - Enjoy the end result

After you have run the installation, you can enjoy EdgeTX Windows binaries. Here Companion:

In order to run simulator, you need to first create a radio profile with Companion! Also, you will have a better user experience, if you copy the SD card content according to your radio target from https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest to your system and extract it e.g. to C:\ProgramData\EdgeTX\simu_sdcard\horus (here for Horus-class radios). If you wish to experiment with sounds, grab a sound pack according to your locale also from https://github.com/EdgeTX/edgetx-sdcard-sounds/releases and integrate it into the sdcard folder.

You can select the SD path during simulator startup:

And here, the EdgeTX full simulator in action:

Clone this wiki locally