Porting Layer
The Dawn porting layer provides an abstraction between the core framework
and the underlying Operating System (OS) and hardware drivers. Porting
implementations are located in dawn/src/porting/ and
dawn/include/dawn/porting/.
Currently, Dawn officially supports the Apache NuttX RTOS. There are no plans to support other Operating Systems at this time, although the architecture remains modular.
System Requirements
To port Dawn to a new system (though not currently planned), the following features must be provided:
C++11 or newer: Support for
std::function,std::mutex, and atomics.POSIX threads: Support for
pthread_create(), join, stack-size attributes, and scheduler/priority configuration.POSIX-like API: Support for
open(),close(),read(),write(), andpoll().CMake: The build system is exclusively based on CMake.
Board Support
Actual board support and hardware-specific configurations are located in the
boards/ directory. Dawn utilizes the standard Apache NuttX board support
model: board directories contain board-specific files, defconfig, and
pin mappings.
The OS porting layer (dawn/src/porting/nuttx/board.cxx) provides
the logic to bootstrap the framework on the target OS, but the specific
hardware resources are defined in the board support package.
Driver Porting
IO objects interact with hardware through porting headers. To support a new
peripheral type on a platform, implement the corresponding interface in
dawn/include/dawn/porting/.
Example Driver Implementation
When implementing a new driver port (e.g., for ADC):
Define the platform-specific structure in the porting header.
Implement the hardware access logic in
dawn/src/porting/<os>/adc.cxx.Ensure the ADC IO class (for example
CIOAdcFetch) can utilize these functions.
API Reference
The following files define the required interfaces for hardware abstraction:
Header |
Description |
|---|---|
|
Board-specific bootstrap and resource mapping. |
|
General Purpose I/O read/write and configuration. |
|
Analog-to-Digital conversion. |
|
Pulse Width Modulation output. |
|
Digital-to-Analog conversion. |
|
Controller Area Network frame exchange. |
|
Unified sensor framework interface. |
|
Quadrature encoder interface. |
|
Board-level LED indicators. |
|
Board-level push button inputs. |
|
CRC calculation. |
|
Fixed-point mathematics support. |
|
Documentation group definitions for Doxugen. |
The API declarations are located in dawn/include/dawn/porting/*.hxx.
Adding a New OS
While Dawn is currently focused on NuttX, adding a new OS involves:
Creating a new directory in
dawn/src/porting/<new_os>/.Implementing the core driver abstractions.
Providing a
config.hxxthat maps OS-specific headers.Updating the CMake build system to recognize the new target.
Important Note: The boards/ directory is dedicated to Apache
NuttX-compatible configurations. Any implementation for another OS would need
to handle board support through its own native mechanism and structure.