Building ArduPilot for Pixhawk/PX4 on Windows with Make

Building ArduPilot for Pixhawk/PX4 on Windows with Make

  1. Install GitHub for Windows
  2. Ensure your github settings are set to leave line endings untouched.
    • The “Git Shell (or Bash)” terminal was also installed when you installed Git.  Click on your new “Git Shell (or Bash)” Icon and type in the following in the Git “MINGW32″ Terminal window:
    git config --global core.autocrlf false
  3. Clone the ardupilot, PX4Firmware and PX4NuttX repositories onto your machine:
    • Go to the GitHub/diydrones/ardupilot web page and click the “Clone in Desktop” button
    • Go to the GitHub/diydrones/PX4Firmware web page and click the “Clone in Desktop” button
    • Go to the GitHub/diydrones/PX4NuttX web page and click the “Clone in Desktop” button
Download and install the PX4 toolchain by running the px4_toolchain_installer_v13_win.exe Create and customise the config.mk file:
    • Start the PX4Console which can be found under Start >> All Programs >> PX4 Toolchain on Windows 7 machine or you can directly run C:\px4\toolchain\msys\1.0\px4_console.bat
    • “cd” to the directory where the ardupilot firmware was installed in step #3 and then into the ArduCopter directory (be sure to capitalise the “A” and “C” of ArduCopter).  In the example above the command would be:

cd /c/Users//Documents/GitHub/ardupilot/ArduCopter

    • create the config.mk by typing the command below.  A message should be displayed saying “WARNING – A config.mk file has been written” including the exact location of the file

make configure

  • If the PX4Firmware and PX4NuttX repositories were created using the exact name and location shown in Step #3 there should be no need to modify the config.mk file but if the name or location are different you will need to open the config.mk file in an editor such asNotePad++ and set the PX4_ROOT and/or NUTTX_SRC values to match.

Build the firmware by opening a PX4 console and cd to ArduCopter directory, then enter one of the following commands to perform a build
    1. make px4                <– will build both PX4 and PixHawk firmware for a quadcopter
    2. make px4-v2           <– will build the Pixhawk firmware for a quad
    3. make px4-v2-hexa  <– build the Pixhawk firmware for a hexacopter (other supported suffixes include “octa” and “heli”)
    4. make clean             <– “clean” the ardupilot directory
    5. make px4-clean      <– “clean” the PX4Firmware and PX4NuttX directories so the next build will completely rebuild them
    6. make px4-v2-upload  <– build and upload the Pixhawk firmware for a quad (i.e. no need to do step #7 below)
    7. The firmware will be created in the ArduCopter directory with the .px4 file extension.

Upload the firmware using the Mission Planner’s Initial Setup >> Install Firmware screen’s “Load custom firmware” link

Hints for speeding up compile time

Anti virus protection is likely to slow the compile times especially for PX4 so it is recommended that the folders containing the ardupilot, PX4Firmware and PX4NuttX source code are excluded from your virus protections real-time scan.
The first scan after a “make px4-clean” will be very slow as it rebuilds everything


Questions about this page? Comments? Suggestions? Post to APM Forum! Use the platform specific to your query, and make sure to include the name of the page you are referring to.

你可能感兴趣的:(Building ArduPilot for Pixhawk/PX4 on Windows with Make)