ChibiOSを調べる

nanoFrameworkの土台がChibiOSなので、ChibiOSを調査します。

ドキュメントはこちら。 ChibiOS free embedded RTOS - ChibiOS Homepage

ソースはこちら。 GitHub - ChibiOS/ChibiOS: Read only mirror of SVN ChibiOS repository. Official forum http://forum.chibios.org Bugtracker http://sourceforge.net/projects/chibios

Product Information

  • ライセンスは、GPL3 or Apache 2.0。
  • ChibiOSは4つのプロダクトで構成されている。
    • RT ... fastest RTOS
    • NIL ... smallest RTOS
    • HAL ... set of abstract device drivers
    • ChibiStudio ... development environment

ChibiOS/RT 3.0 The Ultimate Guide

ChibiOS General Archietcture

  • ChibiOS/RT ... the RTOS scheduler.
  • ChibiOS/HAL ... the Hardware Abstraction Layer enclosing abstract drivers for most common peripherals.

The Big Picture

f:id:matsujirushix:20181225221606p:plain

  • Startup Code ./os/common.ports ... The code executed after the reset.
  • Application ... the user code. main()
  • ChibiOS/RT
    • RT Portable Kernel ./os/rt ... the RTOS kernel which is architecture and compiler independent.
    • RT Port Layer ./os/rt/ports ... the RTOS kernel specific. ←./os/common/portsを使ってる??
  • ChibiOS/HAL

    • HAL API Layer ./os/hal ... The HAL portable code.
    • HAL Port Layer ./os/hal/ports ... the device driver implementations for a specific MCU.
    • HAL Board Layer ./os/hal/boards ... all details of a specific board.
    • HAL OSAL Layer ./os/hal/osal ... the Operating System Abstraction Layer.
  • RT does not need HAL

  • HAL uses RT's services through the OSAL

ChibiOS products directory organization

*****************************************************************************
*** ChibiOS products directory organization                               ***
*****************************************************************************

--{root}                - Distribution directory.
  +--os/                - ChibiOS products, this directory.
  |  +--rt/             - ChibiOS/RT product.
  |  |  +--include/     - RT kernel headers.
  |  |  +--src/         - RT kernel sources.
  |  |  +--templates/   - RT kernel port template files.
  |  |  +--ports/       - RT kernel port files.
  |  |  +--osal/        - RT kernel OSAL module for HAL interface.
  |  +--nil/            - ChibiOS/NIL product.
  |  |  +--include/     - Nil kernel headers.
  |  |  +--src/         - Nil kernel sources.
  |  |  +--templates/   - Nil kernel port template files.
  |  |  +--ports/       - Nil kernel port files.
  |  |  +--osal/        - Nil kernel OSAL module for HAL interface.
  |  +--hal/            - ChibiOS/HAL product.
  |  |  +--include/     - HAL high level headers.
  |  |  +--src/         - HAL high level sources.
  |  |  +--templates/   - HAL port template files.
  |  |  +--ports/       - HAL port files (low level drivers implementations).
  |  |  +--boards/      - HAL board files.
  |  +--common/         - Files used by multiple ChibiOS products.
  |  |  +--ports        - Common port files for various architectures and
  |  |                    compilers.
  |  +--various/        - Various portable support files.
  |  +--ext/            - Vendor files used by ChibiOS products.