Skip to content

OpenTX Windows Build Instructions

Max Paperno edited this page Mar 24, 2017 · 1 revision

Note: For OpenTX 2.2+ there is an alternative method which has fewer prerequisites and may be simpler to set up:
see OpenTX 2.2 Build With QtCreator (Win Linux OSX)

For 2.0 and 2.1 only:

Install VC++ 10

NOTE: Visual Studio 10 is now only available with MSDN subscription: https://msdn.microsoft.com/en-us/library/dd831853(v=vs.100).aspx
Install and launch VC10 and close it again
Install VS10 SP1: https://www.microsoft.com/en-us/download/details.aspx?id=23691

You may be able to use latest Visual Studio Community Edition instead. NOT TESTED!
Alternatively, you could use Windows 7 SDK which includes the MSVC10 compiler, and build using QtCreator (which is included in Qt downloads, below) or the MSVC command-line interface (a shortcut is installed with the SDK).

Install QT 4.8.7 for VS2010

http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-opensource-windows-x86-vs2010-4.8.7.exe

Install mingw-get-setup

https://sourceforge.net/projects/mingw/files/
Run it and select packages:

  • mingw32-base
  • mingw32-gcc-g++ (bin/dev)
  • msys-grep
  • msys-coreutils

File -> Apply changes

  • Manually add "C:\MinGW\bin" to PATH
  • Manually add "C:\MinGW\msys\1.0\bin" to PATH
  • Navigate to C:\MinGW\bin and make a copy of mingw32-make.exe called make.exe

Xerces

You want V3.1.1 for Visual Studio 10: http://archive.apache.org/dist/xerces/c/3/binaries/xerces-c-3.1.1-x86-windows-vc-10.0.zip Unzip the contents of the zip to "C:\Programs" Rename the folder "xerces-c-3.1.1" to "xerces-vc" so you have "C:\Programs\xerces-vc"

XSD

http://www.codesynthesis.com/download/xsd/3.3/windows/i686/xsd-3.3.0-i686-windows.zip
Unzip xsd-3.3.0-i686-windows.zip to "C:\Programs"
Rename the "folder xsd-3.3.0-i686-windows" to "xsd-3.3.0" so you have "C:\Programs\xsd-3.3.0"
Navigate to "C:\Programs\xsd-3.3.0\bin" Make a copy of xsd.exe and call it xsd-cxx.exe (because there is another program named xsd.exe (Microsoft) on the system.

Install TortoiseSVN

https://tortoisesvn.net/downloads.html
Select "command line client tools" at install

Install WinAVR

https://sourceforge.net/projects/winavr/files/WinAVR/

MSinttypes

https://github.com/chemeris/msinttypes/tree/7636cabe55318824dc702d15b69711f5d7c30250 Copy the 2 files to "C:\Programs\msinttypes". DON'T take a newer commit than this, it won't work.

Dirent

http://softagalleria.net/dirent.php
Unzip the contents to "C:\Programs\dirent"

Only if you want to build 2.0: Copy "C:\Programs\dirent\include\dirent.h" into "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"

For 2.2 only:

Install Visual Studio Community Edition 2015 (or later)

https://www.visualstudio.com/downloads/

Select "Custom" installation, under "Programming languages" select "Visual C++". You can deselect "Microsoft Foundation Classes for C++" in the child elements to save about 2GB.

Install QT 5.7 for VS2015

https://www.qt.io/download-open-source/#section-2

You only need "Qt\Qt 5.7\msvc2015 32-bit", the other libs and tools can be deselected.

Install MinGW or MinGW-w64 (optional to build firmware)

MinGW: https://sourceforge.net/projects/mingw/files/Installer/

MinGW-w64 (recommended): https://mingw-w64.org/doku.php/download (choose "Mingw-builds" or "Win-builds" package). Note: Both packages also include an optional Python interpreter, recommended if you don't have Python installed already.

Common tools needed for all of 2.0, 2.1 and 2.2 (everything can be installed at the same time)

Install cmake

https://cmake.org/download/
Choose "Add to system path for all users"

Install Python 2.7

https://www.python.org/downloads/
Select "Add Python.exe to path"

Install PyQt4 and Python 2.7

https://sourceforge.net/projects/pyqt/files/PyQt4/

PThreads v2.8 (NOT 2.9!)

2.8.0 exe intaller
OR
2.8.0 gz archive
Run or unpack the downloaded file and place into "C:\Programs\pthreads"

Install GCC for ARM 4.7-2013q3 (optional to build firmware):

https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q3-update/+download/gcc-arm-none-eabi-4_7-2013q3-20130916-win32.exe
Select "Add path to environment variable"

LibSDL 1.2 (optional for sound in simulator)

http://www.libsdl.org/download-1.2.php
Download the Win32 Visual C++ Development Libraries
Unzip SDL-x.x.xx-win32.zip to "C:\Programs\SDL" (x.x.xx represents version number, get the latest)

Only if you want to be able to build 2.0 and 2.1: Navigate to "C:\Programs\SDL\lib\x86" or if you have a 64bit system "C:\Programs\SDL\lib\x64". Select all the files in this directory, copy them, go one directory level up, paste them.

Install NSIS 2.51 (optional, to make installer packages):

https://sourceforge.net/projects/nsis/files/NSIS%202/2.51/

Install Git (optional):

Any git client will do, e.g. Git, SourceTree, GitHub Desktop, or TortoiseGit.

Get the code

If using a Git client, clone https://github.com/opentx/opentx.git and then checkout the branch you want to build.

You can also download a .zip archive directly from GitHub (make sure you have the correct branch selected before downloading)

Code branch names vs. OpenTx version: 2.0 for 2.0, master for 2.1, next for 2.2

Either way, put the code into a folder w/out any spaces, e.g. c:\opentx\code

Building Companion:

Create companion build directory, e.g. c:\opentx\companion-build
Navigate to that folder and prepare the build:
For 2.2: cmake -G "Visual Studio 14" ../code/ -DCMAKE_PREFIX_PATH=C:\Qt\5.7\msvc2015
For 2.1 and 2.0: cmake -G "Visual Studio 10" ../code/ -DCMAKE_PREFIX_PATH=C:\Qt\4.8.7
Open the resulting OpenTX.sln file in Visual Studio.
Select "Release" in the dropdown on top that may show "Debug" by default
Right-click "ALL_BUILD" in the solution explorer and click "Build".
For 2.2: Right-click "install" in the solution explorer and click "Build". This will copy all required DLL files into the build folder ("C:\opentx\companion-build") and you can run companion.exe or simulator.exe from there directly.
Optional (if you installed NSYS): Right-click "installer" in the solution explorer and click "Build".
You will find companion-windows-x.y.z.exe in folder "C:\opentx\companion-build\companion" (2.2) or in "C:\opentx\companion-build" (2.1 and 2.0), which you can now launch and install!

Building firmware 2.2:

Select the correct branch using your git client (2.0 for 2.0, master for 2.1, next for 2.2)
Create firmware build directory, e.g. c:\opentx\firmware-build
Navigate to that folder and prepare the build for the radio type you want to target and its options, e.g
cmake -G "MinGW Makefiles" ../code/ -DCMAKE_PREFIX_PATH=C:\Qt\Qt5.7.0\5.7\msvc2015 -DPCB=X9D -DHELI=YES -DGVARS=YES -DTRANSLATIONS=EN -DLUA=YES -DMIXERS_MONITOR=YES -DTIMERS=3
CMake may complain about sh.exe being in the path (e.g. if you have cygwin or msys installed). Ignore it and just run the same command a 2nd time, it will work.
Start build with mingw32-make -j 4 firmware (replace 4 with the number of cores on your processor for best performance)
You will find "firmware.bin" ready to flash using companion in that same folder!

Building firmware 2.1 or 2.0:

Navigate to the radio source directory e.g. c:\opentx-21\code\radio\src
Make sure the enviroment is clean:

del /s *.o
make clean

Run the build for the radio type you want to target and its options, e.g mingw32-make PCB=TARANIS PCBREV=REVPLUS HELI=YES GVARS=YES TRANSLATIONS=EN LUA=YES MIXERS_MONITOR=YES
You will find "opentx.bin" ready to flash using companion in that same folder!

Clone this wiki locally