For various reasons, a custom build of Betaflight might be needed. A user might want to enable certain features that are disabled on his / her target, for example. This guide provides the basic instructions needed to build Betaflight on a Windows system. Two options are given:
A new feature in Windows 10 allows any developer to quickly and easily run an entire linux subsystem in Windows and access it via a bash terminal. This gives developers full use of the entire Linux OS and all of the great existing linux tools and programs. When Bash for Windows is up and running it feels like you sshed into a full Linux box, except the linux distro is actually running alongside Windows locally.
If you use Bash on Windows you can easily build Betaflight exactly as you would for Ubuntu. [For instructions follow the official guide here.](https://msdn.microsoft.com/commandline/wsl/install_guide)
## Building on Windows 7/8/10 using the Cygwin environment
The Cygwin environment provides some functionality similar to a Linux distribution, allowing to build Betaflight in a relatively small (~1 Gb) environment within Windows.
### Installing Cygwin and required packages
Download the Setup*.exe from https://www.cygwin.com/
Execute the downloaded Setup*.exe and step through the installation wizard (no need to customize the settings here). Stop at the "Select Packages" Screen and select the following Packages
The `/dev/betaflight` folder now holds a copy of the current Betaflight source code repository.
### Setup GNU ARM Toolchain
To compile the Betafligth source code for the ARM processors used on the various flight controllers, the GNU ARM Toolchain is required. Versions are important, current Betaflight (4.0.0) requires at least ```arm-none-eabi-gcc``` version ```7.3.1```.
The provided script will install the correct version of the ARM toolchain to the `/dev/betaflight/` directory, which will thus only be avaialble to this project. This method ensures the corerct version is installed and prevents collision with possible other projects you might have.
The manual installation option will install the ARM toolchain system-wide, allowing it to also be used for other projects on the system, should that be necesary.
#### Scripted installation
To install the ARM toolchain, use the `make arm_sdk_install` command within the `/dev/betaflight` directory:
```
Stefan@DESKTOP-U5FUCGO /dev
$ cd /dev/betaflight
Stefan@DESKTOP-U5FUCGO /dev/betaflight
$ make arm_sdk_install
mkdir -p tools
mkdir -p downloads
% Total % Received % Xferd Average Speed Time Time Time Current
To compile your Betaflight binaries; open the Cygwin terminal, enter the Betaflight directory and build the project using the `make` command. You can append TARGET=[HARDWARE] if you want to build anything other than the default NAZE target:
In order to update your local copy of the source code, navigate to the local betaflight repository and use the following steps to pull the latest changes and rebuild your version of betaflight: