Building and Flashing PIXHAWK Firmware

Eclipse IDE for PIXHAWK

Introduction:

 

3D Robotic’s PIXHAWK is a high-performance autopilot-on-module suitable for fixed wing, multi-rotors, helicopters, cars, boats and any other robotic platform that can move.  One of the benefits of using PIXHAWK is its open-source hardware and software ARDUPILOT development platform.  Initially, the ARDUPILOT development platform was based on the Arduino-compatible autopilot board designed by Chris Anderson and Jordi Muñoz of DIY Drones using the new ATMega328.  This board was used to win the annual autonomous vehicle competition put on by SparkFun.

Having briefly described the ARDUPILOT development platform, you can attach a sensor to the PIXHAWK controller via one of its available interfaces (e.g., ADC, I2C, SPI, and CAN) and re-program PIXHAWK to capture data specific to the sensor.  Thereafter, the robotic platform can alter its behaviour based at least on the captured data.  As an example, you can attach a proximity sensor to PIXHAWK and measure the distance of the robotic platform to the nearest surface.  Undoubtedly, you would need to re-program the firmware of the PIXHAWK so that the necessary hardware (and necessary software changes) can take effect.  There are many ways (and various programming IDEs) that you can use to re-build PX4 firmware (i.e., PX4Firmware) for your robotic platform.  In this tutorial, we are going to show you an easy way using Eclipse in Windows on your computer.

Installation Video :

 

Installation Downloads :

 

Installation Instructions :

 

  • Download and install PX4 ToolChain v14 for Windows;
  • In the PX4 ToolChain program menu, use PX4 Software Download to download and build the initial software environment for programming PIXHAWK.  This will download at least the following sub-directories in a source path of your choice (default path “C:\px4”.).  Make sure that the source path does not contain any spaces.
    • px4
      • PX4Firmware – the base PIXHAWK middleware and drivers used on PIXHAWK micro-controller boards;
      • PX4NuttX – the core NuttX RTOS used on PIXHAWK boards; and
      • mavlink – the mavlink protocol and code generator.
  • You may update any of the sub-directories by running the following example commands in the GIT command line console:

cd Firmware

git submodule update

  • Start Eclipse via Start → All Programs → PX4 Toolchain → PX4 Eclipse.  In this way, you are running a customized version of Eclipse for pre-configured for PX4. (In case you are running 64 bit Windows you may check and make sure that Java JRE/JDK is installed in c:\Program Files (x86)\Java\jre_xxx, not c:\Program files\Java\jre_xxx).
  • Set up the Project by going to File → New → Makefile Project with Existing Code
  • Choose Cross GCC and Browse for the folder: c:\px4\Firmware
  • Open the tab on the right “Make Target” and press “New Make Target”
  • Create the following Targets:
    • clean (deletes all the already compiled object files, only the application (autopilot) part, especially if you have a prior failed make command)
    • distclean (cleans everything, including the NuttX build, especially after changes on header files, NuttX, or a fresh GIT checkout/update)
    • archives (updates the links among sub-files for the NuttX OS)
    • all (builds the autopilot software (depends on archives))
      • alternatively, configure_px4fmu (depending on the board version, you may use px4fmu-v1 or px4fmu-v2)
      • alternatively, configure_px4io
    • upload (uploads to PX4 boards)
      • alternatively, upload px4fmu-v1_default (uploads to PX4FMU v1.x boards)
      • alternatively, upload px4fmu-v2_default (uploads to PX4FMU v2.x boards)
  • Build PIX4Firmware (process will take some time) by:
    • Using Eclipse: Double-clicking distclean, then archives, then all.
    • Using the command line (i.e., “Start → All Programs → PX4 Toolchain → PX4 Console”) and enter:

cd Firmware/

make distclean

make archives

make all

  • Connect PIXHAWK micro-controller board to your computer (Make sure your COM port number is lower or equal than 32. The port number can be changed in your Device Manager → Ports → PX4 FMU → Properties → Port Settings → Advanced → COM Port Number).  Make sure that the drivers for Windows for the PX4 are working.
  • Flash PIX4Firmware by:
    • Using Eclipse: Double-clicking upload or px4fmu-v1_default.
    • Using the command line (i.e., “Start → All Programs → PX4 Toolchain → PX4 Console”) and enter:

make upload (or make upload px4fmu-v1_default)

  • Sit back and give yourself a pat on your shoulders 🙂

Leave a Comment

Your email address will not be published. Required fields are marked *