Sync edgetx to Gitea

This commit is contained in:
2026-08-03 16:37:20 +08:00
commit 14eb5a3fb9
5364 changed files with 2835009 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
# Building in a Web Browser with GitHub CodeSpaces
An easy option to build EdgeTX radio firmwares without having to set up a local build environment on your own computer, is provided by GitHub CodeSpaces. The only requirement is that you have an account at [GitHub](https://github.com/).
# Preparation
To start building EdgeTX firmware for your radio, open the following link with the web browser of your choice:
https://codespaces.new/EdgeTX/edgetx
and you should be greeted with a screen similar to the following. If you don't want to build from the main development branch (i.e. you want to build a from a stable release), you can change to a different branch, i.e. 2.11 (at 1). If you want builds to run faster, you can also change the machine type to one with more CPUs and RAM (at 2), but please note this will reduce the amount of free time you have for using GitHub Codespaces (120 hrs per month for 2 CPU machine).
<img width="820" height="590" alt="image" src="https://github.com/user-attachments/assets/d1954cbe-e1cc-4180-a362-ae3a4acf2d77" />
After a brief wait, you should be greeted with a Visual Studio Code like development environment in a browser with EdgeTX source code tree preloaded from GitHub. It may still take a few minutes to load the first time, as it prepares the build environment. You should see something similar to this at the bottom right while this is underway:
<img width="477" height="86" alt="image" src="https://github.com/user-attachments/assets/1f33760d-8bb6-4536-8e2b-399192ec5c53" />
Once it has completed, you should have a screen similar to this. The file browser (at 1) of the left will let you navigate the file system, and also download your compiled firmware (as described later). The buttons at the top right (at 2) let you turn the various side panels on and off - I would suggest you turn off the right sidebar as it is just cluttering the place. The section at the bottom (at 3) is the terminal, which you will need in order to run the various compile commands that follow.
<img width="800" alt="image" src="https://github.com/user-attachments/assets/08254aa5-297d-49a1-9d61-4c8621bc17f9" />
As part of preparing the build environment, it should have initialised all the submodules needed to build the firmware for you. If for some reason this hasn't happened, run `git submodule update --init --recursive` at the terminal.
# Building firmware
Firstly, change to (and create if it does not exist) a build directory:
```
mkdir -p build && cd build
```
The next step is to tell the development system for which radio and with which configuration option you would like the firmware to be built. You do this by entering a _cmake_ command in the terminal section of the Visual Studio Code window (bottom right pane; feel free to close all the popups if they come on top). Here for example:
```
cmake -Wno-dev -DPCB=X10 -DPCBREV=TX16S -DBLUETOOTH=YES -DCMAKE_BUILD_TYPE=Release ../
```
we instruct the CMake system to create makefiles for building for the RadioMaster TX16S (PCB=X10, PCBREV=TX16S), enable Bluetooth support (BLUETOOTH=YES) and selected the type as a Release build without debug symbols included (CMAKE_BUILD_TYPE=Release).
(If you are curious about the options available, enter the following command in terminal to list all options: `cmake -LAH ../` )
Next, issue:
```
cmake --build . --target arm-none-eabi-configure --parallel 2
```
!!! note
The `--parallel 2` in the command above instructs the cmake build system as to how many tasks to execute in parallel. Typically, you would set this to the number of CPU cores your machine has. So if you are using a higher CPU core count GitHub machine type, you can increase this to suit, and get a faster build.
Only a few seconds later, you should be greeted with "-- Generating done" message.
If so, enter again in terminal the following line to start the compilation and linking step and press Enter:
```
cmake --build arm-none-eabi --target firmware
```
This time it can take few minutes so until the firmware binary is successfully built. If you see "[100%] Built target firmware" then all went smoothly, and you have just made yourself a custom EdgeTX firmware. If you are making incremental modifications to the firmware, subsequent firmware builds will be a lot faster.
!!! tip
If you want more information about the firmware binary - such as how big the firmware is in relation to the FLASH memory the target handset has, you can compile the `firmware-size` target instead of firmware, and you'll get a summary at the end of the firmware build.
It's a good idea to rename the binary, so that it is easier later to see the target radio and which options were baked into it. For this, issue in the terminal:
```
cd arm-none-eabi
mv firmware.bin edgetx_main_tx16s_bt_release.bin
```
In the left file browser tree open the **build** folder and then open **arm-none-eabi** folder. Right click at _edgetx_main_tx16s_bt_release.bin_ and select Download.
Put the downloaded firmware binary into your radio SD card \FIRMWARE subfolder, and flash it to your radio either using EdgeTX bootloader, [EdgeTX Buddy](https://buddy.edgetx.org/), EdgeTX Companion or [STM32CubeProgrammer](../troubleshooting/unbrick.md).
Use [EdgeTX Buddy](https://buddy.edgetx.org/) or EdgeTX Companion to fill your SD card appropriately for your radio.
+257
View File
@@ -0,0 +1,257 @@
# Compilation Options
This page documents the CMake options available when building EdgeTX firmware. Most options have sensible defaults set by the target's CMakeLists.txt — you only need to override them when you have a specific reason to.
## Target Selection
These are the most important options to set, as they determine which radio you are building for.
### `PCB`
Selects the radio target.
| Value | Radio |
|-------|-------|
| `X7` | FrSky Taranis Q X7 / X7S and Jumper / RadioMaster variants (see `PCBREV`) |
| `X9LITE` | FrSky Taranis X9 Lite |
| `X9LITES` | FrSky Taranis X9 Lite S |
| `XLITE` | FrSky X-Lite |
| `XLITES` | FrSky X-Lite S |
| `X9D` | FrSky Taranis X9D |
| `X9D+` | FrSky Taranis X9D+ (see `PCBREV`) |
| `X9E` | FrSky Taranis X9E |
| `X10` | FrSky Horus X10 / X10S and RadioMaster / Jumper variants (see `PCBREV`) |
| `X12S` | FrSky Horus X12S |
| `PL18` | Flysky PL18 and variants (see `PCBREV`) |
| `TX15` | RadioMaster TX15 |
| `TX16SMK3` | RadioMaster TX16S Mark III |
| `T15PRO` | Jumper T15 Pro |
| `ST16` | Siyi ST16 |
| `PA01` | FrSky PA01 |
### `PCBREV`
Selects a specific variant within a `PCB` target. Valid values depend on the selected `PCB`:
=== "X7"
| Value | Radio |
|-------|-------|
| `TX12` | RadioMaster TX12 |
| `TX12MK2` | RadioMaster TX12 Mark II |
| `ZORRO` | RadioMaster Zorro |
| `BOXER` | RadioMaster Boxer |
| `MT12` | RadioMaster MT12 |
| `GX12` | RadioMaster GX12 |
| `POCKET` | RadioMaster Pocket |
| `T8` | RadioMaster T8 |
| `COMMANDO8` | RadioMaster Commando 8 |
| `T12` | Jumper T12 |
| `T12MAX` | Jumper T12 Max |
| `TPRO` | Jumper T-Pro |
| `TPROV2` | Jumper T-Pro V2 |
| `TPROS` | Jumper T-Pro S |
| `T14` | Jumper T14 |
| `T20` | Jumper T20 |
| `T20V2` | Jumper T20 V2 |
| `TLITE` | Jumper T-Lite |
| `LR3PRO` | Jumper LR3 Pro |
| `BUMBLEBEE` | Jumper Bumblebee |
| `ACCESS` | FrSky Q X7 Access |
| `V12` | FrSky Q X7 V1.2 |
| `V14` | FrSky Q X7 V1.4 |
=== "X9D+"
| Value | Radio |
|-------|-------|
| `2014` | X9D+ (original, default) |
| `2019` | X9D+ 2019 |
=== "X10"
| Value | Radio |
|-------|-------|
| `STD` | FrSky Horus X10 (default) |
| `EXPRESS` | FrSky Horus X10 Express |
| `T16` | RadioMaster TX16S |
| `TX16S` | RadioMaster TX16S Mark II |
| `F16` | Flyzone F16 |
| `V16` | VolantexRC V16 |
| `T18` | Jumper T18 |
| `T15` | Jumper T15 |
=== "PL18"
| Value | Radio |
|-------|-------|
| `PL18` | Flysky PL18 (default) |
| `PL18EV` | Flysky PL18EV / Paladin EV |
| `PL18U` | Flysky PL18U |
| `EL18` | Flysky EL18 |
| `NV14` | Flysky NV14 |
| `NB4P` | Flysky NB4+ |
### `TRANSLATIONS`
Firmware language. Default: `EN`
Valid values: `CN` `CZ` `DA` `DE` `EN` `ES` `FI` `FR` `HE` `HU` `IT` `JP` `KO` `NL` `PL` `PT` `RU` `SE` `SK` `TW` `UA`
---
## Feature Options
These options enable or disable firmware features. Defaults are typically set by the target, so you only need to override them if you want to add or remove a feature for a specific build.
| Option | Default | Description |
|--------|---------|-------------|
| `AUTOSOURCE` | ON | Automatic source detection in menus |
| `AUTOSWITCH` | ON | Automatic switch detection in menus |
| `BLUETOOTH` | varies | Bluetooth module support |
| `BOOTLOADER` | ON | Include bootloader |
| `CURVES` | ON | Curves support |
| `DANGEROUS_MODULE_FUNCTIONS` | OFF | Enable RangeCheck / Bind / Module OFF functions |
| `DBLKEYS` | ON | Double key shortcuts |
| `DISK_CACHE` | ON | SD card disk cache (color screen targets) |
| `FAI` | OFF | Competition mode — disables telemetry |
| `FLIGHT_MODES` | ON | Flight modes |
| `FLYSKY_GIMBAL` | varies | Flysky serial gimbal support |
| `GVARS` | ON | Global variables |
| `GUI` | ON | GUI |
| `HELI` | ON | Helicopter mixer menu |
| `INTERNAL_GPS` | varies | Internal GPS support |
| `KCX_BTAUDIO` | OFF | KCX BT audio emitter support |
| `LUA` | ON | Lua scripting |
| `LUA_COMPILER` | ON | Pre-compile and cache Lua scripts on the radio |
| `LUA_MIXER` | ON | Lua mixer / model scripts |
| `MODULE_PROTOCOL_D8` | ON | FrSky D8 module protocol |
| `MODULE_PROTOCOL_FCC` | ON | FCC module protocol |
| `MODULE_PROTOCOL_FLEX` | OFF | Non-certified FLEX module protocol |
| `MODULE_PROTOCOL_LBT` | ON | EU / LBT module protocol |
| `MODULE_SIZE_STD` | ON | Standard size external module bay |
| `MULTIMODULE` | ON | DIY Multiprotocol TX Module |
| `OVERRIDE_CHANNEL_FUNCTION` | ON | OverrideChannel function |
| `PPM_CENTER_ADJUSTABLE` | ON | PPM centre adjustable |
| `PPM_LIMITS_SYMETRICAL` | OFF | PPM limits symmetrical |
| `RAS` | ON | RAS (SWR) measurement |
| `SPACEMOUSE` | OFF | SpaceMouse support (Horus only) |
| `TEMPLATES` | OFF | Model templates menu |
| `UNEXPECTED_SHUTDOWN` | ON | Unexpected shutdown warning screen |
| `USB_SERIAL` | ON | USB serial (CDC) |
| `WATCHDOG` | ON | Hardware watchdog |
---
## Hardware Configuration
These string options configure hardware behaviour and are normally set by the target.
### `PWR_BUTTON`
How the power button works. Default is target-specific.
| Value | Description |
|-------|-------------|
| `PRESS` | Momentary press to power on/off (most radios) |
| `SWITCH` | Toggle switch |
### `PPM_UNIT`
PPM display unit. Default is target-specific.
| Value | Description |
|-------|-------------|
| `PERCENT_PREC1` | Percentage with one decimal place (e.g. 100.0%) |
| `PERCENT_PREC0` | Percentage with no decimal places (e.g. 100%) |
| `US` | Microseconds |
### `DEFAULT_MODE`
Default sticks mode. Leave blank to use the firmware default.
| Value | Description |
|-------|-------------|
| `` | Use firmware default |
| `1` | Mode 1 |
| `2` | Mode 2 |
| `3` | Mode 3 |
| `4` | Mode 4 |
### `INTERNAL_GPS_BAUDRATE`
Baud rate for the internal GPS, where supported. Default: `9600`
### `LUA_SCRIPT_LOAD_MODE`
Controls how Lua scripts are loaded and compiled. Leave blank to use the firmware default (`bt` on radio, `T` on simulator/debug builds). Accepts a combination of the following flags:
| Flag | Description |
|------|-------------|
| `b` | Load binary (pre-compiled) scripts |
| `t` | Load text scripts |
| `T` | Pre-compile scripts |
| `x` | Execute on load |
| `c` | Compile only |
| `d` | Decompress |
### `POPUP_LEVEL`
Controls the verbosity of popup notifications. Default: `2` (set to `3` for `FRSKY_RELEASE` builds).
---
## Debug & Tracing
These options are for development and debugging. All default to `OFF`.
| Option | Description |
|--------|-------------|
| `ASTERISK` | Show asterisk icon to identify test-only firmware |
| `DEBUG_SEGGER_RTT` | Route debug output to Segger RTT |
| `DEBUG_WINDOWS` | Trace UI window activity |
| `DEBUG_YAML` | Trace YAML parser activity |
| `DEBUG_LABELS` | Trace label activity |
| `JITTER_MEASURE` | Enable ADC jitter measurement |
| `SEMIHOSTING` | Enable debugger semihosting |
| `TEST_BUILD_WARNING` | Show a warning banner on test builds |
| `TRACE_AUDIO` | Trace audio subsystem |
| `TRACE_LUA_INTERNALS` | Trace Lua VM internals |
| `UI_PERF_MONITOR` | Overlay frame rate and CPU usage on screen |
| `WARNINGS_AS_ERRORS` | Treat compiler warnings as errors (`-Werror`) |
---
## Simulator Options
| Option | Default | Description |
|--------|---------|-------------|
| `SIMU_DISKIO` | OFF | Enable disk I/O simulation using a `sdcard.image` file |
| `SIMU_LUA_COMPILER` | ON | Pre-compile and cache Lua scripts in the simulator |
| `SIMU_TARGET` | ON | Build the simulator target |
| `DISABLE_COMPANION` | OFF | Skip building Companion and simulators |
---
## Release Build Options
These options are used to produce official manufacturer-specific firmware releases and are not needed for general development builds.
| Option | Manufacturer |
|--------|-------------|
| `FRSKY_RELEASE` | FrSky (also sets `POPUP_LEVEL=3`) |
| `IMRC_RELEASE` | IMRC |
| `TBS_RELEASE` | Team BlackSheep |
| `JUMPER_RELEASE` | Jumper |
| `RADIOMASTER_RELEASE` | RadioMaster |
| `RADIOMASTER_RTF_RELEASE` | RadioMaster RTF |
| `IFLIGHT_RELEASE` | iFlight |
| `BETAFPV_RELEASE` | BetaFPV |
---
## Compiler & Build Flags
| Option | Default | Description |
|--------|---------|-------------|
| `OPT` | `s` | Optimisation level (`0`, `1`, `2`, `s`) |
| `FIRMWARE_C_FLAGS` | `` | Additional C compiler flags |
| `FIRMWARE_CXX_FLAGS` | `` | Additional C++ compiler flags |
| `WARNINGS_AS_ERRORS` | OFF | Treat all compiler warnings as errors |
| `VERBOSE_CMAKELISTS` | OFF | Show extra information when processing CMake files |
+9
View File
@@ -0,0 +1,9 @@
# Building EdgeTX
This section contains step-by-step build instructions for every supported platform. Whether you want to build a custom firmware binary, run the EdgeTX simulator, or contribute to development, pick the guide that matches your environment.
## Notes
- 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.
- For a list of all available CMake build options, see [Compilation Options](compilation-options.md).
- For radio-specific build flags (`PCB`, `PCBREV`), refer to the build scripts at [https://github.com/EdgeTX/edgetx/tree/main/tools](https://github.com/EdgeTX/edgetx/tree/main/tools).
+151
View File
@@ -0,0 +1,151 @@
# Build Instructions under Ubuntu 22.04
Last tested with Ubuntu 22.04.5 LTS in March 2026.
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](#setting-up-the-build-environment-for-edgetx)
- [Building EdgeTX firmware for the radio](#building-edgetx-firmware-for-the-radio)
- [Building Companion, Simulator and radio simulator libraries](#building-companion-simulator-and-radio-simulator-libraries)
## Setting up the build environment for EdgeTX
You can setup Ubuntu 22.04 on bare-metal, inside a virtual machine environment, or using WSL2 under Windows 10/11. For WSL2 installation, please see a dedicated page about it: [Setting up Ubuntu in a Windows Subsystem for Linux](linux-wsl.md).
* Download [Ubuntu 22.04](https://ubuntu.com/download/desktop) 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.
* To make setting up the build environment as easy as possible, we created a shell script that includes all the necessary commands. In the next steps, we download it, make it executable and run it. Active Internet connection is required for the script to be able to download the required packages for installation. Start, by opening a terminal window (click _Activities_ in the top left corner, type _terminal_ and press _Enter_). Enter the following 3 lines, each line at a time and enter your password (with sudo rights) if asked:
```
wget https://raw.githubusercontent.com/EdgeTX/edgetx/main/tools/setup_buildenv_ubuntu22.04.sh
```
```
chmod +x setup_buildenv_ubuntu22.04.sh
```
```
./setup_buildenv_ubuntu22.04.sh
```
* If all went smoothly, you should not have seen any errors, and should have been informed that setup was finished.
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 (_gedit_ for example in Ubuntu is a text editor with syntax highlighting). 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_ubuntu22.04.sh --pause` as the last command in the above list instead.
It's best to reboot the PC before continuing to next steps. This concludes the build setup preparations.
## Building EdgeTX firmware for the radio
For tidy files and folder hierarchy, it's best to create a dedicated subfolder in the current user home for EdgeTX, as a container for various EdgeTX flavors and builds. In the terminal window, issue the following commands, one at a time:
```
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, prepare the environment and 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
```
To build EdgeTX, we need to minimally specify the radio target, but can further select or de-select a number of build-time options. A full list of available options is documented on the [Compilation Options](compilation-options.md) page. You can also generate a text-file list of all options by running:
```
cmake -LAH -S . > ~/edgetx_main-cmake-options.txt
```
You can use, e.g. _gedit_ under Ubuntu to view the file.
As an example, we will build next for RadioMaster TX16S (PCB=X10, PCBREV=TX16S), mode 2 default stick (DEFAULT_MODE=2, will otherwise default to mode 1) and selected the type as a Debug build with debug symbols included (CMAKE_BUILD_TYPE=Debug). The CMake command for this is:
```
cmake --fresh -S . -B build-output -Wno-dev -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DCMAKE_BUILD_TYPE=Debug
```
If you do not want to include the debug symbols, use `-DCMAKE_BUILD_TYPE=Release` instead.
To build for other radios, you just need to select another build target by specifying appropriate values for `PCB` and `PCBREV` for your radio. It is best to use a different build folder for each target. As a tip for 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](https://github.com/EdgeTX/edgetx/tree/main/tools)
It is recommended to set the `CMAKE_BUILD_PARALLEL_LEVEL` environment variable to the number of CPU cores on your system, to speed up all subsequent builds:
```
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
```
To configure, issue:
```
cmake --build build-output --target arm-none-eabi-configure
```
To build the firmware, issue:
```
cmake --build build-output --target firmware --parallel
```
This process can take some minutes to complete.
If successful, you should find a firmware binary _firmware.bin_ in the `build-output/arm-none-eabi` folder, that you can flash onto your radio.
It's a good idea to rename the binary, so that it is easier later to see the target radio and which options were baked into it. For this, issue e.g.:
```
mv build-output/arm-none-eabi/firmware.bin edgetx_main_tx16s_mode2_debug.bin
```
You will need to prepare a clean microSD card and fill it with the content according to your radio type from [https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest](https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest)
The following page lists which zip file you need: [https://github.com/EdgeTX/edgetx-sdcard](https://github.com/EdgeTX/edgetx-sdcard)
You can use [EdgeTX Buddy](https://buddy.edgetx.org/), [EdgeTX Companion](https://edgetx.org/getedgetx/), or [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html) to flash the binary to your radio. For further instructions, see:
[https://manual.edgetx.org/installing-and-updating-edgetx/update-from-opentx-to-edgetx-1](https://manual.edgetx.org/installing-and-updating-edgetx/update-from-opentx-to-edgetx-1)
## Building Companion, Simulator and radio simulator libraries
### After EdgeTX 2.12
You can build firmware, the radio simulator module, Companion and Simulator all in one step:
```
cmake --build build-output --parallel --target firmware --target wasi-module --target companion --target simulator
```
This will configure and download extra dependencies as needed. Alternately, if you only want to build the simulator module at this point, you can run
```
cmake --build build-output --parallel --target wasi-module
```
The wasm simulator module is built into `build-output/wasm/wasm-build/` but Companion looks for it in `build-output/native/`. Copy it across before launching Companion or Simulator:
```
cp build-output/wasm/wasm-build/*.wasm build-output/native/
```
If you want to build simulator modules for multiple radio targets (so they are all available in Companion), the helper script `tools/build-wasm-modules.sh` can build all supported targets in one go:
```
tools/build-wasm-modules.sh . ./wasm-modules/
```
The `.wasm` files are output to `./wasm-modules/`. Copy them to `build-output/native/` before building Companion.
Change into the `native` directory, where `<ver>` is the EdgeTX version as digits (e.g. `212` for 2.12):
```
cd build-output/native
```
To launch Companion:
```
./companion<ver>
```
Before running the simulator, copy the SD card content for your radio target from [https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest](https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest) and extract it e.g. to `~/edgetx/simu_sdcard/horus`. You should also create a radio profile first in Companion before running the simulator.
To launch the simulator:
```
./simulator<ver>
```
In the dialog that pops up, select _SD Path_ as data source and under _SD Image Path:_ browse to `~/edgetx/simu_sdcard/horus`
[![EdgeTX simulator on Linux](../assets/images/build/linux/EdgeTX_simulator_Linux.png)](../assets/images/build/linux/EdgeTX_simulator_Linux.png)
### Legacy: EdgeTX 2.10 to 2.12
From 2.10 onwards, Companion and Simulator only incorporate hardware definitions for radio simulator libraries built before they themselves are built. You need to build a `libsimulator` for each radio target you want to include.
To include additional radio targets, re-run the `cmake --fresh` configure command from above with different `PCB` and `PCBREV` values, then build `libsimulator` again for each **before** building Companion.
Build the radio simulator library for your target, then Companion and Simulator:
```
cmake --build build-output --parallel --target libsimulator --target companion --target simulator
```
+150
View File
@@ -0,0 +1,150 @@
# Build Instructions under Ubuntu 24.04
Last tested with Ubuntu 24.04 LTS in March 2026.
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](#setting-up-the-build-environment-for-edgetx)
- [Building EdgeTX firmware for the radio](#building-edgetx-firmware-for-the-radio)
- [Building Companion, Simulator and radio simulator libraries](#building-companion-simulator-and-radio-simulator-libraries)
## Setting up the build environment for EdgeTX
You can setup Ubuntu 24.04 on bare-metal, inside a virtual machine environment, or using WSL2 under Windows 10/11. For WSL2 installation, please see a dedicated page about it: [Setting up Ubuntu in a Windows Subsystem for Linux](linux-wsl.md).
* Download [Ubuntu 24.04](https://ubuntu.com/download/desktop) 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.
* To make setting up the build environment as easy as possible, we created a shell script that includes all the necessary commands. In the next steps, we download it, make it executable and run it. Active Internet connection is required for the script to be able to download the required packages for installation. Start, by opening a terminal window (click _Activities_ in the top left corner, type _terminal_ and press _Enter_). Enter the following 3 lines, each line at a time and enter your password (with sudo rights) if asked:
```
wget https://raw.githubusercontent.com/EdgeTX/edgetx/main/tools/setup_buildenv_ubuntu24.04.sh
```
```
chmod +x setup_buildenv_ubuntu24.04.sh
```
```
./setup_buildenv_ubuntu24.04.sh
```
* If all went smoothly, you should not have seen any errors, and should have been informed that setup was finished.
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 (_gedit_ for example in Ubuntu is a text editor with syntax highlighting). 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_ubuntu24.04.sh --pause` as the last command in the above list instead.
It's best to reboot the PC before continuing to next steps. This concludes the build setup preparations.
## Building EdgeTX firmware for the radio
For tidy files and folder hierarchy, it's best to create a dedicated subfolder in the current user home for EdgeTX, as a container for various EdgeTX flavors and builds. In the terminal window, issue the following commands, one at a time:
```
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, prepare the environment and 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
```
To build EdgeTX, we need to minimally specify the radio target, but can further select or de-select a number of build-time options. A full list of available options is documented on the [Compilation Options](compilation-options.md) page. You can also generate a text-file list of all options by running:
```
cmake -LAH -S . > ~/edgetx_main-cmake-options.txt
```
You can use, e.g. _gedit_ under Ubuntu to view the file.
As an example, we will build next for RadioMaster TX16S (PCB=X10, PCBREV=TX16S), mode 2 default stick (DEFAULT_MODE=2, will otherwise default to mode 1) and selected the type as a Debug build with debug symbols included (CMAKE_BUILD_TYPE=Debug). The CMake command for this is:
```
cmake --fresh -S . -B build-output -Wno-dev -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DCMAKE_BUILD_TYPE=Debug
```
If you do not want to include the debug symbols, use `-DCMAKE_BUILD_TYPE=Release` instead.
To build for other radios, you just need to select another build target by specifying appropriate values for `PCB` and `PCBREV` for your radio. It is best to use a different build folder for each target. As a tip for 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](https://github.com/EdgeTX/edgetx/tree/main/tools)
It is recommended to set the `CMAKE_BUILD_PARALLEL_LEVEL` environment variable to the number of CPU cores on your system, to speed up all subsequent builds:
```
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
```
To configure, issue:
```
cmake --build build-output --target arm-none-eabi-configure
```
To build the firmware, issue:
```
cmake --build build-output --target firmware --parallel
```
This process can take some minutes to complete.
If successful, you should find a firmware binary _firmware.bin_ in the `build-output/arm-none-eabi` folder, that you can flash onto your radio.
It's a good idea to rename the binary, so that it is easier later to see the target radio and which options were baked into it. For this, issue e.g.:
```
mv build-output/arm-none-eabi/firmware.bin edgetx_main_tx16s_mode2_debug.bin
```
You will need to prepare a clean microSD card and fill it with the content according to your radio type from [https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest](https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest)
The following page lists which zip file you need: [https://github.com/EdgeTX/edgetx-sdcard](https://github.com/EdgeTX/edgetx-sdcard)
You can use [EdgeTX Buddy](https://buddy.edgetx.org/), [EdgeTX Companion](https://edgetx.org/getedgetx/), or [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html) to flash the binary to your radio. For further instructions, see:
[https://manual.edgetx.org/installing-and-updating-edgetx/update-from-opentx-to-edgetx-1](https://manual.edgetx.org/installing-and-updating-edgetx/update-from-opentx-to-edgetx-1)
## Building Companion, Simulator and radio simulator libraries
### After EdgeTX 2.12
You can build firmware, the radio simulator module, Companion and Simulator all in one step:
```
cmake --build build-output --parallel --target firmware --target wasi-module --target companion --target simulator
```
This will configure and download extra dependencies as needed. Alternately, if you only want to build the simulator module at this point, you can run:
```
cmake --build build-output --parallel --target wasi-module
```
The wasm simulator module is built into `build-output/wasm/wasm-build/` but Companion looks for it in `build-output/native/`. Copy it across before launching Companion or Simulator:
```
cp build-output/wasm/wasm-build/*.wasm build-output/native/
```
If you want to build simulator modules for multiple radio targets (so they are all available in Companion), the helper script `tools/build-wasm-modules.sh` can build all supported targets in one go:
```
tools/build-wasm-modules.sh . ./wasm-modules/
```
The `.wasm` files are output to `./wasm-modules/`. Copy them to `build-output/native/` before building Companion.
Change into the `native` directory, where `<ver>` is the EdgeTX version as digits (e.g. `212` for 2.12):
```
cd build-output/native
```
To launch Companion:
```
./companion<ver>
```
Before running the simulator, copy the SD card content for your radio target from [https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest](https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest) and extract it e.g. to `~/edgetx/simu_sdcard/horus`. You should also create a radio profile first in Companion before running the simulator.
To launch the simulator:
```
./simulator<ver>
```
In the dialog that pops up, select _SD Path_ as data source and under _SD Image Path:_ browse to `~/edgetx/simu_sdcard/horus`
[![EdgeTX simulator on Linux](../assets/images/build/linux/EdgeTX_simulator_Linux.png)](../assets/images/build/linux/EdgeTX_simulator_Linux.png)
### Legacy: EdgeTX 2.10 to 2.12
From 2.10 onwards, Companion and Simulator only incorporate hardware definitions for radio simulator libraries built before they themselves are built. You need to build a `libsimulator` for each radio target you want to include.
To include additional radio targets, re-run the `cmake --fresh` configure command from above with different `PCB` and `PCBREV` values, then build `libsimulator` again for each **before** building Companion.
Build the radio simulator library for your target, then Companion and Simulator:
```
cmake --build build-output --parallel --target libsimulator --target companion --target simulator
```
+136
View File
@@ -0,0 +1,136 @@
# Setting up Ubuntu 20.04 in a Windows Subsystem for Linux
# For who is this guide?
This guide is especially useful for people who want to help testing firmware and or LUA scripts. It will allow to run a simple simulator with the LUA debug and all other radio functions on your W10 64-bit computer in a separate window, running Ubuntu.
# How does this work
Windows 10 / Windows 11 is now able to run another OS (Linux) in a subsystem. However, this subsystem does not have access to the screen as it is shipped. By default, at the time of writing (as it will change in the near future with WSLg) it only offers a terminal interface. By using an X window server (in this guide we use VcXsrv) a window can be created to which the subsystem can connect to output graphical content. This can be used to be used to run the radio simulator in. We will install Ubuntu on the subsystem, so we are ready to use all the build tools already supported.
# Installation procedure
We are going to install the following things:
* WSL2 (Windows Subsystem for Linux, version 2)
* A Linux distribution (Ubuntu 20.04 LTS)
* Setup the EdgeTX build environment in order to be able to compile firmware and simulators
* Setup the X-Windows server (VcXserver) so that we can run graphical programs like the simulator
## WSL2 installation
You can use the [guide from Microsoft](https://docs.microsoft.com/en-us/windows/wsl/install-win10). It is really straightforward. The steps for the manual install are below:
* In the search box in the Windows taskbar (or press Window(KEY)+R) type "powershell". It will list all possible way of running Windows PowerShell. Run it as an administrator.
* In the PowerShell window, type `wsl --install`
* Restart your computer
## Ubuntu installation
Ubuntu (20.04) is installed automatically.
* After the reboot a Ubuntu WSL window will open and after a short while you will be asked to create a Username and Password for the OS being installed. Choose something yourself you can remember ;)
* It is good practice to first load any updates, so type `sudo apt-get update` and press enter to check for updates, and `sudo apt-get upgrade` to install all the available updates. The `sudo` in this command tells the OS to do an update while being logged in as SuperUser (SUDO stands for SuperUser Do). It will ask for the password you used when you installed the OS. Without it you can't run these sorts of commands, so don't forget it!
## Settings up the build system
Now that you have an up to date Ubuntu 20.04 Linux WSL2 ready, it's time to configure it for EdgeTX. Most of the hard work will be done for you via a per-prepared script. But before you run that, you have to enable support for the i386 libraries in order to be able to compile, and then you can download and run the installation helper script.
* To enable the needed i386 support, run
```
sudo dpkg --add-architecture i386
```
* To download the installer script, run
```
wget https://raw.githubusercontent.com/EdgeTX/edgetx/main/tools/setup_buildenv_ubuntu20.04.sh
```
* in order to make the script executable (so you can run it), run
```
chmod a+x setup_buildenv_ubuntu20.04.sh
```
* To finally execute/run the installer script, run
```
./setup_buildenv_ubuntu20.04.sh
```
If all went smoothly, you should not have seen any errors.
Although the script suggests you need to reboot the computer, this is not generally the case, and is partly defeats the purpose of WSL2. All that is needed is for you to run
```
source ~/.bashrc
```
in order for some settings to the path to be applied.
## For Windows 11 you're now done and you can switch to the Ubuntu Guide
- [Ubuntu 20.04 Build Instructions](linux-ubuntu-22.04.md)
## Preparing for graphical applications
* Now we will immediately install the terminator we need to connect to the X-window later: `sudo apt-get install terminator` and press enter.
Accept all confirmation requests and enter your password when needed.
* As preparation for later we will install a graphical editor you may like: `sudo apt install gedit` and press enter.
You can try to run it, but since we have no graphical output yet, that wont work. We will use it later.
If you are not familiar with Ubuntu or other Linux systems, things might be scary. Don't worry, we are not going to do much with it. just type "exit" and press enter to close down Ubuntu properly and close the terminal window. Use the shortcut if windows created it to start it again, or search for "Ubuntu" using the loupe again.
### VcXserver installation
This will enable us to run an application with a graphical output, such as the simulator, or companion, on our fresh Ubuntu install.
* First you need to download it [from here](https://sourceforge.net/projects/vcxsrv/) and install it as administrator.
* Then we will create a shortcut on the desktop so we can start it like we want it. Rightclick anywhere on the screen, select new, shortcut and add the following text as destination: `"C:\Program Files\VcXsrv\vcxsrv.exe" :0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl -dpi auto`
* Finally, we need a VBS script that we can start from a second shortcut to launch Ubuntu in the X-window.
* Go to the public documents folder `C:\Users\Public\Documents` or any other place you can remember.
Create a new text document (rightclick anywhere on the desktop, select new, textfile) and name it "startTerminator.txt". Open it and enter the following text: `args = "-c" & " -l " & """DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0 terminator"""
WScript.CreateObject("Shell.Application").ShellExecute "bash", args, "", "open", 0`
* Rename it to "startTerminator.vbs".
* Go to the desktop and create a shortcut (rightclick on the screen, select new, shortcut) and enter the following text: `C:\Windows\System32\wscript.exe C:\Users\Public\Documents\startTerminator.vbs`
This finishes the install.
### How to start using it
* Now to test all this, I suggest to disable the firewall for a moment. Use the windows search loupe or press Window(KEY)+R and type 'firewall', open it, and disable it for all three levels. If you want, you can shut down your wifi first for security reasons.
* now, first open the Xserver by clicking on the shortcut we made for it
* then open the Ubuntu session and link it to the Xserver by clicking on the second shortcut.
* Make sure you start both as ADMINISTRATOR
* You should now, after a short delay, get an Ubuntu terminal window, but now running within the Xserver window.
* we can now start using our graphical text editor we installed earlier. type `gedit` and enter.
* after all this is working, you can start the firewall again, and start tweaking it to allow the WSL to communicate properly with the firewall active.
* At least you should allow VcXserver windows Xserver as app to have acces to both private and public networks.
## Running the SIMU
We have created a SIMU application for the Taranis X9D+ by compiling it for you. If you want to test it, just type the following command to fetch it `wget -q https://raw.githubusercontent.com/EdgeTX/edgetx/refs/heads/main/docs/assets/simu_x9dplus_ubuntu`.
then `chmod a+x simu_x9dplus_ubuntu` and run it with `./simu_x9dplus_ubuntu`.
And your X9D+ simple simulator is running in an Ubuntu window on your windows computer. (the key shortcuts can be found in the windows companion help screen: PG-UP->MENU; PG-DN->PAGE; DEL/ESC/BKSP->EXIT; +->+; -->-; ENTER->ENT).
## Compiling
Before following the Ubuntu build guide, there is one extra step required for WSL:
* You have to enable the support for the i386 libraries by executing the following commands in UBUNTU:
* `sudo dpkg --add-architecture i386`
* `sudo apt-get update`
Now you can just follow the standard UBUNTU guide, and off you go!
- [Ubuntu 20.04 Build Instructions](linux-ubuntu-22.04.md)
## Some tips for Windows adepts
* You can start an explorer from ubuntu, that will allow you to access the UBUNTU files SAFELY from windows. Simple type `explorer.exe` in UBUNTU
In the explorer you open from UBUNTU in windows:
* The UBUNTU files are under `\\wsl$\Ubuntu-20.04\`
Make sure you know where you are in UBUNTU:
* the UBUNTU terminal starts in your personal directory in UBUNTU, just one level below `/HOME`. So type `cd/HOME`, and then `dir`, and you can see where your personal files are for your UBUNTU user.
* The X-windows terminal starts in `/mnt/c/Windows/System32`. To switch quickly to your home directory type `cd /HOME`
## Conclusion
You can thus set up companion on UBUNTU to use your windows directories for the SDcard and the ETX files, working seamless together with windows from an UBUNTU X-window. The same goes for the simulator.
In essence, from a functional perspective, Companion24 and the full Simulator24 will be exact the same as if they where compiled and run under windows directly.
+134
View File
@@ -0,0 +1,134 @@
# Build Instructions using macOS 10.15 (Catalina)
### Install Xcode command line tools:
- Open `Terminal`
- Run this command:
```
xcode-select —install
```
### Install "brew" (https://brew.sh):
- Run command in `Terminal`:
```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
### Install newer Python version:
- Run command in `Terminal`:
```
brew install python
```
### Install Qt 5.12.9:
- Install `aqtinstall` Python package:
```
pip3 install aqtinstall
```
- Install Qt 5.12.9
```
aqt install 5.12.9 mac desktop clang_64
```
Once Qt has been installed properly, you should set a couple environment variables (please modify according to the real installation paths):
```
export QTDIR=/Users/etx/Src/Qt/5.12.9/clang_64
export QT_PLUGIN_PATH=$QTDIR/plugins
```
Please note that `QT_PLUGIN_PATH` is required to be able to run Companion from your build directory without having to build a `DMG` package first.
### Install ARM toolchain
Download and install ARM GCC from here (installs in `/Applications/ARM/`):
- https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-mac.pkg
Please note that this installation takes care of allowing the binaries to be run and "un-quarantines" them. If you choose to install the `bz2` archive to another location, you will have to take care of that yourself (see https://disable-gatekeeper.github.io/ for more details).
### Install various dependencies
- With `brew` in a `Terminal`:
```
brew install sdl fox cmake
```
- Install Python dependencies:
```
pip3 install Pillow clang lz4 jinja2
```
- If you face issues from pip3 command, try to fix your CommandLineTools installation
From the terminal run:
```
softwareupdate --list
```
which produces a list of available updates. Wait a bit for a list to display (won't take very long). And look for the "* Label:" under Software Update found the following new or updated software:
It should say something like: * Label: `Command Line Tools for Xcode-13.2`
Then simply run:
```
softwareupdate -i "Command Line Tools for Xcode-13.2"
```
and replace the text in the brackets with the Label from the previous output. This will then install the updates and the fix for python3.
### Compile EdgeTX
- Checkout code
```
git clone --recursive https://github.com/EdgeTX/edgetx.git
```
- Switch into the source directory:
```
cd edgetx
```
- Create build directory and configure build using `cmake`:
```
mkdir -p build
cd build
cmake -DPCB=X10 -DPCBREV=TX16S \
-DCMAKE_PREFIX_PATH=$QTDIR \
-DARM_TOOLCHAIN_DIR=/Applications/ARM/bin/ \
-DPYTHON_EXECUTABLE=$(brew --prefix)/bin/python3 ..
```
Please note that the variables `CMAKE_PREFIX_PATH`, `ARM_TOOLCHAIN_DIR` and `PYTHON_EXECUTABLE` must be specified additionally to what is described in the other compilation HowTos:
- `CMAKE_PREFIX_PATH`: this must point to your Qt installation path.
- `ARM_TOOLCHAIN_DIR`: this must point to where ARM GCC has been installed (and MUST contain `/` at the end).
- `PYTHON_EXECUTABLE`: this allows overriding Python installed as part of MacOS.
- Then build as usual (`-j4` to use 4 CPU cores):
```
make -j4 firmware
```
## Notes on compiling simulator plug-ins
When compiling simulator plug-ins (using `make libsimulator` with the target properly configured), the product of this compilation will be a `.dylib` stored in your build directory. If you want the Companion or Simulator Apps to be able to use it, you will need to copy it manually into the respective directories. Here is how it show look like with a couple plug-ins copied:
```
% ls -l companion.app/Contents/MacOS/
total 411976
-rwxr-xr-x 1 etx staff 27908864 Jan 7 11:48 companion
-rwxr-xr-x 1 etx staff 57089384 Jan 7 11:22 libedgetx-nv14-simulator.dylib
-rwxr-xr-x 1 etx staff 61167768 Jan 7 08:44 libedgetx-tx16s-simulator.dylib
-rwxr-xr-x 1 etx staff 60327272 Jan 5 12:48 libedgetx-x10express-simulator.dylib
-rwxr-xr-x 1 etx staff 1849768 Dec 26 08:56 libedgetx-x9d+-simulator.dylib
-rwxr-xr-x 1 etx staff 1881224 Dec 31 16:44 libedgetx-zorro-simulator.dylib
% ls -l simulator.app/Contents/MacOS/
total 392616
-rwxr-xr-x 1 etx staff 57089384 Jan 7 11:22 libedgetx-nv14-simulator.dylib
-rwxr-xr-x 1 etx staff 61168056 Jan 5 11:52 libedgetx-tx16s-simulator.dylib
-rwxr-xr-x 1 etx staff 60327272 Jan 5 12:34 libedgetx-x10express-simulator.dylib
-rwxr-xr-x 1 etx staff 21732144 Jan 7 11:48 simulator
```
+166
View File
@@ -0,0 +1,166 @@
# Build Instructions using macOS 15 (Sequoia) and macOS 26 (Tahoe)
# Install [Homebrew](https://brew.sh/)
- Run command in `Terminal`:
```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
!!! tip
Installing Brew via the command above will automatically install the [Xcode Command Line Tools](https://mac.install.guide/commandlinetools/). If for some reason you need to do this manually, run `xcode-select —install` via the Terminal app.
# Install Qt 6
!!! note
If you only intend on building the firmware, and not `simu`, `companion` or `simulator`, this is not necessary, and you can skip to the next step.
```
brew install qt@6
```
Once Qt has been installed, you should set a couple environment variables (please modify according to the real installation paths):
```
export QTDIR=$(brew --prefix)/opt/qt@6
export QT_PLUGIN_PATH=$QTDIR/plugins
```
Please note that `QT_PLUGIN_PATH` is required to be able to run Companion from your build directory without having to build a `DMG` package first.
# Install ARM toolchain
Download and install the ARM GCC toolchain [from here](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads) (installs in `/Applications/ArmGNUToolchain/`):
- For Intel Mac: https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-darwin-x86_64-arm-none-eabi.pkg
- If Mac Silicon (i.e. M1-M5): https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-darwin-arm64-arm-none-eabi.pkg
Please note that this installation takes care of allowing the downloaded binaries to be run and prevents them being quarantined. If you choose to install the `tar.xz` archive to another location, you will have to take care of that yourself (see https://disable-gatekeeper.github.io/ for more details).
# Install various dependencies
- With `brew` in a `Terminal`:
```
brew install sdl cmake
```
If you plan to run the standalone simulator for debugging:
```
brew install --cask quartz
```
# Download EdgeTX code
- Checkout code
```
git clone --recursive https://github.com/EdgeTX/edgetx.git
```
- Switch into the source directory:
```
cd edgetx
```
# Install Python dependencies
Since Python 3.11 enabled the "externally managed" flag, it is recommended that you use a virtual environment. [uv](https://docs.astral.sh/uv/getting-started/installation/) is one of the easiest tools to do and manage this, and can be installed with brew. It is recommended you create the virtual environment now rather than earlier in the process, as doing it now will create it in the edgetx directory.
- Install UV:
```
brew install uv
```
- Create the virtual environment (and use specific version of python for this environment):
```
uv venv --python 3.14
```
- Activate the virtual environment (you will need to run this whenever you want to compile in the future from a new terminal session):
```
source .venv/bin/activate
```
- Install the packages:
```
uv pip install Pillow clang lz4 jinja2
```
# Compile EdgeTX
- Create and enter build directory:
```
mkdir -p build && cd build
```
Configure build flags using `cmake` (in this case, for RadioMaster TX16S, [see here](https://github.com/EdgeTX/edgetx/blob/main/tools/build-common.sh) for other possible handset specific flags).
```
cmake -DPCB=X10 -DPCBREV=TX16S \
-DCMAKE_PREFIX_PATH=$QTDIR \
-DARM_TOOLCHAIN_DIR=/Applications/ArmGNUToolchain/14.2.Rel1/arm-none-eabi/bin/ ..
```
!!! note
Please note that the variables `CMAKE_PREFIX_PATH`, `ARM_TOOLCHAIN_DIR` must be specified additionally to what is described in the other compilation HowTos:
- `CMAKE_PREFIX_PATH`: this must point to your Qt installation path.
- `ARM_TOOLCHAIN_DIR`: this must point to where ARM GCC has been installed (and MUST contain `/` at the end).
Configure the compiler for firmware building (parallel limits the number of CPU cores used - you can increase this if your machine can handle more):
```
cmake --build . --target arm-none-eabi-configure --parallel 4
```
Build the firmware!
```
cmake --build . --target firmware
```
# Troubleshooting
## Notes on compiling simulator plug-ins
When compiling simulator plug-ins (using `cmake --build . --target libsimulator` with the target properly configured), the product of this compilation will be a `.dylib` stored in your build directory. If you want the Companion or Simulator apps to be able to use it, you will need to copy it manually into the respective directories. Here is how it should look with a couple of plug-ins copied:
```
% ls -l companion.app/Contents/MacOS/
total 411976
-rwxr-xr-x 1 etx staff 27908864 Jan 7 11:48 companion
-rwxr-xr-x 1 etx staff 57089384 Jan 7 11:22 libedgetx-nv14-simulator.dylib
-rwxr-xr-x 1 etx staff 61167768 Jan 7 08:44 libedgetx-tx16s-simulator.dylib
-rwxr-xr-x 1 etx staff 60327272 Jan 5 12:48 libedgetx-x10express-simulator.dylib
-rwxr-xr-x 1 etx staff 1849768 Dec 26 08:56 libedgetx-x9d+-simulator.dylib
-rwxr-xr-x 1 etx staff 1881224 Dec 31 16:44 libedgetx-zorro-simulator.dylib
% ls -l simulator.app/Contents/MacOS/
total 392616
-rwxr-xr-x 1 etx staff 57089384 Jan 7 11:22 libedgetx-nv14-simulator.dylib
-rwxr-xr-x 1 etx staff 61168056 Jan 5 11:52 libedgetx-tx16s-simulator.dylib
-rwxr-xr-x 1 etx staff 60327272 Jan 5 12:34 libedgetx-x10express-simulator.dylib
-rwxr-xr-x 1 etx staff 21732144 Jan 7 11:48 simulator
```
## Notes on possible error while trying to run build-companion.sh
If you encounter this error:
```
CPack: - Install project: EdgeTX []
CMake Error at /opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/BundleUtilities.cmake:458 (message):
otool -l failed: 1
error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool-classic:
can't open file: @rpath/libsharpyuv.0.dylib (No such file or directory)
Call Stack (most recent call first):
/opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/BundleUtilities.cmake:527 (get_item_rpaths)
/opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/BundleUtilities.cmake:614 (set_bundle_key_values)
/opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/BundleUtilities.cmake:933 (get_bundle_keys)
/Users/jean-christophedreyfus/Documents/edgetx/build/native/companion/src/cmake_install.cmake:180 (fixup_bundle)
/Users/jean-christophedreyfus/Documents/edgetx/build/native/cmake_install.cmake:43 (include)
CPack Error: Error when generating package: companion
make: *** [package] Error 1
```
It can be fixed by entering the following command at terminal:
`install_name_tool -change "@rpath/libsharpyuv.0.dylib" "$(brew --prefix)/lib/libsharpyuv.0.dylib" "$(brew --prefix)/lib/libwebp.7.dylib" && codesign --force -s - "$(brew --prefix)/lib/libwebp.7.dylib"`
+144
View File
@@ -0,0 +1,144 @@
# Build Instructions using macOS 14.1 (Sonoma)
### Install Xcode command line tools:
- Open `Terminal`
- Run this command:
```
xcode-select —install
```
### Install "brew" (https://brew.sh):
- Run command in `Terminal`:
```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
### Install newer Python version:
- Run command in `Terminal`:
```
brew install python
```
### Install Qt 5:
```
brew install qt@5
```
Once Qt has been installed properly, you should set a couple environment variables (please modify according to the real installation paths):
```
export QTDIR=$(brew --prefix)/opt/qt@5
export QT_PLUGIN_PATH=$QTDIR/plugins
```
Please note that `QT_PLUGIN_PATH` is required to be able to run Companion from your build directory without having to build a `DMG` package first.
### Install ARM toolchain
Download and install ARM GCC from here (installs in `/Applications/ARM/`):
- https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi.pkg
Please note that this installation takes care of allowing the binaries to be run and "un-quarantines" them. If you choose to install the `bz2` archive to another location, you will have to take care of that yourself (see https://disable-gatekeeper.github.io/ for more details).
### Install various dependencies
- With `brew` in a `Terminal`:
```
brew install sdl fox cmake
```
If you plan to run the standalone simulator for debuging
```
brew install --cask quartz
```
- Install Python dependencies:
```
pip3 install Pillow clang lz4 jinja2
```
### Compile EdgeTX
- Checkout code
```
git clone --recursive https://github.com/EdgeTX/edgetx.git
```
- Switch into the source directory:
```
cd edgetx
```
- Create build directory and configure build using `cmake`:
```
mkdir -p build
cd build
cmake -DPCB=X10 -DPCBREV=TX16S \
-DCMAKE_PREFIX_PATH=$QTDIR \
-DARM_TOOLCHAIN_DIR=/Applications/ArmGNUToolchain/13.2.Rel1/arm-none-eabi/bin/ \
-DPYTHON_EXECUTABLE=$(brew --prefix)/bin/python3 ..
```
Please note that the variables `CMAKE_PREFIX_PATH`, `ARM_TOOLCHAIN_DIR` and `PYTHON_EXECUTABLE` must be specified additionally to what is described in the other compilation HowTos:
- `CMAKE_PREFIX_PATH`: this must point to your Qt installation path.
- `ARM_TOOLCHAIN_DIR`: this must point to where ARM GCC has been installed (and MUST contain `/` at the end).
- `PYTHON_EXECUTABLE`: this allows overriding Python installed as part of MacOS.
- Then build as usual (`-j4` to use 4 CPU cores):
```
make -j4 firmware
```
## Notes on compiling simulator plug-ins
When compiling simulator plug-ins (using `make libsimulator` with the target properly configured), the product of this compilation will be a `.dylib` stored in your build directory. If you want the Companion or Simulator Apps to be able to use it, you will need to copy it manually into the respective directories. Here is how it show look like with a couple plug-ins copied:
```
% ls -l companion.app/Contents/MacOS/
total 411976
-rwxr-xr-x 1 etx staff 27908864 Jan 7 11:48 companion
-rwxr-xr-x 1 etx staff 57089384 Jan 7 11:22 libedgetx-nv14-simulator.dylib
-rwxr-xr-x 1 etx staff 61167768 Jan 7 08:44 libedgetx-tx16s-simulator.dylib
-rwxr-xr-x 1 etx staff 60327272 Jan 5 12:48 libedgetx-x10express-simulator.dylib
-rwxr-xr-x 1 etx staff 1849768 Dec 26 08:56 libedgetx-x9d+-simulator.dylib
-rwxr-xr-x 1 etx staff 1881224 Dec 31 16:44 libedgetx-zorro-simulator.dylib
% ls -l simulator.app/Contents/MacOS/
total 392616
-rwxr-xr-x 1 etx staff 57089384 Jan 7 11:22 libedgetx-nv14-simulator.dylib
-rwxr-xr-x 1 etx staff 61168056 Jan 5 11:52 libedgetx-tx16s-simulator.dylib
-rwxr-xr-x 1 etx staff 60327272 Jan 5 12:34 libedgetx-x10express-simulator.dylib
-rwxr-xr-x 1 etx staff 21732144 Jan 7 11:48 simulator
```
## Notes on possible error while trying to run build-companion.sh
If you encounter this error:
```
CPack: - Install project: EdgeTX []
CMake Error at /opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/BundleUtilities.cmake:458 (message):
otool -l failed: 1
error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool-classic:
can't open file: @rpath/libsharpyuv.0.dylib (No such file or directory)
Call Stack (most recent call first):
/opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/BundleUtilities.cmake:527 (get_item_rpaths)
/opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/BundleUtilities.cmake:614 (set_bundle_key_values)
/opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/BundleUtilities.cmake:933 (get_bundle_keys)
/Users/jean-christophedreyfus/Documents/edgetx/build/native/companion/src/cmake_install.cmake:180 (fixup_bundle)
/Users/jean-christophedreyfus/Documents/edgetx/build/native/cmake_install.cmake:43 (include)
CPack Error: Error when generating package: companion
make: *** [package] Error 1
```
It can be fixed by entering the following command at terminal:
`install_name_tool -change "@rpath/libsharpyuv.0.dylib" "$(brew --prefix)/lib/libsharpyuv.0.dylib" "$(brew --prefix)/lib/libwebp.7.dylib" && codesign --force -s - "$(brew --prefix)/lib/libwebp.7.dylib"`
+189
View File
@@ -0,0 +1,189 @@
# Building and Debugging with Qt Creator
!!! warning "Obsolete"
**The info in this page is obsolete and does not work anymore with present EdgeTX versions.** This guide is no longer maintained and is provided for historical reference only. The configuration steps described here were written for much older versions of EdgeTX and Qt Creator.
This page discusses how to setup and use [Qt Creator](https://wiki.qt.io/QtCreatorWhitepaper) graphical integrated development environment (IDE) to explore and also debug EdgeTX source code.
- [Configuring Qt Creator for EdgeTX](#configuring-qt-creator-for-edgetx)
* [Activating BareMetal plugin](#activating-baremetal-plugin)
* [Adding GNU ARM compiler and debugger support to Qt Creator](#adding-gnu-arm-compiler-and-debugger-support-to-qt-creator)
* [Creating a bare metal device and adding a debugging option to it](#creating-a-bare-metal-device-and-adding-a-debugging-option-to-it)
* [Creating a Kit for building firmware for STM32 µCs](#creating-a-kit-for-building-firmware-for-stm32-cs)
- [Loading EdgeTX source tree into Qt Creator](#loading-edgetx-source-tree-into-qt-creator)
- [Building EdgeTX firmware with Qt Creator](#building-edgetx-firmware-with-qt-creator)
- [Editing source code with Qt Creator](#editing-source-code-with-qt-creator)
[![Qt Creator code completion](../assets/images/build/qtcreator/QtCodeCompletion.png)](../assets/images/build/qtcreator/QtCodeCompletion.png)
With [Qt Creator](https://wiki.qt.io/QtCreatorWhitepaper), you not only have a graphical option to build EdgeTX radio firmware, Companion and Simulator software, but also very comfortable way to edit the code and even more importantly to debug it. If you hook up to your radio's [Serial-Wire-Debug (SWD)](https://stm32-base.org/guides/connecting-your-debugger.html) header of the mainboard a hardware debugger, it is possible to perform in-circuit-debugging of code running on the radios STM32 microcontroller. Some examples of hardware debuggers that can be used are, e.g. [Segger J-Link](https://www.segger.com/products/debug-probes/j-link/) (incl. the [Mini EDU](https://www.segger.com/products/debug-probes/j-link/models/j-link-edu-mini/)) and [ST-Link/V2](https://www.st.com/en/development-tools/st-link-v2.html). With in-circuit-debugging, you are able to step through the code and do live variable inspection, which makes validating low level code much easier. For debugging high-level code, it is easier to use the radio firmware simulation library, running on your PC, not requiring a physical radio hardware hookup. Even if you might not be driven by the desire to change the existing EdgeTX codebase, running code in a debug session will provide you an in-depth insight into variables passed between the functions and can in general give a clearer view of how the EdgeTX runs under the hood.
If you followed the previous build instruction guides (irrespective if for Windows 10 or Ubuntu Linux 20.04), Qt Creator IDE is already installed on your system.
The guide below uses screenshots from Windows, but provides info for correct paths in text for Ubuntu Linux as well.
## Configuring Qt Creator for EdgeTX
We need to first configure Qt Creator to support building for ARM architecture and external debugging (so called _bare-metal_ in Qt Creator lingo).
### Activating BareMetal plugin
Launch Qt Creator by clicking on _Start_ -> _Qt_ -> _Qt Creator_. Navigate to menu _Help_ and click _About Plugins..._. Under _Device Support_ enable the _BareMetal (experimental)_ plugin. Click _Close_
[![Qt Creator BareMetal plugin](../assets/images/build/qtcreator/QtCreatorBareMetal.png)](../assets/images/build/qtcreator/QtCreatorBareMetal.png)
After this step, it is mandatory to restart Qt Creator, select _Restart Now_ from the pop-up to restart Qt Creator.
### Adding GNU ARM compiler and debugger support to Qt Creator
Open from menu _Tools_ -> _Options..._. In the left pane _Kits_ should already be selected, if not, select it. Open tab _Compilers_. Click _Add_ -> _GCC_ -> _C_. As name, enter for example `GCC C ARM`. Click _Browse..._ behind field _Compiler path_ and navigate and open
* Windows: `C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\bin\arm-none-eabi-gcc.exe`
* Linux: `/opt/gcc-arm-none-eabi/bin/arm-none-eabi-gcc`
Field _ABI:_ should have automatically detected _arm-baremetal-generic-elf-32bit_. Click _Apply_.
Next, we add similarly C++ compiler. Click _Add_ -> _GCC_ -> _C++_. As name, enter for example `GCC ARM` and into field _Compiler path_ enter the same _arm-none-eabi-gcc_ binary as in the last step for plain C. Also here, field _ABI:_ should have detected _arm-baremetal-generic-elf-32bit_. Click once more _Apply_. If everything went smoothly, the red exclamation marks should be gone.
[![Qt Creator Compilers](../assets/images/build/qtcreator/QtCreatorCompilers.png)](../assets/images/build/qtcreator/QtCreatorCompilers.png)
Navigate to _Debuggers_ tab. Click _Add_, provide as name for example _GDB ARM_ and click _Browse..._ behind field _Path:_
Navigate to:
* Windows: `C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\bin\arm-none-eabi-gdb-py.exe`
* Linux: `/opt/gcc-arm-none-eabi/bin/arm-none-eabi-gdb-py`
and click _Open_. If Qt Creator is happy, then it should list in _Type_ and _ABIs_ fields that it found _GDB_ for _arm-baremetal-generic-elf-32bit_. Click _Apply_.
[![Qt Creator Debuggers](../assets/images/build/qtcreator/QtCreatorDebuggers.png)](../assets/images/build/qtcreator/QtCreatorDebuggers.png)
### Creating a bare metal device and adding a debugging option to it
If you plan to carry out in-circuit debugging, them install the drivers and software for your debugging hardware before continuing. For Segger J-Link/J-Trace, get the latest [Segger J-Link software and documentation pack](https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack) and install it. If your debugger stems from another manufacturer, you might want to consider the Open On-Chip Debugger or short [OpenOCD](http://openocd.org/). It supports huge variety of debugger hardware, but is less trivial to setup.
To add in-circuit-debugging to Qt Creator, start by navigating in the left pane of the Options dialog to _Devices_. Open tab _Bare Metal_, click _Add_ and according to your debugger hardware choose either _JLink_ or _OpenOCD_. The example below shows how to setup in-circuit-debugging with Segger J-Link/J-Trace.
click _Browse..._ behind _Executable file_ and open the command line version of J-Link GDB Server binary at:
* Windows: `C:\Program Files (x86)\SEGGER\JLink\JLinkGDBServerCL.exe`
* Linux: `/opt/SEGGER/JLink/JLinkGDBServer`
Make sure the _Target interface_ is set to _SWD_ and adjust the speed according to your J-Link hardware (the [following page](https://www.segger.com/products/debug-probes/j-link/models/model-overview/) lists the maximum target interface speed of Segger products). Under _Device:_ use the STM32 chip according to your hardware. For Jumper T16 and RadioMaster TX16S, this is for example _STM32F429BI_.
The remaining settings can be left at default, click _Apply_
[![Qt Creator JLink setup](../assets/images/build/qtcreator/QtCreatorJLink.png)](../assets/images/build/qtcreator/QtCreatorJLink.png)
Navigate to tab _Devices_. Click _Add.._, pick _Bare Metal Device_ and click _Start Wizard_. Give it a name, such as `STM32`. Pick a _GDB server provider:_ according to your debugger hardware either _JLink_ or _OpenOCD_. If you do not possess a debugger hardware, you can choose _None_ here. Click _Finish_, click _Apply_.
[![Qt Creator Devices](../assets/images/build/qtcreator/QtCreatorDevices.png)](../assets/images/build/qtcreator/QtCreatorDevices.png)
### Creating a Kit for building firmware for STM32 µCs
This step gathers the options for building for STM32 microcontrollers that we have prepared in the last steps.
In the left pane of Qt Creator Options dialog, choose _Kits_ and navigate to similarly named tab _Kits_. Add a new kit by clicking _Add_. Give it a name, like `STM32`. Under _Device type:_ pick _Bare Metal Device_.
If under _Device:_ _STM32 (default for Bare Metal)_ is not already automagically selected, pick it from the drop-down box. In fields _Compiler:_ choose our previously prepared _GCC C ARM_ and _GCC ARM_ options. For field _Debugger:_, choose our prepared _GDB ARM_. As there is no Qt code in our firmware for radio µC, select `None` for the _Qt version_. Click _Apply_.
Next, we need to result to a trick to disable CMake to run a so called _simple test_, when loading a project. This is required to avoid a warning in present cross-compilation situation (cross-compilation here means that we compile for ARM architecture in STM32 microcontrollers under x86/x64 architecture). Click _Change..._ behind _CMake Configuration_ and append the following two lines in _Edit CMake Configuration_ dialog:
```
CMAKE_CXX_COMPILER_WORKS:STRING=1
CMAKE_C_COMPILER_WORKS:STRING=1
```
and click _OK_ for the _Edit CMake Configuration_ dialog. Click _Apply_ in the Qt Creator Options dialog.
[![Qt Creator CMake Configuration](../assets/images/build/qtcreator/QtCreatorCMakeConfiguration.png)](../assets/images/build/qtcreator/QtCreatorCMakeConfiguration.png)
Verify that in the Kits list, our newly created _STM32_ kit is selected, then click _Make Default_
[![Qt Creator Kits](../assets/images/build/qtcreator/QtCreatorKits.png)](../assets/images/build/qtcreator/QtCreatorKits.png)
Depending on your hardware debugger maximum target speed, flashing STM32 µC in the radio can take some moments. The default wait time in Qt Creator for GNU debugger (GDB) is 20 seconds, which is typically a bit short for STM32 chips with larger memories and results in an unnecessary pop-up. Next, we will prolong the default waiting time. In the left pane of Qt Creator Options dialog click _Debugger_ and navigate to _GDB_ tab. Set _GDB timeout_, e.g. to 60 seconds:
[![Qt Creator GDB timeout](../assets/images/build/qtcreator/QtGDBtimeout.png)](../assets/images/build/qtcreator/QtGDBtimeout.png)
Click _OK_ to close the options dialog.
This concludes setting up Qt Creator for EdgeTX.
## Loading EdgeTX source tree into Qt Creator
In the following, we assume that you followed the instructions setting up the build environment and building EdgeTX firmware (for Windows 10 or for Ubuntu 20.04) and have created a dedicated EdgeTX folder (`C:\edgetx` for Windows or `~/edgetx` for Linux) and downloaded or git cloned EdgeTX source under this dedicated folder.
For the sake of clarity, we will create two new folders to put the output of our Qt build. Create two new empty folders:
* Windows: `C:\edgetx\build-edgetx-qt-fw` and `C:\edgetx\build-edgetx-qt-comp_sim_libsim`
* Linux: `~/edgetx/edgetx-v2.4/build-qt-fw` and `~/edgetx/edgetx-v2.4/build-qt-comp_sim_libsim`
Back in Qt Creator, let's import next the EdgeTX source files into a project. From Qt Creator menu, choose _File_ -> _Open File or Project..._. Open:
* Windows: `C:\edgetx\edgetx24\CMakeLists.txt`
* Linux: `~/edgetx/edgetx-v2.4/CMakeLists.txt`
Next we need to pick the kits for building. If not already automatically selected, pick _STM32_ that is required for building firmware for ARM architecture. Presently, only under Ubuntu, you can also select _Desktop_ to build Companion, Simulator and radio firmware simulator libraries. If there show up any _Imported Kits_, deselect them (typically only happens if you do not open the project for the first time).
Click _Details_ behind _STM32_ to unfold a build type selection dialog. As we are presently only interested in debugging, leave it selected, but you can deselect all other three options (_Release_, _Release with Debug Information_ and _Minimum Size Release_). Click _Browse..._ behind _Debug_ and open the following folder as build output location:
* Windows: `C:\edgetx\build-edgetx-qt-fw`
* Linux: `~/edgetx/edgetx-v2.4/build-qt-fw`
If you opted for building also Companion, Simulator and radio firmware simulator libraries under Ubuntu, click _Details_ behind _Desktop_ and also here, leave only _Debug_ selected. Click _Browse..._ and provide `~/edgetx/edgetx-v2.4/build-qt-comp_sim_libsim` as build target location.
[![Qt Creator Project Kit Selection](../assets/images/build/qtcreator/QtCreatorProjectKitSelection.png)](../assets/images/build/qtcreator/QtCreatorProjectKitSelection.png)
Click _Configure Project_.
Click on _Projects_ on the left vertical button bar (so called Mode Selector) and verify that _STM32_ -> _Build_ is currently selected.
Qt Creator presents us the build configuration options as a selection list. These match the previous CMake command line options. As an example, we will select to build for RadioMaster TX16S using matching options we listed in the command line build example for Windows 10 and Ubuntu Linux 20.04 pages.
* Look for DEFAULT -> DEFAULT_MODE and enter 2 into the value field on the right
* GVARS should be already selected
* Disable HELI (if you like)
* LUA -> LUA should already be selected
* PCB list is presented as a drop-down options list, choose here `X10` for TX16S
* type in PCBREV field `TX16S` (instead of default 2014)
* under PPM -> PPM_UNIT, select US from the dropdown list
Please note that _INTERNAL_GPS_ is not listed, so we need to add it manually. Click _Add_, select as type _Boolean_ and type `INTERNAL_GPS` and select it (make the state to ON).
[![Qt Creator CMake Options](../assets/images/build/qtcreator/QtCreatorCMakeOptions.png)](../assets/images/build/qtcreator/QtCreatorCMakeOptions.png)
In case you plan performing in-circuit-debugging, you might want to turn off _UNEXPECTED_SHUTDOWN_, in order not to enter EdgeTX _Emergency Mode_ screen on every boot that was not previously nicely shut-down. Be aware though that this has the potential to corrupt the file system on microSD card, thus ideally use a separate card for debugging, or at least make sure the file system is OK, before you go and fly with it.
Click _Apply Configuration Settings_. Please wait for the process to end, it can take some moments.
Under _Build Steps_, click _Details_ to open a selection menu of what to build. Here, we only want to build and debug _firmware_, thus select _firmware_ and then deselect _all_.
[![Qt Creator Build Steps](../assets/images/build/qtcreator/QtCreatorBuildSteps.png)](../assets/images/build/qtcreator/QtCreatorBuildSteps.png)
We need to add two environment variables. Under _Build Environment_ click _Details_ to the right of _Use System Environment_ to unfold the variable list.
Click _Add_ and give the variable a name `C_INCLUDE_PATH` with value `C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\arm-none-eabi\include`
Click once more _Add_ to add a second environment variable with a name `CPLUS_INCLUDE_PATH` and a bit longer value `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`
[![Qt Creator Build Environment](../assets/images/build/qtcreator/QtCreatorBuildEnvironment.png)](../assets/images/build/qtcreator/QtCreatorBuildEnvironment.png)
Now, we should have everything set up. Let's set our deploy target by clicking in the bottom left of Qt Creator window the chip symbol with OpenTX and Debug labels. Choose _STM32_ as Kit and _firmware (on STM32)_ as Run target:
[![Qt Creator Deploy Target](../assets/images/build/qtcreator/QtCreatorDeployTarget.png)](../assets/images/build/qtcreator/QtCreatorDeployTarget.png)
## Building EdgeTX firmware with Qt Creator
To test if building works, click the hammer icon (Build button) on lower left corner to build firmware. On the bottom of Qt Creator window, you can navigate to _4 Compile Output_ and click it to see compiler progress. After some minutes you should have _firmware.bin_ and _firmware.elf_ files built and saved in `C:\edgetx\build-edgetx-qt-fw`
[![Qt Creator Build Completed](../assets/images/build/qtcreator/QtCreatorBuildCompleted.png)](../assets/images/build/qtcreator/QtCreatorBuildCompleted.png)
## Editing source code with Qt Creator
To edit the source of EdgeTX, click in Mode Selector _Edit_. Unfold _OpenTX [2.4]_ and open a source file you would like to edit under `radio -> src -> firmware -> Source Files`. Qt Creator offers many wide established features like syntax highlighting, code completion, refactoring, integrated version control and many more.
[![Qt Creator Code Completion](../assets/images/build/qtcreator/QtCodeCompletion.png)](../assets/images/build/qtcreator/QtCodeCompletion.png)
For deeper instructions into Qt Creator, please see [Qt Creator Manual](https://doc.qt.io/qtcreator/).
* You can find the code for radio firmware and libsimulator under `radio/src/firmware/Source Files` (main entry point is in `opentx.cpp`).
* Companion software is under `companion/src/companion/Source Files` (main entry point is in `companion.cpp`)
* Simulator source code you find under `companion/src/simulator/Source Files` (main entry point is in `simulator.cpp`)
Please note that Companion, Simulator and libsimulator should be built using the _Desktop kit_ and not _STM32 kit_, as these will run on x86/x64 and not on ARM! Currently building radio simulator library does not yet work under Windows!
+103
View File
@@ -0,0 +1,103 @@
# Build Instructions using Docker and Windows 10
Work-in-progress page
# Building EdgeTX on Windows 10 using Docker images
## Download and install [Docker Desktop for Windows](https://www.docker.com/products/docker-desktop/)
## Download and install [GWSL](https://github.com/Opticos/GWSL-Source/releases/) to run Linux Companion and Simulator
- Run GWSL to configure it. Accept page 1 and 2 defaults and add disable access control on page 3
## Fetch a local copy of the EdgeTX repository or update your existing local EdgeTX repository
```
git clone --recursive -b main https://github.com/EdgeTX/edgetx.git EdgeTX
```
- If you already have a local EdgeTX repository don't forget to update the submodules too, e.g.:
```
git fetch origin
git checkout main
git submodule update --init --recursive
```
## Run build (example TX16s)
- open a PowerShell
- cd to your local repository
```
docker run --name="ETXDocker" -it --rm --mount src="$(pwd)",target="/src",type=bind ghcr.io/edgetx/edgetx-dev bash
cd src
mkdir -p build-output
cd build-output
cmake -DPCB=X10 -DPCBREV=TX16S -DCMAKE_BUILD_TYPE=Release ../
make configure
make -C arm-none-eabi -j$(nproc) firmware
make -C native -j$(nproc) libsimulator
make -C native -j$(nproc) companion210
make -C native -j$(nproc) simulator210
```
- find the results in folder build-output of your local build repository folder
# More Cmake build options
X9d+:
```
-DPCB=X9D+ -DCMAKE_BUILD_TYPE=Release
```
X7:
```
-DPCB=X7 -DCMAKE_BUILD_TYPE=Release
```
TX12:
```
-DPCB=X7 -DPCBREV=TX12 -DCMAKE_BUILD_TYPE=Release
```
TX16S:
```
-DPCB=X10 -DPCBREV=TX16S -DCMAKE_BUILD_TYPE=Release
```
# Running Linux Companion and Simulator
## Running Companion
- make sure GWSL is running
- open a PowerShell
- in case you don't know your IP address enter 'ipconfig' to find out
- cd to your build folder
- remember to replace IP_OF_YOUR_WINDOWS_MACHINE with your IP address and enter:
```
docker run --name="ETXDocker" -it --rm --mount src="$(pwd)",target="/src",type=bind ghcr.io/edgetx/edgetx-dev bash
export DISPLAY=IP_OF_YOUR_WINDOWS_MACHINE:0.0
cd src
./native/companion210
```
## Running Simulator
- make sure GWSL is running
- open a PowerShell
- in case you don't know your IP address enter `ipconfig` to find out
- `cd` to your build folder
- remember to replace IP_OF_YOUR_WINDOWS_MACHINE with your IP address and enter:
```
docker run --name="ETXDocker" -it --rm --mount src="$(pwd)",target="/src",type=bind ghcr.io/edgetx/edgetx-dev bash
export DISPLAY=IP_OF_YOUR_WINDOWS_MACHINE:0.0
cd src
./native/simulator210
```
# Needful things
- Should you get a message like ```container name "/ETXDocker" is already in use``` open a PowerShell and enter ```docker stop ETXDocker```
- If you need to update the docker image open a PowerShell and enter: ``` docker rmi ghcr.io/edgetx/edgetx-dev```. The latest image will then be downloaded at next docker run
- before running the simulator you need to run companion and create a radio profile
- companion and simulator won't have audio. If you need audio you might find [PulseAudio on WSL2](https://www.linuxuprising.com/2021/03/how-to-get-sound-pulseaudio-to-work-on.html) useful
# References
see [EdgeTX Build repository](https://github.com/EdgeTX/build-edgetx)
+218
View File
@@ -0,0 +1,218 @@
# Build Instructions under Windows
Note: The instructions on this page apply only for building V3.0.0-dev and later versions of EdgeTX.
## Table of Contents
* [Toolchain setup](#toolchain-setup)
1. [Visual Studio](#visual-studio)
2. [ARM GNU Toolchain](#arm-gnu-toolchain)
3. [Folders for libraries of the project](#folders-for-libraries-of-the-project)
4. [Build script](#build-script)
5. [NSIS Windows installer creator](#nsis-windows-installer-creator)
6. [Python package manager uv](#python-package-manager-uv)
7. [Python virtual environment](#python-virtual-environment)
8. [Qt development framework](#qt-development-framework)
* [Building](#building)
1. [Fetch the EdgeTX project](#fetch-the-edgetx-project)
2. [Target specific build script](#target-specific-build-script)
***
## Toolchain setup
### Visual Studio
Download and start Visual Studio 2022 Community installer: https://visualstudio.microsoft.com/downloads/
To start the installer in English to more easily follow the selection below, open a command prompt and add `--locale en-US` to the installer executable when starting it. Under `Individual components` tab, minimally select the following components:
```
Under Code tools:
Git for Windows
Under Compilers, build tools and runtimes:
C++ Clang Compiler for Windows (19.1.5)
C++ CMake tools for Windows
MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest) (is typically already selected by default)
Under SDKs, libraries, and frameworks:
Windows 11 SDK (10.0.26100.4654)
```
<img width="475" src="https://github.com/user-attachments/assets/f259b126-e1cf-43c2-883b-834993428769" />
In the a dialog asking if you want to continue without workloads, you can accept just to `Continue`. You can skip making an account and logging in, if asked by the installer.
### ARM GNU Toolchain
Download https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-mingw-w64-x86_64-arm-none-eabi.exe
Install it to default location and select Add path to environment variable.
<img width="480" src="https://github.com/user-attachments/assets/c5d6f6e2-fe70-4b91-8c23-f69b9ba6d45d" />
### Folders for libraries of the project
Create a folder to hold the development environment and the project, e.g. `C:\edgetx`.
Create a subfolder `C:\edgetx\build-tools`.
Download https://github.com/libsdl-org/SDL/releases/download/release-2.32.8/SDL2-devel-2.32.8-VC.zip and unpack it to `C:\edgetx\build-tools\SDL2`
### Build script
Create `C:\edgetx\edgetx_build.cmd` with following contents:
```
@echo off
time /t
set CC=clang.exe
set CXX=clang++.exe
set NSIS_EXE=c:\Program Files (x86)\NSIS\makensis.exe
set SDL2=%EDGETX_BUILD_TOOLS%\SDL2\cmake
set QT_DIR=%EDGETX_BUILD_TOOLS%\Qt\6.9.0\msvc2022_64
set PATHS="-DSDL2_DIR=%SDL2%"
set CMAKE_PREFIX_PATH="-DCMAKE_PREFIX_PATH=%QT_DIR%"
set LANGUAGE="-DTRANSLATIONS=%BUILD_LANGUAGE%"
echo ********************************************
echo Building radio: %BUILD_RADIO%
echo Language: %BUILD_LANGUAGE%
echo Debug build: %BUILD_DEBUG%
echo Firmware: %BUILD_FW%
echo Companion: %BUILD_CPN%
echo Installer: %BUILD_INSTALLER%
echo ********************************************
REM
REM prepare build
REM
cd %EDGETX_REPO%
if %BUILD_DEBUG%=="yes" (
set BUILD_TYPE="-DDEBUG=YES;-DCMAKE_BUILD_TYPE=Debug"
) else (
set BUILD_TYPE="-DCMAKE_BUILD_TYPE=Release"
)
cd %EDGETX_MAIN_DIR%
set BUILD_FOLDER="build-output-%BUILD_RADIO%"
mkdir %BUILD_FOLDER%
cd %BUILD_FOLDER%
call "c:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -startdir=none -arch=x64 -host_arch=x64
call "%EDGETX_BUILD_TOOLS%\.venv\Scripts\activate.bat"
REM
REM start build
REM
cmake -G Ninja %BUILD_OPTIONS% %PATHS% %CMAKE_PREFIX_PATH% %LANGUAGE% %BUILD_TYPE% %EDGETX_REPO%
if %BUILD_FW%=="yes" (
ninja arm-none-eabi-configure
ninja -C arm-none-eabi firmware
)
REM If building installer is requested, need to build Companion
if %BUILD_INSTALLER%=="yes" GOTO build_cpn
if %BUILD_CPN%=="yes" GOTO build_cpn
REM else
GOTO exit_script
:build_cpn
ninja native-configure
ninja -C native libsimulator
ninja -C native simulator
ninja -C native companion
if %BUILD_INSTALLER%=="yes" (
ninja -C native install
%QT_DIR%\bin\windeployqt --libdir native\_install\bin --plugindir native\_install\plugins --no-compiler-runtime --no-translations --release native
robocopy %QT_DIR%\bin\ native\_install\bin qt.conf
"%NSIS_EXE%" native/companion/companion.nsi
)
REM The following is in order to be able to run companion and simulator binaries directly in build output folder
%QT_DIR%\bin\windeployqt --libdir native --plugindir native\plugins --no-compiler-runtime --no-translations --release native
copy %EDGETX_BUILD_TOOLS%\SDL2\lib\x64\SDL2.dll %EDGETX_MAIN_DIR%\%BUILD_FOLDER%\native\
REM
REM done
REM
:exit_script
call "%EDGETX_BUILD_TOOLS%\.venv\Scripts\deactivate.bat"
time /t
pause
```
### NSIS Windows installer creator
Install the NSIS compiler from https://nsis.sourceforge.io/Download
<img width="480" src="https://github.com/user-attachments/assets/bb8bf3ac-10a1-4bee-b65e-7f914acb79c0" />
### Python package manager uv
Open a command prompt and navigate to `C:\edgetx\build-tools`.
Install Python package manager uv according to the installation instructions at: https://docs.astral.sh/uv/getting-started/installation/#__tabbed_1_2
### Python virtual environment
Continue on the command prompt at `C:\edgetx\build-tools`:
```
uv venv
uv pip install clang lz4 jinja2 pillow pyelftools aqtinstall pydantic
```
### Qt development framework
Continue on the command prompt at `C:\edgetx\build-tools` to install Qt 6.9.0 into the Python virtual environment:
```
mkdir Qt
cd Qt
call "C:\edgetx\build-tools\.venv\Scripts\activate.bat"
aqt install-qt windows desktop 6.9.0 win64_msvc2022_64 -m qtmultimedia qtserialport
call "C:\edgetx\build-tools\.venv\Scripts\deactivate.bat"
```
Reboot your computer.
## Building
### Fetch the EdgeTX project
Open command prompt at `C:\edgetx` and clone the EdgeTX repo:
```
git clone --recursive -b <branch> https://github.com/EdgeTX/edgetx.git
```
where <branch> is the branch or tag you wish to use, e.g. `main` for the main development brach, or use a tag, if you wish to download a release version, such as `v3.0.1`. This will fetch the project into `C:\edgetx\edgetx`.
### Target specific build script
Create a radio specific build script, e.g. here for example for RadioMaster TX16s (create it e.g. as `C:\edgetx\build_tx16s.cmd`):
```
@echo off
set EDGETX_MAIN_DIR=C:\edgetx
set EDGETX_REPO=C:\edgetx\edgetx
set EDGETX_BUILD_TOOLS=C:\edgetx\build-tools
set BUILD_RADIO="TX16s"
set BUILD_OPTIONS="-DPCB=X10;-DPCBREV=TX16S"
set BUILD_LANGUAGE="EN"
set BUILD_DEBUG="no"
set BUILD_FW="yes"
set BUILD_CPN="yes"
set BUILD_INSTALLER="yes"
call "%EDGETX_MAIN_DIR%\edgetx_build.cmd"
```
and start it.
After the build finishes, you can find the binaries under `C:\edgetx\build-output-<BUILD_RADIO>` (firmware binary under subfolder `arm-none-eabi`, Companion and Simulator binaries together with simulator library under folder `native` and Companion installer under subfolder `native\companion`).
Note! Be sure to wipe the `C:\edgetx\build-output-<BUILD_RADIO>` content every time you change the build options.
See https://github.com/EdgeTX/edgetx/blob/main/tools/build-common.sh for BUILD_OPTIONS to use for various EdgeTX supported radios. Note that whereas the shell script at GitHub has spaces as delimeters between the keys, then in the Windows batch file, you neet to use semicolon as a delimeter.