編譯環境准備
Ardupilot源碼下載和PX4 toolchain工具鏈下載
(見https://www.cnblogs.com/BlogsOfLei/p/7707485.html)
注意:最新版本的github已經支持下載工程項目中的子模塊。如果喜歡git bash終端指令下載,可見:
https://www.cnblogs.com/BlogsOfLei/p/8624650.html
終端編譯
打開終端PX4 Console,進入固件對用的文件下。此處以編譯四旋翼固件為例,如下圖:
make px4-v2編譯選項,選擇編譯px4-v2固件,回車確定,等待編譯完成。編譯成功得到的固件在ArduCopter文件下,名稱為***.px4。
make px4-v2 | Build the Pixhawk firmware for a quad |
---|---|
make px4-v3 | Build The Cube firmware for a quad |
make px4-v4 | Build the PixRacer firmware for quad |
make px4 | Build both PX4 (obsolete) and PixHawk firmware for a quadcopter |
make clean | “clean” the ardupilot directory |
make px4-clean | “clean” the PX4Firmware and PX4NuttX directories so the next build will completely rebuild them |
make px4-cleandep | “clean” .d and .o files from the PX4Firmware and PX4NuttX directories. faster but less complete rebuild compared to “px4-clean” |
make px4-v2-upload | Build and upload the Pixhawk firmware for a quad (i.e. no need to upload using a ground station) |
Eclipse 編譯
-
Eclipse IDE環境的配置請見https://www.cnblogs.com/BlogsOfLei/p/7707485.html。
-
選擇編譯目錄
-
新加編譯選項
-
點擊編譯選項進行編譯,等待編譯完成。編譯成功后,生成的目標文件位於ArduCopter目錄文件下,格式為***.px4。