User Tools

Site Tools


doc:crazyflie:dev:env:windows

Windows Development Environment

This tutorial will demonstrate how to set up a windows machine to develop, build, and deploy binaries for the crazyflie natively, without use of a VM. Some notes on the setup environment used to write this guide:

  • Using windows 10 – no technical reason why this wouldn't work on Windows 7, 8, or 8.1 though.
  • Whenever presented with a choice, x86 versions of the tools were chosen. It's important to keep this consistent since and x86 emulator won't be able to call amd64 binaries, etc. Using all AMD64 should technically work, though.
  • Cygwin was chosen for a unix environment since it's probably the most common option out there. As stated below, MinGW is probably the best option because it's extremely lightweight and really all you need are a small handful of unix tools.

GNU/Linux Toolchain replacements

A set of common utilities are required for developing, including (but not necessarily limited to):

  • Make
  • Git
  • Tar (used in the crazyflie2-nrf-firmware project to unzip the nordic SDK)
  • Unzip (used in the crazyflie2-nrf-firmware project to unzip the nordic SDK)
  • Wget (used in the crazyflie2-nrf-firmware project to download the nordic SDK)

For these basic tools, it's recommended to get a Linux shell environment running on windows. There are a variety of options:

Option #1: Cygwin

Cygwin aspires to be a full POSIX environment for windows and is the most fully featured option, but also the most heavyweight. See installation details at http://cygwin.com. Be sure to select at least all of the packages listed above, as well as whatever else you use to develop (vim, etc).

Option #2: MinGW

MinGW is a much more minimalist toolchain instead of a full POSIX environment. It's essentially a set of common unix tools built as standalone win32 exes invoked from a cmd prompt. This is probably the recommended option if you don't already have Cygwin installed for other reasons, since it's much more lightweight. Details here: http://www.mingw.org/

Note: GIT isn't included in the MinGW packages. GIT for windows can be found at https://git-for-windows.github.io/

As stated earlier, this guide was written using Cygwin. There may be a couple missing steps here and there if you want to go with MinGW, but nothing major. Please update the wiki if you choose MinGW and find anything missing!

Option #3: Ubuntu on Bash on Windows

Windows 10 supports (in beta) the ability to run an Ubuntu based bash shell natively, including apt-get and things you'd expect on normal Ubuntu.

The main drawback is that hardware support (the crazyradio, for example) is not plumbed through to this shell, so you won't be able to flash, connect, or run the python tools which talk to hardware, but that's easily overcome using Conda for python scripts (see the python section below)

Details here: https://msdn.microsoft.com/en-us/commandline/wsl/about

ARM Toolchain

This is the toolchain required for building ARM projects (arm-none-eabi-gcc, etc). This isn't available as part of any of the linux environments, so it's recommended to download the version built for windows from here: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm

  • Change the default install location to something without spaces
  • Choose “add to path” so it can be invoked from cmd or cygwin.

Java

A Java runtime is required for various tools (eclipse, pyqt4, etc). Download and install the latest from http://www.java.com/en/download/

Python Environment

This is necessary for all python based tools – cfclient, cfloader, invoking “make cload” from the firmware project, etc)

Python Installation

Both python 2.7 and 3.4 are used across the various crazyflie projects. Download python here: https://www.python.org/downloads/

Look specifically for the latest version 2.7 and 3.4 (NOT 3.5!!). Install them to c:\python27 and c:\python34.

Other Python Tools

PYQT4 for cfclient UI

Install the latest from https://riverbankcomputing.com/software/pyqt/download

Get the version for python 3.4. If your goal is simply to run the cfcflient can choose 'minimal' for the install, which only installs the runtime.

SDL2.0

Windows binaries for SDL2.0 are available here: https://www.libsdl.org/download-2.0.php

Place the dll in the root of the crazyflie-clients-python folder you clone from git.

Or, for a more global/permanent solution, drop the .dll in the system folder:

  • If you are on an x86 OS using x86 bits, put the .dll in c:\windows\system32
  • If you are on an amd64 OS using amd64 bits, put the .dll in c:\windows\system32
  • If you are on an amd64 OS using x86 bits, put the .dll in c:\windows\sysWOW64

NumPy

Download the specific version that matches your python 3.4 version and architecture from: http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy For example, for python 3.4, x86: numpy-1.11.0b3+mkl-cp34-cp34m-win32.whl

Setup

Add both Python.exes to your path

If using cygwin, create symlinks to the two versions of python:

ln -s /cygdrive/c/Python34/python.exe /usr/bin/python3
ln -s /cygdrive/c/Python27/python.exe /usr/bin/python2

If using MinGW, you'll need to create appropriately named shortcuts to the two python.exes and put the shortcuts in your path.

Configure Python 3.4

Python3 -m pip install --upgrade pip
python3 -m pip install pyusb==1.0.0b2 pyzmq pysdl2 pyqtgraph
Python3 -m pip install <path to the NumPy .whl file you downloaded earlier

Note: In Cygwin, I've had trouble installing the NumPy .whl file from the /cygdrive mount point (aka /cygdrive/c/Users/username/Downloads/numpy.whl) and it complains about the file not existing. The solution to this is to copy the .whl file to somewhere in the Cygwin file system (like the home directory) and run the install command on that file instead.

Setting up USB devices (CrazyRadio or Crazyflie via USB)

  1. Get Zadig from: http://zadig.akeo.ie/
  2. Run zadig.exe
  3. Choose the device (Radio or crazyflie)
  4. Choose and install the libusb-win driver

Clone the repos

Grab the projects you're interested in from GitHub. The following is a pretty common list of repos, but not complete. Visit http://github.com/bitcraze to see all the repos.

mkdir ~/projects
cd ~/projects
git clone git://github.com/bitcraze/crazyflie-clients-python.git
git clone git://github.com/bitcraze/crazyflie-firmware.git
git clone git://github.com/bitcraze/crazyflie-bootloader.git
git clone git://github.com/bitcraze/crazyradio-firmware.git
git clone git://github.com/bitcraze/crazyflie2-stm-bootloader.git
git clone git://github.com/bitcraze/crazyflie2-nrf-bootloader.git
git clone git://github.com/bitcraze/crazyflie2-nrf-firmware.git

OpenOCD

OpenOCD is used for JTAG/SWD flashing and debugging. If you intend to use JTAG/SWD, Download OpenOCD for windows from here: http://www.freddiechopin.info/en/download/category/4-openocd

Add it to your system path if the installer didn't do so for you. OpenOCD commands invoked from the make scripts (make flash, etc) will work as-is. Stepwise debugging requires some setup in an IDE; details below.

IDE Setup

Eclipse

Get the latest “Eclipse for C/C++ developers” from here: http://www.eclipse.org/downloads/packages/

  • Import the project you are interested in by selecting File→New project and C/C++→C project
  • Configure the project to use the already cloned code in the project directory by setting the following settings:
    • Project name: <same as the directory in projects>
    • Use default location: False
    • Location: <path to where you cloned the repo>/<project>
    • Project type: Makefile project → Empty project
    • Toolchains: – Other Toolchain –

Todo: in addition to just developing code, eclipse can be made to start up an OpenOCD server and do flashing & JTAG debugging. Instructions needed.

PyCharm

PyCharm is a great IDE for Python development. Get it here: https://www.jetbrains.com/pycharm/download/#section=windows (the community edition is free)

Visual Studio

VS can certainly be used as an IDE, but hooking it up to the ARM toolchain for building might not be possible. Investigation needed.

doc/crazyflie/dev/env/windows.txt · Last modified: 2018-07-07 12:58 by theseankelly