Porting a New Board to PylotOS

Adding a new ESP32, ESP32-S3, ESP32-C3, ESP32-C6, or ESP32-P4 board to PylotOS requires zero changes to micropython/ and zero copy-pasting of existing chip drivers.


Step 1: Choose a Partition Profile

Check your board's SPI Flash size and pick the matching Dual-OTA table from partitions/:


Step 2: Create boards/<vendor>_<model>/

Use boards/m5stack_core2/ as your template and create 6 small files:

  1. board.json — Declares board_id, board_name, chip, flash_mb, psram_mb, partition_table, min_kernel_version, and flash_offset ("0x1000" for classic ESP32, "0x0" for ESP32-S3/C3/C6).
  2. board_config.h — Defines board-specific GPIO pins, SPI/I2C bus numbers, and I2C addresses.
  3. board_init.c — Declares the static hal_board_desc_t, implements hal_board_init() (binding reusable drivers from drivers/), and exports pylotos_board_startup().
  4. mpconfigboard.h — Sets MICROPY_HW_BOARD_NAME, MICROPY_HW_MCU_NAME, PYLOTOS_BOARD_ID, and #define MICROPY_BOARD_STARTUP pylotos_board_startup.
  5. mpconfigboard.cmake — Includes MicroPython's chip common file (e.g., boards/mpconfigboard_esp32s3_common.cmake), boards/common/pylotos_common.cmake, sdkconfig.board, and appends board_init.c to MICROPY_SOURCE_BOARD.
  6. sdkconfig.board — Sets Flash size, PSRAM mode/speed, and CONFIG_PARTITION_TABLE_CUSTOM_FILENAME.

Step 3: Register the Board in CI & Documentation

  1. Add the new <board_id> to strategy.matrix.board in .github/workflows/ci.yml.
  2. Add the board to the table in README.md and create a board tutorial under docs/wiki/.
  3. Run pytest -v (which automatically validates every boards/*/board.json and referenced partition table) and open a Pull Request!