Skip to content

HAL Porting Guide

The Hardware Abstraction Layer (HAL) in THAP is designed for "Technological Sovereignty," allowing for easier porting to localized hardware like the Artery Tek (AT32) series.

Structure

  • libraries/AP_HAL/: The high-level interface.
  • libraries/AP_HAL_ChibiOS/: The specialized implementation for RTOS-based boards.

Key Files for Porting

  1. hwdef.dat: The primary hardware definition file. Defines pins, UARTs, I2C, SPI, and sensors.
  2. chconf.h / halconf.h: ChibiOS configuration files for OS-level tuning.

Overclocking Support

THAP natively supports 240MHz overclocking on the AT32F403A. This is configured via the OSC and PLL settings in the board's hwdef.dat.

Testing a New Port

We recommend using the SerialLoopback example to verify basic HAL functionality:

./waf configure --board YOUR_NEW_BOARD
./waf examples/SerialLoopback