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

Blog #19: Step-by-step guide to building (custom) EdgeTX firmware under Ubuntu Linux


Here's a short step-by-step guide to building EdgeTX firmware for your radio using Ubuntu Linux. EdgeTX is a version of OpenTX, concentrating on new cutting edge developments.



In the first half of this blog entry, I show how to setup the build environment and the second lists the necessary steps to build EdgeTX firmware. I provide two examples - first for vanilla EdgeTX and second for OlliW MAVLink enhanced EdgeTX. In the examples, I use RadioMaster TX16S, but the steps are applicable to other radios as well, you just need to select another build target in the cmake line (more on that below).

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 #2, showing how to setup Qt Creator and how to perform real-time in-circuit debugging with it on code running on radio microcontroller.

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.



You will need Ubuntu Linux in version 20.04. The steps will also work when Ubuntu is running virtualized, such as on a VMware Workstation, VirtualBox or Hyper-V.

1. Setting up the build environment for EdgeTX v2.4
  • Download Ubuntu 20.04 LTS and install it (using Minimal installation type is sufficient. Allow Download updates while installing Ubuntu, 3rd party software is not required, unless you need this for graphics or WiFi adapter on your PC).
  • When the installer has finished and the obligatory reboot is done, log in. Install updates using Software Updater (click Activities in top left corner, type in Software Updater and press Enter). Restart the PC and log in again after reboot.
  • I tried to make the following step as easy as possible, so created a shell script that includes all the necessary commands and put it up on EdgeTX GitHub. You just need to download it, make it executable and run it. As it was accepted in the official EdgeTX GitHub repo, I assume it is not that bad. Active Internet connection is required for the script to be able to download required packages for installation. Below are the three lines to achieve all this. Start, by opening a terminal window (click Activities in top left corner, type terminal and press Enter). Enter following 3 lines, each line at a time and enter your password (with sudo rights) if asked (note that here in RCGroups, according to your browser window width, the first line might be displayed on your screen in two lines - you need to enter it in one line in terminal in Ubuntu):
    Code:
    wget https://raw.githubusercontent.com/EdgeTX/edgetx/2.4/tools/setup_buildenv_ubuntu20.04.sh
    
    chmod a+x setup_buildenv_ubuntu20.04.sh
    
    ./setup_buildenv_ubuntu20.04.sh
  • If all went smoothly, you should not have seen any errors.
If you are interested to see what the script does or which functions it calls, just open it in a text editor (gedit for example in Ubuntu is a text editor with syntax highlighting) 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_ubuntu20.04.sh --pause as the last command in the above list instead.

I recommend to reboot the PC before continuing to next steps. This concludes the build setup preparations.

2. Building EdgeTX v2.4 firmware

I will give two example builds for RadioMaster TX16S - first, the vanilla (meaning standard/common/unaltered) EdgeTX v2.4 build and second the OlliW MAVLink enhanced EdgeTX build. If you use different radio, feel free to adjust the cmake PCB and optionally PCBREV tags according to your radio.

Lets first create a folder called edgetx in the home directory of the current user to have a container for future various EdgeTX flavors in the sub-directories there, to have a tidy files and folder hierarchy.

In the terminal window, issue the following commands, one at a time:
Code:
mkdir ~/edgetx

cd ~/edgetx
Let's start with the:
2.1. Vanilla EdgeTX

Issue, again in the same terminal window, the following commands, one at a time:
Code:
git clone --recursive -b 2.4 https://github.com/EdgeTX/edgetx.git edgetx-v2.4

cd edgetx-v2.4

export PATH="~/edgetx/edgetx-v2.4/radio/util:$PATH"

mkdir build-tx16s

cd build-tx16s
Next, we need to select what options we want our build to include or not to include. Issue:
Code:
cmake -LH ../ > ~/Desktop/edgetx-v2.4-cmake-options.txt
to create a text file with all options, including a brief description. The text file is put on current user's desktop. Double click to open it in a text editor and have a look at the possibilities.

As an example, I have chosen to build 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):
Code:
cmake -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DHELI=NO -DLUA=YES -DINTERNAL_GPS=YES -DCMAKE_BUILD_TYPE=Release ../
This generates the makefile that is required in the next step to build the firmware. For this, issue:
Code:
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, the binary, that you can flash into your radio is called firmware.bin in the current folder.

It's a good idea to rename the firmware binary, 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.:
Code:
mv firmware.bin edgetx-v2.4_tx16s_lua-ppmus-mode2-gps_release.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

Ignore for now the FrSky radio image, shown in the calibration screen, also on other radios, such as TX16S.

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!

2.2. OlliW EdgeTX fork

As of today (May 17th, 2021), building OlliW EdgeTX fork has gotten a lot easier and it resembles almost the vanilla EdgeTX build. Just add -DTELEMETRY_MAVLINK=YES in CMake line. For completeness sake, I will include here all steps though from the start:

Open a new terminal window, and issue:
Code:
cd ~/edgetx

git clone --recursive -b owpr-mavtelem3 https://github.com/olliw42/edgetx.git olliw-mavtelem

cd olliw-mavtelem

export PATH="~/edgetx/olliw-mavtelem/radio/util:$PATH"

mkdir build-tx16s

cd build-tx16s
Next, we need to select what options we want our build to include or not to include. Issue:
Code:
cmake -LH ../ > ~/Desktop/olliw-mavtelem-cmake-options.txt
to create a text file with all options, including a brief description. The text file is put on current user's desktop. Double click to open it in a text editor and have a look at the possibilities.

As an example, I have chosen to build 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 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). As we are here building OlliW flavor, we do not want to miss the MAVLink extensions, thus we include them with TELEMETRY_MAVLINK=YES. The cmake command would thus be (issue without line breaks and be sure to include at the end the two dots and a slash exactly as listed here):
Code:
cmake -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DLUA=YES -DINTERNAL_GPS=YES -DTELEMETRY_MAVLINK=YES -DCMAKE_BUILD_TYPE=Release ../
To build the firmware, issue:
Code:
make -j`nproc` firmware
This process can take some minutes to complete. If successful, the binary, that you can flash into your radio is called firmware.bin in the current folder.

It's good idea to rename the firmware binary, so that it is easier later to see the target radio and which options were baked into it. For this, issue e.g.:
Code:
mv firmware.bin edgetx-tx16s-lua-ppmus-mode2-mavlink-en-olliw-mavtelem_release.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 git cloned under:
Code:
~/edgetx/olliw-mavtelem/radio/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 how to build EdgeTX firmware under Windows 10 in my blog post #20 or return to the index of my blog posts.

Appendix
References
Repositories used in this post
Last edited by Risto; Jun 12, 2021 at 01:28 PM.
Sign up now
to remove ads between posts
May 23, 2021, 12:17 PM
Registered User
Very good HowTo!!! Thanks!


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