Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Windows: add Cygwin Toolchain, add VMWare Steps, Split up Different Methods #522

Merged
merged 7 commits into from
Jun 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/simulation/jmavsim_windows_cygwin.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/toolchain/cygwin_toolchain_installer.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
131 changes: 14 additions & 117 deletions en/setup/dev_env_windows.md
Original file line number Diff line number Diff line change
@@ -1,122 +1,19 @@
# Windows Installation Instructions

There are a number of ways you can set up a Windows development toolchain for PX4. These allow you to build for NuttX/Pixhawk and jMAVSim simulator targets.
There are a number of ways you can set up a Windows development toolchain for PX4. Depending on what option you choose these allow you to build for NuttX/Pixhawk and jMAVSim simulator targets.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adopted some of these general introduction comments because they seem to be outdated/only apply to the old msys based toolchain.


> **Warning** The Windows toolchains are not officially supported (and we discourage their use). They are unbearably slow during Firmware compilation and do not support new boards like Snapdragon Flight. They also cannot run the standard robotics software packages many developers use to prototype computer vision and navigation.
> **Warning** The Windows toolchains are not officially supported (and we discourage their use). Depending on the option you choose they might be slow and not support all targets. Some options also cannot run the standard robotics software packages many developers use to prototype computer vision and navigation.

<span></span>
> **Tip** Before starting to develop on Windows, consider installing a dual-boot environment with [Ubuntu](http://ubuntu.com).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the individual pro/con lists, but I wonder if it might also be worth having an overview of all of them in a table. Headings/fields like Gazebo, Jmavsim, NuttX, Native, Memory/Resources etc? Just an idea.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds super useful, it could even be colored red, green, yellow... I'll have a look at how to do that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try avoid using colour. It is very rarely necessary or done well. The key to great doc is minimal use of highlighting and smart use of structure/headings :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks for the hint, I can learn a lot from you. I'll kill the "coloring project" and make a non-highlighted table.



## Native Toolchain
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split up/copied all the existing instructions for the different options/methods without changing them to separate pages and hence new files. Only renaming the title of the method.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the way you have done this split is excellent.


Download and install these on your system:

* [PX4 Toolchain Installer v14 for Windows Download](http://firmware.diydrones.com/Tools/PX4-tools/px4_toolchain_installer_v14_win.exe) (32/64 bit systems, complete build system, drivers)
* [PX4 USB Drivers](http://pixhawk.org/static/px4driver.msi) (32/64 bit systems)


## Bash on Windows (NEW!)

Windows users can alternatively install a *slightly modified* Ubuntu Linux PX4 development environment within [Bash on Windows](https://github.com/Microsoft/BashOnWindows), and use it to:
* Build firmware for NuttX/Pixhawk targets.
* Run the PX4 JMAVSim simulation (using a Windows-hosted X-Windows app to display the UI)

### Setup Environment

The easiest way to setup the environment is to use the <strong><a href="https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/windows_bash_nuttx.sh" target="_blank" download>windows_bash_nuttx.sh</a></strong> script (details for script are [given below](#build_script_details)).

To setup the development environment:
1. Install [Bash on Windows](https://github.com/Microsoft/BashOnWindows).
1. Open the bash shell.
1. Download the **windows_bash_nuttx.sh**:
```
wget https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/windows_bash_nuttx.sh
```
1. Run the script using the command below (acknowledging any prompts as required):
```sh
source windows_bash_nuttx.sh
```

### Build Firmware

To build the firmware (i.e. for px4fmu-v4):
1. Enter the following commands in the bash shell:
```
cd ~/src/Firmware
make px4fmu-v4_default
```
On successful completion you'll find the firmware here: `Firmware/build/px4fmu-v4_default/px4fmu-v4_default.px4`

> **Note** The `make` commands to build firmware for other boards can be found in [Building the Code](../setup/building_px4.md#nuttx--pixhawk-based-boards)

1. You can flash the custom firmware on Windows using *QGroundControl* or *Mission Planner* (it is not possible to directly flash the firmware from within the bash shell using the `upload` command).


### Simulation (JMAVSim)

Bash on Windows does not include support for UI libraries. In order to display the jMAVSim UI you will first need to install an X-Window application like [XMing](https://sourceforge.net/projects/xming/) into Windows.

To run JMAVSim:
1. Install and start [XMing](https://sourceforge.net/projects/xming/) on Windows.
1. Enter the following command in the bash shell:
```sh
export DISPLAY=:0
```
> **Tip** Add this line to the Ubuntu **.bashrc** file if you don't want to enter it every session.
1. Start PX4 and jMAVSim in the bash shell:
```sh
make posix jmavsim
```
The JMAVSim UI is then displayed in XMing as shown below:

![jMAVSimOnWindows](../../assets/simulation/JMAVSim_on_Windows.PNG)

> **Caution** Gazebo can similarly be run within Ubuntu Bash for Windows, but too slow to be useful. To try this, follow the [ROS kinetic install guide](http://wiki.ros.org/kinetic/Installation/Ubuntu) and run Gazebo in the Bash shell as shown:
```sh
export DISPLAY=:0
export GAZEBO_IP=127.0.0.1
make posix gazebo
```


### Build Script Details {#build_script_details}

The <a href="https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/windows_bash_nuttx.sh">windows_bash_nuttx.sh</a> build script modifies the Ubuntu build instructions to remove Ubuntu-specific and UI-dependent components, including the *Qt Creator* IDE and the simulators.

In addition, it uses a [64 bit arm-none-eabi compiler](https://github.com/SolinGuo/arm-none-eabi-bash-on-win10-.git)
since BashOnWindows doesn't run 32 bit ELF programs (and the default compiler from `https://launchpad.net/gcc-arm-embedded` is 32 bit).

To add this compiler to your environment manually:

1. Download the compiler:
```sh
wget https://github.com/SolinGuo/arm-none-eabi-bash-on-win10-/raw/master/gcc-arm-none-eabi-5_4-2017q2-20170512-linux.tar.bz2
```
1. Unpack it using this command line in the Bash On Windows console:
```sh
tar -xvf gcc-arm-none-eabi-5_4-2017q2-20170512-linux.tar.bz2
```
This will unpack the arm gcc cross-compiler to:
```
gcc-arm-none-eabi-5_4-2017q2/bin
```
1. Add the to the environment (add the line to your bash profile to make the change permanent)
```
export PATH=$HOME/gcc-arm-none-eabi-5_4-2017q2/bin:\$PATH
```

## Virtual Machine-Hosted Toolchain

Windows developers can also run the PX4 toolchain in a virtual machine. The installation and setup of PX4 within the VM is exactly the same as on a native Linux computer.

> **Tip** Allocate as many CPU and memory resources to the VM as possible.

While using a VM is a very easy way to set up and test an environment for building firmware, users should be aware:
1. Firmware building will be slower than native building on Linux.
1. The JMAVSim frame rate be much slower than on native Linux. In some cases the vehicle may crash due to issues related to insufficient VM resources.
1. Gazebo and ROS can be installed, but are unusably slow.


<!-- import docs for other tools and next steps. -->
{% include "_addition_dev_tools.txt" %}
> **Tip** We recommend using [Ubuntu Linux](http://ubuntu.com) for development. Consider setting up a dual-boot setup next to your existing Windows installation.

| | [Cygwin Toolchain](../setup/dev_env_windows_cygwin.md) | [Virtual Machine Toolchain](../setup/dev_env_windows_vm.md) | [Bash on Windows Toolchain](../setup/dev_env_windows_bash_on_win.md) | [Msys Toolchain](../setup/dev_env_windows_msys.md) |
|---|---|---|---|---|
| Installation | MSI installer or Script | Manual (Hard) | Script | NSIS Installer |
| Native binary execution | yes | no | no | yes |
| Performance | ++ | -- | - | ++ |
| ARM Targets | ++ (quick) | + (VM USB) | + | - (broken) |
| Simulation jMAVSim | ++ | + | + | -- |
| Simulation gazebo | - (not yet) | + (slow) | + (slow) | -- |
| Support | + | ++ (Linux) | +/- | -- |
| Comments | <ul><li>New in 2018</li><li>Slim setup</li><li>Portable</li></ul> | <ul><li>Full Linux features</li><li>CPU & RAM intensive</li><li>Disk space intensive</li></ul> | <ul><li>Official Microsoft solution</li><li>Windows 10 only</li><li>Essentially a VM</li></ul> | <ul><li>No support</li><li>No documentation</li><li>No simulation</li></ul> |
93 changes: 93 additions & 0 deletions en/setup/dev_env_windows_bash_on_win.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Bash on Windows Toolchain

Windows users can alternatively install a *slightly modified* Ubuntu Linux PX4 development environment within [Bash on Windows](https://github.com/Microsoft/BashOnWindows), and use it to:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unchanged, just copied over

* Build firmware for NuttX/Pixhawk targets.
* Run the PX4 JMAVSim simulation (using a Windows-hosted X-Windows app to display the UI)

### Setup Environment

The easiest way to setup the environment is to use the <strong><a href="https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/windows_bash_nuttx.sh" target="_blank" download>windows_bash_nuttx.sh</a></strong> script (details for script are [given below](#build_script_details)).

To setup the development environment:
1. Install [Bash on Windows](https://github.com/Microsoft/BashOnWindows).
1. Open the bash shell.
1. Download the **windows_bash_nuttx.sh**:
```
wget https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/windows_bash_nuttx.sh
```
1. Run the script using the command below (acknowledging any prompts as required):
```sh
source windows_bash_nuttx.sh
```

### Build Firmware

To build the firmware (i.e. for px4fmu-v4):
1. Enter the following commands in the bash shell:
```
cd ~/src/Firmware
make px4fmu-v4_default
```
On successful completion you'll find the firmware here: `Firmware/build/px4fmu-v4_default/px4fmu-v4_default.px4`

> **Note** The `make` commands to build firmware for other boards can be found in [Building the Code](../setup/building_px4.md#nuttx--pixhawk-based-boards)

1. You can flash the custom firmware on Windows using *QGroundControl* or *Mission Planner* (it is not possible to directly flash the firmware from within the bash shell using the `upload` command).


### Simulation (JMAVSim)

Bash on Windows does not include support for UI libraries. In order to display the jMAVSim UI you will first need to install an X-Window application like [XMing](https://sourceforge.net/projects/xming/) into Windows.

To run JMAVSim:
1. Install and start [XMing](https://sourceforge.net/projects/xming/) on Windows.
1. Enter the following command in the bash shell:
```sh
export DISPLAY=:0
```
> **Tip** Add this line to the Ubuntu **.bashrc** file if you don't want to enter it every session.
1. Start PX4 and jMAVSim in the bash shell:
```sh
make posix jmavsim
```
The JMAVSim UI is then displayed in XMing as shown below:

![jMAVSimOnWindows](../../assets/simulation/JMAVSim_on_Windows.PNG)

> **Caution** Gazebo can similarly be run within Ubuntu Bash for Windows, but too slow to be useful. To try this, follow the [ROS kinetic install guide](http://wiki.ros.org/kinetic/Installation/Ubuntu) and run Gazebo in the Bash shell as shown:
```sh
export DISPLAY=:0
export GAZEBO_IP=127.0.0.1
make posix gazebo
```


### Build Script Details {#build_script_details}

The <a href="https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/windows_bash_nuttx.sh">windows_bash_nuttx.sh</a> build script modifies the Ubuntu build instructions to remove Ubuntu-specific and UI-dependent components, including the *Qt Creator* IDE and the simulators.

In addition, it uses a [64 bit arm-none-eabi compiler](https://github.com/SolinGuo/arm-none-eabi-bash-on-win10-.git)
since BashOnWindows doesn't run 32 bit ELF programs (and the default compiler from `https://launchpad.net/gcc-arm-embedded` is 32 bit).

To add this compiler to your environment manually:

1. Download the compiler:
```sh
wget https://github.com/SolinGuo/arm-none-eabi-bash-on-win10-/raw/master/gcc-arm-none-eabi-5_4-2017q2-20170512-linux.tar.bz2
```
1. Unpack it using this command line in the Bash On Windows console:
```sh
tar -xvf gcc-arm-none-eabi-5_4-2017q2-20170512-linux.tar.bz2
```
This will unpack the arm gcc cross-compiler to:
```
gcc-arm-none-eabi-5_4-2017q2/bin
```
1. Add the to the environment (add the line to your bash profile to make the change permanent)
```
export PATH=$HOME/gcc-arm-none-eabi-5_4-2017q2/bin:\$PATH
```


<!-- import docs for other tools and next steps. -->
{% include "_addition_dev_tools.txt" %}
Loading