feat: add PlatformIO build system support#109
Conversation
- Add platformio.ini with ESP-IDF framework configuration
- ESP32-S3 board (16MB flash, 8MB Octal PSRAM)
- src_dir = main (reuse existing ESP-IDF structure)
- data_dir = spiffs_data (existing SPIFFS data)
- Add scripts/build_pio.sh for convenient build/flash/monitor
- Update .gitignore with PlatformIO output directories
- .pio/, .pioenvs/, .piolibdeps/
- Add PlatformIO build documentation to README files
- English, Chinese, and Japanese versions
- Note about separate SPIFFS upload requirement
- Document PlatformIO implementation plan in docs/PLATFORMIO_PLAN.md
- Dependency analysis (all built-in ESP-IDF components)
- Version mapping (PlatformIO espressif32 uses ESP-IDF 5.5.x)
- Operational differences from ESP-IDF native build
Dual build system support: ESP-IDF native (idf.py) and PlatformIO (pio)
can be used interchangeably.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds PlatformIO support and related artifacts: new Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Script as scripts/build_pio.sh
participant PIO as PlatformIO CLI
participant Device as Target Device / Serial
Script->>PIO: pio run (build)
PIO-->>Script: build artifacts
Script->>PIO: pio run -t upload (flash firmware)
PIO-->>Device: write firmware
Script->>PIO: pio run -t uploadfs (upload SPIFFS)
PIO-->>Device: write SPIFFS image
Script->>PIO: pio device monitor
PIO-->>Device: open serial monitor
PIO-->>Script: stream device logs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
.gitignore (1)
14-23: Remove duplicated PlatformIO ignore block.Line 19-Line 22 duplicates Line 14-Line 17 exactly. Keep a single block to avoid redundant churn in future edits.
♻️ Proposed cleanup
# PlatformIO .pio/ .pioenvs/ .piolibdeps/ - -# PlatformIO -.pio/ -.pioenvs/ -.piolibdeps/🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.gitignore around lines 14 - 23, Remove the duplicated PlatformIO ignore block by keeping only one occurrence of the three patterns ".pio/", ".pioenvs/", and ".piolibdeps/" in the .gitignore; locate the repeated block containing those exact patterns and delete the second copy so the file contains a single PlatformIO ignore block.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@platformio.ini`:
- Around line 8-18: The platform in the [env:esp32s3] section is unpinned
(platform = espressif32) which allows framework/toolchain drift; update the
platform declaration to a specific version (e.g., platform =
espressif32@<stable-version>) in the same [env:esp32s3] block so builds use a
fixed espressif32 toolchain and framework; keep the sdkconfig files as-is since
ESP-IDF CMake will auto-discover sdkconfig.defaults and
sdkconfig.defaults.esp32s3.
In `@README_JA.md`:
- Around line 116-190: The README_JA.md contains a duplicated "PlatformIO
ビルド(代替案)" details block (the second block duplicates the first); remove or
consolidate the duplicate so only a single canonical PlatformIO section remains,
keeping the clearer phrasing for build/flash/uploadfs/monitor commands and the
three 注意事項 lines; locate the duplicate by finding the two
<details><summary>PlatformIO ビルド(代替案)</summary> blocks and delete the later one
(or merge any slight wording differences so the remaining block contains the
complete, consistent instructions).
In `@README.md`:
- Around line 116-195: The README contains two duplicated "PlatformIO"
instructions blocks ("Building with PlatformIO" and "PlatformIO Build
(Alternative)"); remove the second duplicate block and ensure any unique notes
(PlatformIO version, SPIFFS upload requirement, and mention that idf.py still
works) are merged into the retained "Building with PlatformIO" details section
so all relevant guidance remains in one place and the summary title is
consistent.
---
Nitpick comments:
In @.gitignore:
- Around line 14-23: Remove the duplicated PlatformIO ignore block by keeping
only one occurrence of the three patterns ".pio/", ".pioenvs/", and
".piolibdeps/" in the .gitignore; locate the repeated block containing those
exact patterns and delete the second copy so the file contains a single
PlatformIO ignore block.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
.gitignoreREADME.mdREADME_CN.mdREADME_JA.mdplatformio.iniscripts/build_pio.shsdkconfig.esp32s3
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
platformio.ini (1)
18-18:⚠️ Potential issue | 🟠 MajorPin the PlatformIO platform version for reproducible builds.
At Line 18,
platform = espressif32is still unpinned, so framework/toolchain versions can drift across machines and CI runs.Proposed fix
-[env:esp32s3] -platform = espressif32 +[env:esp32s3] +platform = espressif32@<known-good-version>#!/bin/bash set -euo pipefail # Verify current state rg -n '^\s*platform\s*=' platformio.ini # Optional: list all PlatformIO envs to ensure pinning is consistent rg -n '^\[env:.*\]|\s*platform\s*=' platformio.ini🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@platformio.ini` at line 18, The platform key in platformio.ini is unpinned (currently "platform = espressif32"); update that line to pin a specific PlatformIO platform version (for example "platform = espressif32@<version>") so builds are reproducible across machines/CI, then verify the change by searching for "platform =" and the [env:*] sections to ensure all envs use the pinned platform; edit the existing "platform = espressif32" entry rather than adding a new duplicate.
🧹 Nitpick comments (1)
platformio.ini (1)
28-30: Use canonical-Dmacro style inbuild_flags.At Line 30, prefer
-DCONFIG_SPIRAM_CACHE_WORKAROUNDover-D CONFIG_SPIRAM_CACHE_WORKAROUNDfor consistency and to avoid parser/tooling edge cases.Proposed fix
build_flags = -DBOARD_HAS_PSRAM - -D CONFIG_SPIRAM_CACHE_WORKAROUND + -DCONFIG_SPIRAM_CACHE_WORKAROUND🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@platformio.ini` around lines 28 - 30, The build_flags entry uses a non-canonical macro definition "-D CONFIG_SPIRAM_CACHE_WORKAROUND"; update the build_flags block to use the canonical no-space form "-DCONFIG_SPIRAM_CACHE_WORKAROUND" (and verify other macros like "-DBOARD_HAS_PSRAM") so the -D macros are consistently formatted and avoid tooling/parser issues; edit the build_flags lines accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@platformio.ini`:
- Around line 8-10: The comment says the build overrides the board's
maximum_size to match a 2MB partition but the env block doesn't actually set
board_upload.maximum_size; update the env configuration (the [env:*] block
referenced in the diff) to add board_upload.maximum_size and set it to the 2MB
app partition value (2097152) so PlatformIO's checkprogsize matches the ESP-IDF
partition table.
---
Duplicate comments:
In `@platformio.ini`:
- Line 18: The platform key in platformio.ini is unpinned (currently "platform =
espressif32"); update that line to pin a specific PlatformIO platform version
(for example "platform = espressif32@<version>") so builds are reproducible
across machines/CI, then verify the change by searching for "platform =" and the
[env:*] sections to ensure all envs use the pinned platform; edit the existing
"platform = espressif32" entry rather than adding a new duplicate.
---
Nitpick comments:
In `@platformio.ini`:
- Around line 28-30: The build_flags entry uses a non-canonical macro definition
"-D CONFIG_SPIRAM_CACHE_WORKAROUND"; update the build_flags block to use the
canonical no-space form "-DCONFIG_SPIRAM_CACHE_WORKAROUND" (and verify other
macros like "-DBOARD_HAS_PSRAM") so the -D macros are consistently formatted and
avoid tooling/parser issues; edit the build_flags lines accordingly.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
partitions.csvis excluded by!**/*.csv
📒 Files selected for processing (1)
platformio.ini
Add platformio.ini with ESP-IDF framework configuration
Add scripts/build_pio.sh for convenient build/flash/monitor
Update .gitignore with PlatformIO output directories
Add PlatformIO build documentation to README files
Document PlatformIO implementation plan in docs/PLATFORMIO_PLAN.md
Dual build system support: ESP-IDF native (idf.py) and PlatformIO (pio)
can be used interchangeably.
Summary by CodeRabbit
New Features
Documentation
Chores
Other