ChibiOS/RT 3.0 Concepts and Ideas

The source material is this thread on the forum.

Requirements tagged with ”(NilRTOS convergence plan)” are meant to increase commonality with NilRTOS.

General Objectives

  • Streamline features set.
  • ChibiOS/RT and NilRTOS convergence.
  • Add new features.
  • Increase consistency and elegance of the whole code base.

General Architecture

Topics regarding the general ChibiOS/RT architecture.

Files Reorganization

  • Distribution tree reorganization in order to allow a “family of products” kind of organization. RT, Nil and HAL will be three separate but interoperable “products” (DONE).

Function Names

  • Add a new type “X” for functions that can be called from any context (DONE).
  • Change functions suffixed by “FromIsr” to “FromISR” (DONE).

HAL Separation

The HAL will no more dependent on the ChibiOS/RT Kernel but will depend on a generic OSAL (Operating System Abstraction Layer) that will abstract the underlying operating system. Rationale: The HAL will be able to serve both ChibiOS/RT and NilRTOS. The HAL would be able to operate without an OS too.

(DONE 80%)

API Convergence

ChibiOS/RT and NilRTOS shall share as much API as possible (DONE).

Standard Types

Remove bool_t and replace with the standard bool. Remove occurrences of TRUE/FALSE and replace them with true/false except in configuration files macros.

(DONE)

Build Environment

  • Segmented scatter files (DONE).
  • Stack sizes modifiable in makefiles (DONE).
  • Streamlining of the editable Makefile (DONE).

Kernel changes

Initializers

Rename initializers to chXxxObjectInit() in order to follow the same convention used by the HAL (DONE).

Focus on 32bits

The kernel will be focused on and optimized for 32bits architectures. Compatibility will be ensured for 8 and 16 bits architectures. Rationale: NilRTOS will take on the role to support smaller micros.

System Variables in a single structure

All the various kernel global variables shall be consolidated in a single global structure because:

  • Accesses optimization.
  • Ease of debug.
  • Making possible to have multiple instances of the OS.

(DONE, memory allocation related data not included by choice)

Realtime Counters

Realtime counters and the Time Measurement unit, currently part of the HAL, will be moved into the kernel as an optional feature.

(DONE)

Virtual Timers

Changes:

  • Explicit initializers for virtual timers .
  • chVTReset() will check the timer state before stopping it.
  • Consider a new function/macro that restarts a timer.

(DONE)

Statistics Module

New module (TBD) collecting runtime statistics to be fetched by the debug Eclipse plugin. For example and not limited to:

  • ISRs counter (DONE).
  • Context Switches counter (DONE).
  • Time consumed by threads accurately measured in clock cycles (DONE).
  • Time spent into critical zones (DONE).
  • ISRs worst case measurement (POSTPONED).

Safety

  • Time guards, like assertions but guarding a response time in order to monitor the realtime response of a system (POSTPONED).

Tickless Kernel

A new mode without a fixed system tick will be implemented, this will impose limitations:

  • The system time will be handled differently: it will return the value of an HW counter not a variable increased by the system tick.
  • The kernel will have to rely on a special timer driver in order to implement this mode.
  • The mode will be available only on ports for MCUs with an hardware timer supporting this specific mode, a fixed interval timer probably will not suffice.

(DONE)

Nested and Context-Independent Locks

New functions chSysGetAndLockX() and chSysRestoreLockX() will be added in order to support locks both nestable and context-independent. The kernel shall not make use of nested locks internally.

(DONE)

Mutexes

Reentrant mutexes capability shall be added as an option.

(DONE)

Queues Primitives

Add APIs regarding queues of threads.

(DONE)

Suspend/resume

Better suspend and resume primitives.

(DONE)

Low Power enter/exit hooks

Already possible but not easy to do. Add explicit enter/leave hooks.

(DONE)

Port Layer Redefinition

The port layer shall be restructured:

  • Support for nested locks (DONE).
  • Use of standard features where applicable (stdint, stdbool, etc) (DONE).
  • Multi-compiler ports (DONE for ARMCMx port).
  • CMSIS files and vendor headers in the port layer (DONE).
  • Avoidance of duplicated code (DONE).
  • Reduction of inlined ASM code (DONE ARMCMx).
  • Remove port_halt() and implement it in the kernel directly (DONE).

Assertion/Checks Improvements

Remove the parameters that can be calculated from the LINE and FUNCTION macros.

(DONE)

HAL changes

OSAL

The HAL will not have dependencies on the Kernel but will work using an abstract OS interface named OSAL (NilRTOS convergence plan). The OSAL shall expose its own API to the HAL, the interface functions shall be mapped 1 to 1 on ChibiOS/RT and NilRTOS functionalities but will have names prefixed with “osal”. For example osalSysLock().

(DONE)

Queues

Queues management will be part of the HAL, used if the OS does not provide them already.

(DONE)

Streams

Streams management will be part of the HAL, used if the OS does not provide them already.

(DONE)

All Drivers

  • All xxxStart() functions shall return a bool for success/failure.
  • Add a new state to the standard state machine “XXX_STARTING” in order to support those peripherals requiring a complex start procedure. A state “XXX_STOPPING” should be evaluated too.
  • The common usage protocol xxxInit(), xxxObjectInit(), xxxStart() and xxxStop() is confirmed.

Sleep Module

Abstract access to low power modes.

Style

Source Code Organization

All the source code will share a common template divided in sections, much like the current HAL source code but with more abstract definitions (so not mention “driver” but “module”).

(DONE kernel).

Types

All types shall follow the _t convention, so no more Thread but thread_t.

(DONE kernel).

Inline Functions

Macros will be replaced by static inline functions where applicable.

(DONE kernel).

Indentation

Current rules confirmed.

Documentation tags

Current rules confirmed.

 
chibios/community/plans/chibios_rt_concepts_and_ideas.txt · Last modified: 2014/02/12 20:14 by giovanni
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.3