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/:
- 16 MiB Flash ->
partitions/partitions_16MiB_ota.csv(ota_04 MiB,ota_14 MiB,vfs7.875 MiB) - 8 MiB Flash ->
partitions/partitions_8MiB_ota.csv(ota_03 MiB,ota_13 MiB,vfs1.875 MiB) - 4 MiB Flash ->
partitions/partitions_4MiB_ota.csv(ota_01.8125 MiB,ota_11.8125 MiB,vfs256 KiB)
Step 2: Create boards/<vendor>_<model>/
Use boards/m5stack_core2/ as your template and create 6 small files:
board.json— Declaresboard_id,board_name,chip,flash_mb,psram_mb,partition_table,min_kernel_version, andflash_offset("0x1000"for classic ESP32,"0x0"for ESP32-S3/C3/C6).board_config.h— Defines board-specific GPIO pins, SPI/I2C bus numbers, and I2C addresses.board_init.c— Declares the statichal_board_desc_t, implementshal_board_init()(binding reusable drivers fromdrivers/), and exportspylotos_board_startup().mpconfigboard.h— SetsMICROPY_HW_BOARD_NAME,MICROPY_HW_MCU_NAME,PYLOTOS_BOARD_ID, and#define MICROPY_BOARD_STARTUP pylotos_board_startup.mpconfigboard.cmake— Includes MicroPython's chip common file (e.g.,boards/mpconfigboard_esp32s3_common.cmake),boards/common/pylotos_common.cmake,sdkconfig.board, and appendsboard_init.ctoMICROPY_SOURCE_BOARD.sdkconfig.board— Sets Flash size, PSRAM mode/speed, andCONFIG_PARTITION_TABLE_CUSTOM_FILENAME.
Step 3: Register the Board in CI & Documentation
- Add the new
<board_id>tostrategy.matrix.boardin.github/workflows/ci.yml. - Add the board to the table in
README.mdand create a board tutorial underdocs/wiki/. - Run
pytest -v(which automatically validates everyboards/*/board.jsonand referenced partition table) and open a Pull Request!