Ardupilot开源飞控之ChibiOS简介
1. 源由
随着雅特力AT32芯片逐步被移植到开源飞控系统:
但是,目前Ardupilot尚未支持,其主要原因是ChibiOS尚不支持雅特力芯片。虽然有一些项目在做这方面的Porting工作,但是显然尚未达到可以在或者接近可以在Ardupilot上使用的程度。
本章节,来一起看下ChibiOS相关的介绍。
2. ChibiOS简介
官方ChibiOS项目:https://github.com/ChibiOS/ChibiOS
ChibiOS是一个完整的嵌入式应用程序开发环境。平台包括RTOS、HAL、外围驱动程序、支持文件和工具,所有这些都旨在使开发过程无缝、高效。
ChibiOS还集成了外部开源组件,为嵌入式设备提供完整的解决方案。ChibiOS组件可在开源许可证:GPL3或Apache 2.0下使用,还有几个商业许可选项。
Ardupilot ChibiOS项目: https://github.com/ArduPilot/ChibiOS
Artery(AT32) porting项目: //Artery官网没有相关porting动作,不过开源github有相关项目。
3. ChibiOS基础
基础内容整理如下:
【1】ChibiOS简介1/5
【2】ChibiOS简介2/5
【3】ChibiOS简介3/5
【4】ChibiOS简介4/5
【5】ChibiOS简介5/5
工程目录结构:
*****************************************************************************
*** Files Organization ***
*****************************************************************************
--{root} - ChibiOS directory.
+--readme.txt - This file.
+--documentation.html - Shortcut to the web documentation page.
+--license.txt - GPL license text.
+--demos/ - Demo projects, one directory per platform.
+--docs/ - Documentation.
| +--common/ - Documentation common build resources.
| +--hal/ - Builders for HAL.
| +--nil/ - Builders for NIL.
| +--rt/ - Builders for RT.
+--ext/ - External libraries, not part of ChibiOS.
+--os/ - ChibiOS components.
| +--common/ - Shared OS modules.
| | +--abstractions/ - API emulator wrappers.
| | | +--cmsis_os/ - CMSIS OS emulation layer for RT.
| | | +--nasa_osal/ - NASA Operating System Abstraction Layer.
| | +--ext/ - Vendor files used by the OS.
| | +--ports/ - RTOS ports usable by both RT and NIL.
| | +--startup/ - Startup support.
| +--ex/ - EX component.
| | +--dox/ - EX documentation resources.
| | +--include/ - EX header files.
| | +--devices / - EX complex drivers.
| +--hal/ - HAL component.
| | +--boards/ - HAL board support files.
| | +--dox/ - HAL documentation resources.
| | +--include/ - HAL high level headers.
| | +--lib/ - HAL libraries.
| | | +--complex/ - HAL collection of complex drivers.
| | | | +--mfs/ - HAL managed flash storage driver.
| | | | +--serial_nor/ - HAL managed flash storage driver.
| | | +--fallback/ - HAL fall back software drivers.
| | | +--peripherals/ - HAL peripherals interfaces.
| | | +--streams/ - HAL streams.
| | +--osal/ - HAL OSAL implementations.
| | | +--lib/ - HAL OSAL common modules.
| | +--src/ - HAL high level source.
| | +--ports/ - HAL ports.
| | +--templates/ - HAL driver template files.
| | +--osal/ - HAL OSAL templates.
| +--oslib/ - RTOS modules usable by both RT and NIL.
| | +--include/ - OSLIB high level headers.
| | +--src/ - OSLIB high level source.
| | +--templates/ - OSLIB configuration template files.
| +--nil/ - NIL RTOS component.
| | +--dox/ - NIL documentation resources.
| | +--include/ - NIL high level headers.
| | +--src/ - NIL high level source.
| | +--templates/ - NIL configuration template files.
| +--rt/ - RT RTOS component.
| | +--dox/ - RT documentation resources.
| | +--include/ - RT high level headers.
| | +--src/ - RT high level source.
| | +--templates/ - RT configuration template files.
| +--various/ - Various portable support files.
+--test/ - Kernel test suite source code.
| +--lib/ - Portable test engine.
| +--hal/ - HAL test suites.
| | +--testbuild/ - HAL build test and MISRA check.
| +--nil/ - NIL test suites.
| | +--testbuild/ - NIL build test and MISRA check.
| +--rt/ - RT test suites.
| | +--testbuild/ - RT build test and MISRA check.
| | +--coverage/ - RT code coverage project.
+--testex/ - EX integration test demos.
+--testhal/ - HAL integration test demos.
4. AT32 F435 v.s. STM32 F405
AT32 F435 和 STM32 F405 两颗芯片非常接近,但是其MCU的寄存器差异确挺大的,因此适配和移植存在一定的障碍。
- STM32F405RGT6 v.s. AT32F435RGT7 Comparison for Flight Controller
- Aocoda-RC F405V2 FC(STM32F405RGT6 v.s. AT32F435RGT7) IO Definitions
这个ChibiOS的的porting和基于bare-metal loop模式的betaflight和inav飞控移植还是有一定距离的。接下来,希望通过Step by Step的方式先进行差异分析。没有基础,什么都是空的,对于完全不熟悉的东西,首先要搞清楚的就是定义,差异,基础概念,一口吃不成个胖子。
Step by Step Spec研读分析:
【1】AT32 F435简介1/N Security Library
【2】AT32 F435简介2/N Features
【3】AT32 F435简介3/N Memory Mapping
【4】AT32 F435简介4/N ChibiOS porting plan
【5】ArduPilot之开源代码waf编译
【6】ArduPilot之开源代码waf-configure编译
【7】待续。。。
注:N表示总共多少篇研读。目前,尚没有概念,先用个不确定数N吧。
5. 参考资料
【1】ArduPilot开源飞控系统之简单介绍
【2】 ChibiOS官方文档
【3】AT32F435飞控之MAMBA MK5 F435 Anti-Interference