-
-
Notifications
You must be signed in to change notification settings - Fork 343
Build Instructions under Windows 10 (MSYS2)
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
- Building firmware and binaries with a prepared script
- Building firmware and binaries manually
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).
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.
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:
To make setting up the build environment as easy as possible, we created couple of shell scripts that include all the necessary commands. In the next steps, we download them one by one, make them executable and run them. Active Internet connection is required for the script to be able to download the required packages for installation.
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. Enter the following 3 lines, each line at a time:
wget -N https://raw.githubusercontent.com/EdgeTX/edgetx/main/tools/setup_buildenv_msys2_stage1.sh
chmod a+x setup_buildenv_msys2_stage1.sh
./setup_buildenv_msys2_stage1.sh
If you are interested to see what the script does or which functions it calls, you can open it in a text editor and have look at it - it's pretty self-explanatory. You can alternatively start the script with --pause argument to stop the script execution after each step to better inspect the output. To achieve this, issue ./setup_buildenv_msys2_stage1.sh --pause
as the last command in the above list instead.
After a while, the first stage of the installation in violet MSYS console should finish (this can take some minutes):
Close the MSYS2 MSYS terminal by entering exit
or pressing Ctrl+D.
Start via Start menu the MSYS2 MinGW 64-bit
(blue icon). Enter the following 3 lines, each line at a time:
wget -N https://raw.githubusercontent.com/EdgeTX/edgetx/main/tools/setup_buildenv_msys2_stage2.sh
chmod a+x setup_buildenv_msys2_stage2.sh
./setup_buildenv_msys2_stage2.sh
The installation can take many minutes, depending on your Internet and PC speed. When finished, you should be greeted with a bash prompt again:
Close the terminal with Ctrl+D again. This concludes the build setup preparations.
If you wish to learn the steps of how to manually create radio firmware and binaries, skip to the next section. In this section you are presented with a shell script that will automatically fetch the latest EdgeTX source tree from GitHub, configure the build for TX16S radio, build firmware and Companion installer that includes also the TX16S simulation library, all in one go. Active Internet connection is required for the script to be able to download the required files.
Start a new instance of MSYS2 MinGW 64-bit
(blue icon). A new terminal window should pop up. Enter the following 3 lines, each line at a time:
wget -N https://raw.githubusercontent.com/EdgeTX/edgetx/main/tools/msys2_fetch_and_build_all.sh
chmod a+x msys2_fetch_and_build_all.sh
./msys2_fetch_and_build_all.sh
If you are interested to see what the script does or which functions it calls, you can open it in a text editor and have look at it - it's pretty self-explanatory. You can alternatively start the script with --pause argument to stop the script execution after each step to better inspect the output. To achieve this, issue ./msys2_fetch_and_build_all.sh --pause
as the last command in the above list instead.
The execution typically takes numerous minutes, depending on your Internet and moreover your PC speed for building the firmware and binaries. When finished, you should see similar screen:
If all went smoothly, you should find firmware binary for TX16S under C:\msys64\home\<your_username>\edgetx\edgetx_main\build-output
and Companion installer under C:\msys64\home\<your_username>\edgetx\edgetx_main\build-output\companion
Start a new instance of MSYS2 MinGW 64-bit
(blue icon).
If you skipped the semi-automatic build step above, then we will first need to 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" -Wno-dev -DCMAKE_PREFIX_PATH=$HOME/5.12.9/mingw73_64 -DSDL_LIBRARY_PATH=/mingw64/bin/ -LAH ../ > ~/edgetx/edgetx_main-cmake-options.txt
From EdgeTX 2.9 onwards, a change to SDL2 was made and you will need to use instead:
cmake -G "MSYS Makefiles" -Wno-dev -DCMAKE_PREFIX_PATH=$HOME/5.12.9/mingw73_64 -DSDL2_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), include Lua mixer script support (LUA_MIXER=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" -Wno-dev -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 -DLUA_MIXER=YES -DCMAKE_BUILD_TYPE=Release ../
From EdgeTX 2.9 onwards, a change to SDL2 was made and you will need to use instead:
cmake -G "MSYS Makefiles" -Wno-dev -DCMAKE_PREFIX_PATH=$HOME/5.12.9/mingw73_64 -DSDL2_LIBRARY_PATH=/mingw64/bin/ -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DLUA_MIXER=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
Starting with 2.8, incl. the main development branch, an additional step is required. Issue:
make configure
Alternatively, you can issue make arm-none-eabi-configure
if you only want to build radio firmware or make native-configure
if you only want to build targets meant to be run on computer (running make configure
activates both architecture targets).
Only a few seconds later, you should be greeted with "-- Generating done" message.
This command generates the makefiles that are required in the next steps to build the so called targets.
To build firmware target, issue:
make -C arm-none-eabi -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\arm-none-eabi
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 arm-none-eabi\firmware.bin fw_edgetx_main_tx16s_lua-ppmus-mode2_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.
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):
To build radio simulator library, issue in the same terminal as opened previously:
make -C native -j`nproc` libsimulator
If you want to build simulator libraries for other radio targets, just re-run the CMake line, make native-configure
and make -C native libsimulator
command from this section.
From EdgeTX 2.10 onwards, Companion only incorporates radio hardware definitions for radio simulator libraries built in Step 1.
To build Companion binary, issue in the same terminal as opened previously:
make -C native -j`nproc` companion
This can take a while to build.
From EdgeTX 2.10 onwards, Simulator only incorporates radio hardware definitions for radio simulator libraries built in Step 1.
To build Simulator binary, issue in the same terminal as opened previously:
make -C native -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.
To create an installer, issue:
make -C native installer
This creates under build directory native\companion
subfolder binary companion-windows-<version>.exe
. Thus, in C:\msys64\home\<username>\edgetx\edgetx_main\build-output\native\companion
, you can find an installer that you can use to install EdgeTX Companion on your system.
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:
Getting started with Git
- Workflow for GitHub noobs
Building and debugging EdgeTX
- In a webbrowser with Gitpod
- Windows 10 (MSYS2)
- Docker with Windows 10
- Ubuntu in a WSL2 under Win10
- Ubuntu 20.04
- MacOS 10.15
- Qt Creator IDE
- In Circuit Debugging radio firmware
Modifications:
- Flysky Hall Sticks Mod
How to unbrick your radio with STM32CubeProgrammer
DMA mappings of radios:
- RadioMaster TX16S
- FlySky NV14
Interrupt usage of radios:
- RadioMaster TX16S
Deprecated:
- Windows 10 (Visual C++)