Make编译Ardupilot源码的两种方法
编译环境准备
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。