注意:该编译方法生成的固件基于Chibios系统,如果想要Nuttx系统固件,需采用make编译,步骤见make编译说明部分。

软件安装准备

  • 安装Cygwin

     

    • 在搜索框中搜索待安装的包,并点击skip按钮选择安装版本,选择成功后bin选择被打钩,表示选择安装有效。依次搜索下表中的包,并选择安装有效。全被选择完成之后,点击下一步进行安装(下载包和安装包过程需要一段比较长的时间,需耐心等待)。

     

    Package Name Category / Name / Description
    autoconf Devel | autoconf: Wrapper scripts for autoconf commands
    automake Devel | automake: Wrapper scripts for automake and aclocal
    ccache Devel | ccache: A C compiler cache for improving recompilation
    gcc-g++ Devel | gcc-g++ GNU Compiler Collection (C++)
    git Devel | git: Distributed version control system
    libtool Devel | libtool: Generic library support script
    make Devel | make: The GNU version of the ‘make’ utility
    gawk Interpreters | gawk: GNU awk, a pattern scanning and processing language
    libexpat-devel Libs | libexpat-devel: Expat XML parser library (development files)
    libxml2-devel Libs | libxml2-devel: Gnome XML library (development)
    libxslt-devel Libs | libxslt-devel: XML template library (development files)
    python2-devel Python | python2-devel: Python2 language interpreter (python3 does not work yet)
    python2-future Python | python2-future: Clean single-source support for Python 3 and 2
    python2-libxml2 Python | python2-libxml2: Gnome XML Library (Python bindings
    python2-pip Python | python2-pip: Python package installation tool
    procps-ng System | procps-ng: System and process monitoring utilities (required for pkill)
    gdb Devel | gdb: The GNU Debugger
    ddd Devel | ddd: DDD, the data display debugger
    zip Archive | zip: Info-ZIP compression utility
  • 打开Cygwin64 Terminal(从桌面快捷方式或者开始菜单中打开),输入以下指令安装依赖的python组件包。

      pip2 install empy
    ​
      pip2 install pyserial
    ​
      pip2 install pymavlink

 

编译目标程序

  • 打开Cygwin64 Terminal,进入Ardupilot工程目录下

  • 查看能编译目标板指令

    ./waf list_boards

 

  • 配置目标板,以下列出常用的配置目标板指令:

    ./waf configure --board bebop --static # Bebop or Bebop2
    ./waf configure --board edge           # emlid edge
    ./waf configure --board fmuv3          # Pixhawk2/Cube using ChibiOS
    ./waf configure --board fmuv4          # Pixracer using ChibiOS
    ./waf configure --board navio2         # emlid navio2
    ./waf configure --board Pixhawk1       # Pixhawk1
    ./waf configure --board CubeBlack      # Pixhawk2
    ./waf configure --board Pixracer       # Pixracer
    ./waf configure --board skyviper-v2450 # SkyRocket\'s SkyViper GPS drone using ChibiOS
    ./waf configure --board sitl           # software-in-the-loop simulator
    ./waf configure --board sitl --debug   # software-in-the-loop simulator with debug symbols

    此处编译pixhawk1为例。输入指令./waf configure --board Pixhawk1注意区分大小写。

     

  • 编译目标指令。输入以下指令编译四旋翼固件,固件格式为apj和bin,其中apj可通过MissionPlaner地面站烧写至目标板。

    ./waf --targets bin/arducopter

     

     

关于waf编译详细说明请见文档:https://github.com/ArduPilot/ardupilot/blob/master/BUILD.md

版权声明:本文为BlogsOfLei原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/BlogsOfLei/p/10275708.html