[Contribution] PlatformIO Platform for AmebaD — Build, Flash & Monitor from CLI/VS Code

Hi everyone,

Following up on the long-standing request for PlatformIO support, I’ve built a complete PlatformIO platform for the AmebaD family and I’d like to share it with the community.

What it does:

The platform plugs into the existing ameba-arduino-d Arduino SDK without modifying any SDK code. It enables:

  • pio run — Build from the command line or VS Code

  • pio run -t upload — Flash via UART with auto-reset (DTR/RTS)

  • pio device monitor — Serial monitor

  • Multi-board projects, library dependency management, and all the other PlatformIO features

Supported boards (8):

AMB21/AMB22 (RTL8722DM), AMB23, Ai-Thinker BW16 (RTL8720DN), AMB25, AMB26, SparkFun AzureWave Thing Plus, SparkFun Thing Plus NORA-W306, u-blox NORA-W30

Key technical details:

  • Translates the full platform.txt configuration into PlatformIO’s SCons build system — all 80+ SDK include paths, 20 precompiled libraries, ARMv8-M Mainline + DSP + hard-float compiler flags, and 22 linker wrap symbols

  • Uses Realtek’s existing postbuild tools for firmware image generation (no re-implementation needed)

  • Includes a cross-platform Python UART flasher that replaces the C++ upload_image_tool binaries. This was necessary because the Linux and macOS upload tools shipped with the SDK have a missing dependency (amebad_image_tool) and don’t actually work. The Python version uses only pyserial (bundled with PlatformIO) and implements the full flash protocol: DTR/RTS auto-reset, baud negotiation up to 1.5 Mbaud, flashloader upload, SPI flash erase/write, and checksum verification

  • J-Link debug support is pre-configured for all boards

Tested end-to-end on Windows with the Ai-Thinker BW16: build, flash, and serial verification all passing.

Where to find it:

Quick start:

; platformio.ini
[env:bw16]
platform = https://github.com/tmmsunny012/ameba-arduino-d.git#feature-platformio-support
board = rtl8720dn_bw16
framework = arduino

pio run -e bw16                                    # build
pio run -e bw16 -t upload --upload-port COM31      # flash
pio device monitor -b 115200                       # serial monitor

I’m aware that @xidameng mentioned this would take significant effort — hopefully this contribution helps move things forward. The implementation is entirely additive (no existing files modified) so it should be straightforward to merge.

Happy to answer questions or take feedback. Would love to see this get into the main repo so the community can benefit.

2 Likes