Thread Tools
This thread is privately moderated by Risto, who may elect to delete unwanted replies.
May 14, 2021, 07:22 AM
4c 6f 76 65 20 52 2f 43
Risto's Avatar
Thread OP
Mini-HowTo

Blog #20: Step-by-step guide to building EdgeTX firmware under 64-bit Windows 10


Here you can find a step-by-step guide to building EdgeTX firmware for your radio under Microsoft Windows 10. If you prefer Linux as your operating system of choice, then please see my blog post #19 for the same instructions, but targeting Ubuntu Linux.



In the first half of this blog entry, I show how to setup the build environment and the second half lists the necessary steps to build EdgeTX firmware.

After following the steps here, if you are interested to learn how to setup a graphical development environment for coding and debugging, please see my blog post #4, showing how to setup Qt Creator and how to perform real-time in-circuit debugging with it on code running on radio microcontroller.

The steps in this guide are tested using Microsoft Windows 10 in Version 21H1 64-bit edition.



Disclaimer: I have assembled this guide to the best of my knowledge, but keep in mind that this is NOT the official guide of how to build EdgeTX (Docker is, see here). In short - if you run into problems, please consider first that it might stem from the steps here, especially before opening an issue in EdgeTX GitHub.

1. Setting up the build environment for EdgeTX v2.4

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).

1.1. Download and install Visual Studio 2019 Community Edition
https://visualstudio.microsoft.com/downloads/
If you already have a commercial version of Visual Studio 2019, then naturally you can continue using it, no need to downgrade to the community edition.

During installation, select under Workloads Desktop development with C++, click Install.



While waiting for the software to download and install, you can deselect Start after installation:



When you reach Installation succeeded!, you can close Visual Studio Installer:



1.2. Install Qt, including the Visual Studio tools and MinGW
1.2.1. Download the Qt Online Installer from https://www.qt.io/download-qt-installer
1.2.2. Note that you need a Qt Account, which you can create using Sign up link in the installer:



1.2.3. Install into default location C:\Qt and choose Custom installation



1.2.4. Select LTS, deselect Latest releases and Preview. Click Filter. Click Deselect All.
1.2.5. Expand Qt, expand the latest version (the top item, at the time of writing Qt 5.15.2) and select MSVC 2019 32-bit



1.2.6. Scroll to the bottom, expand Developer and Designer Tools and select Qt Creator 4.14.1 CDB Debugger Support and MinGW 8.1.0 32-bit



CDB debugger support is not required for building, it is necessary only, if you plan at a later stage to debug companion, simulator or libsimulator in Qt Creator.

1.2.7. Click Next > to install the selected tools
1.2.8. Wait for the installer to finish (can take some minutes), no need to launch the Qt Creator at this point (deselect Launch Qt Creator). Click Finish
1.2.9. After the installation has finished, we need to add two Qt folders to the system Path environment variable.
Click Start -> Settings -> System -> About -> Advanced system settings -> Environment Variables....
Under bottom half System variables list, search for Path, select it and click Edit.... Add following two lines (Tip: click New):
Code:
C:\Qt\Tools\mingw810_32\bin
C:\Qt\Tools\QtCreator\bin


Click OK, click OK again for the Environment Variables dialog and once more OK for the System Properties dialog.
1.2.10. Copy C:\Qt\Tools\QtCreator\bin\libclang.dll to C:\Windows\System32

1.3. Download and Install CMAKE
https://cmake.org/download/
Choose the latest Release (not Release Candidate) Windows x64 Installer (at the time of writing v3.19.6) . During the installation check the option to add CMake to the system path for all users.



1.4. Python 2
Python 2 (32-bit) is required for in-circuit-debugging of code running on the microcontroller in the radio (background info: to run arm-none-eabi-gdb-py.exe that gets executed from Qt Creator in a debugging session).
As Python 2 should not be installed in a system where Python 3 is already installed (other way around is OK), we need to decide at this moment while anticipating our future desire of doing in-circuit-debugging. If you are confident of not planning to do any in-circuit debugging, feel free to skip this step and continue to Python 3 installation. On the other hand if you are not 100% sure, there is no further harm of continuing here, other than sacrificing some hard drive space for Python 2 installation.

Download and install latest Python 2 x86 (w/o -64 in the name!) from https://www.python.org/downloads/windows/
Pick to install for all users:



The default location C:\Python27 should be left as is:



Select to add python.exe to Path:



1.5. Python 3
Download and install the latest Python 3 Release using 64-bit Windows installer (64-bit Python 3 is required for compiling):
https://www.python.org/downloads/windows/
Select Add Python 3.9 to PATH and click Customize installation.



In the Optional Features dialog, all check boxes should be checked, click Next.



Check Install for all users in the Advanced Options dialog and verify that the installation location changed to C:\Program Files\Python..., then click Install:



Wait for the installation to finish (might take a minute or two). In the Setup was successful dialog, click Disable path length limit and then click Close:



1.6. Install required Python packages with PIP
Click Start, type cmd and right click Command Prompt icon. Choose Run as administrator. Enter in administrative command prompt:
Code:
python -m pip install --upgrade pip
pip install pillow clang pyqt5 lxml future


Close the administrative Command Prompt.

1.7. Download POSIX thread libraries
ftp://sourceware.org/pub/pthreads-wi...-0-release.exe
Create a folder C:\Programs (not to confuse with existing C:\Program Files or C:\Program Files (x86)!)
Extract the 3 sub-folders from this archive, e.g. using 7-Zip into C:\Programs\pthreads



1.8. GNU Arm Embedded Toolchain v10 2020-q4
Download the GNU Arm Embedded Toolchain 10-2020-q4-major and install it to default location.
In the last dialog of the GNU Arm Embedded Toolchain installer, deselect Show Readme and Launch gccvar.bat and click Finish:



1.9. Install SDL v1.2.15 Development Library
Download the v1.2.15 development library for Visual C++ from http://www.libsdl.org/release/SDL-devel-1.2.15-VC.zip
Unzip it, rename the top level folder in it to SDL (remove version from folder name) and move it under C:\Programs as C:\Programs\SDL



This concludes the build setup preparations. You might want to reboot the PC at this point.

2. Building EdgeTX v2.4 firmware

Create first a folder C:\edgetx to put the various EdgeTX flavors in the sub-directories there to have a tidy files and folder hierarchy.

Either download or git clone (recursively) EdgeTX GitHub repository to C:\edgetx\edgetx24
https://github.com/EdgeTX/edgetx/

I will use RadioMaster TX16S as an example target here, but the steps are applicable to other radios as well, you just need to select another build target in the CMAKEOPTIONS by specifying appropriate 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 here: https://github.com/EdgeTX/edgetx/tree/2.4/tools

Create a batch file make_edgetx24_fw.bat with following content or download it from the attachment at the bottom of this page, unzip it and put it in C:\edgetx

Code:
@ECHO OFF
REM Path where the firmware will be built
SET BUILDPATH=C:\edgetx\build-edgetx24

REM Path where the OpenTX source can be found
SET SRCPATH=C:\edgetx\edgetx24

REM Path where the Qt compiler tools can be found
SET QTPATH=C:\Qt\5.15.2

REM Firmware build options
SET CMAKEOPTIONS=-DDISABLE_COMPANION=YES -DPCB=X10 -DPCBREV=TX16S -DINTERNAL_MODULE_MULTI=YES -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DHELI=NO -DLUA=YES -DINTERNAL_GPS=YES -DCMAKE_BUILD_TYPE=Release

REM Clean or create folder
if exist %BUILDPATH%\ (
	DEL /F/Q/S "%BUILDPATH%" > NUL
	RMDIR /Q/S "%BUILDPATH%"
) else (
	REM Make the Firmware build folder
	MKDIR %BUILDPATH%
)

REM Include GNU ARM Toolchain in the path
SET PATH=%PATH%;C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\bin
SET C_INCLUDE_PATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\arm-none-eabi\include
SET CPLUS_INCLUDE_PATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\arm-none-eabi\include\c++\10.2.1;C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\arm-none-eabi\include\c++\10.2.1\arm-none-eabi

REM Configure the build
cmake -G "MinGW Makefiles" -S %SRCPATH% -B %BUILDPATH% -DCMAKE_PREFIX_PATH=%QTPATH%\msvc2019 %CMAKEOPTIONS%

REM Build the firmware, using the maximum number of cores
mingw32-make -C %BUILDPATH% -j %NUMBER_OF_PROCESSORS% firmware

REM Change to output directory
CD %BUILDPATH%
The example above builds firmware for RadioMaster TX16S (adjust options PCB and PCBREV accordingly to build for other radio) and uses:
  • internal multi-module (INTERNAL_MODULE_MULTI=YES),
  • mode 2 default stick assignment (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)

Open Command Prompt, navigate to C:\edgetx and start the batch-file. After some minutes, and assuming everything succeeded, you should have a firmware.bin under C:\edgetx\build-edgetx24 that you can flash to your radio.

It's good idea to rename the bootloader and firmware binaries, so that it is easier later to see the target radio and which options were baked into it.
Rename bootloader.bin e.g. to edgetx-v2.4_tx16s_lua-ppmus-mode2-gps_release_bl.bin
and fimware.bin e.g. to edgetx-v2.4_tx16s_lua-ppmus-mode2-gps_release_fw.bin

For now, use the latest OpenTX Companion software for flashing, deselect in Flash Firmware dialog the Check Hardware compatibility flag. You can also use e.g. STM32CubeProgrammer instead. On the long run, plans are afoot to create own EdgeTX Flasher.

Prepare a clean microSD card and fill it with the content that you can download according to your radio from https://github.com/EdgeTX/edgetx-sdc...ses/tag/latest
The following page helps you to choose the correct zip-file: https://github.com/EdgeTX/edgetx-sdcard

Please be aware that presently EdgeTX is a very early developer version, not even an alpha-build. Thus expect issues, and most certainly do not go out to fly with it!

You can continue reading about enhanced RadioMaster TX16S roller board in my blog post #21 or return to the index of my blog posts.

Appendix
References
Repositories used in this post
Attachments
Last edited by Risto; Jun 19, 2021 at 03:58 AM.
Sign up now
to remove ads between posts


Quick Reply
Message:
Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Question Canít post video from my phone to my blog xrx1113 Site Suggestions / Complaints 1 May 22, 2020 06:38 AM
Video Bumblebee DLG Overview (for Geode's Blog) Geode Sailplane Talk 0 Feb 25, 2007 11:22 AM