本帖最后由 payne_pan 于 2015-11-11 20:50 编辑
几个月前下载 ardupolit 轻松就编译了apm2, 这次想编译 pixhawk缺遇到些问题,下面具体说说(环境pc机,ubuntu14.04):
先安装git , 而后用 git clone下载源文件 1)下载源代码
2) 而后安装toolchain (如:arduino-core, gcc-avr avrdude avr-libc binutils-avr 等) 最简单就是运行下面脚本(提示不多,可能等很长时间) ardupilot/Tools/scripts/install-prereqs-ubuntu.sh -y
不运行这个脚本,就要手动运行下面命令 sudo apt-get install gcc-avr avrdude avr-libc binutils-avr sudo apt-get install python-serial python-wxgtk2.8 python-matplotlib python-opencv python-pexpect python-scipy
sudo apt-get gawk make git arduino-core g++
pixhawk 需要下载 arm toolchain 在ubuntu14.04不要用sudo apt-get install gcc-arm-none-eabi -y, 不但安装了错误的版本,而且缺少 c++ header
3)编译 使当前shell 环境变量生效 . ~/.profile
编译多轴
cd ardupilot/ArduCopter
make 根据提示选择target Targets
-------
px4-v1 - the PX4v1 board
px4-v2 - the Pixhawk
pxf - the Beagle Bone Black (BBB) + PXF cape combination
navio - the RaspberryPi + NavIO cape combination
linux - a generic Linux build
flymaple - the FlyMaple board
...
新版本的ArduCopter(3.x) 不支持缺省参数,而且取消了 apm1/apm2, 添加了树莓派的支持
比如编译 pixhawk
make px4-v2
ArduPlane APMrover2 AntennaTracker 与此类似
最后看到下面提示,就成功编译生成文件 LINK: /home/payne/ardupilot/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.elf BIN: /home/payne/ardupilot/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.bin
%% Generating /home/payne/ardupilot/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.px4
make[2]: Leaving directory `/home/payne/ardupilot/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build'
%% Copying /home/payne/ardupilot/ardupilot/modules/PX4Firmware/Images/px4fmu-v2_APM.px4
make[1]: Leaving directory `/home/payne/ardupilot/ardupilot'
text data bss dec hex filename
901640 2812 62352 966804 ec094 /home/payne/ardupilot/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.elf
PX4 ArduCopter Firmware is in ArduCopter-v2.px4
最后用 make px4-v2-upload 上传
其他问题: 我想到ArduPlane去编apm2 ( Copter取消了对apm2的支持,Plane应该没有取消吧) 但提示 ArduPlane$ make apm2
../mk/targets.mk:13: *** apm2 is deprecated on master branch; use master-AVR
那么就先运行 git checkout master-AVR 再编就可以了 make apm2
得到 %% ArduPlane.elf
Firmware is in ArduPlane.elf
%% ArduPlane.eep
%% ArduPlane.hex
|