build-platformio
Original:🇨🇳 Chinese
Translated
1 scriptsChecked / no sensitive code detected
This is used when you need to compile embedded projects via the PlatformIO command line, call the built-in script to parse environment configurations, execute builds, and locate firmware artifacts.
4installs
Sourceleokemp223/embed-ai-tool
Added on
NPX Install
npx skill4agent add leokemp223/embed-ai-tool build-platformioTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Building PlatformIO Projects
Applicable Scenarios
- The specifies
Project Profileor abuild_system: platformioexists in the workspace.platformio.ini - Users want to compile, clean, or upload firmware for a PlatformIO project.
- A new ,
ELF, orHEXis required for flashing or debugging processes.BIN - Need to confirm if PlatformIO CLI is ready before building.
Required Inputs
- Workspace path (containing ), or an existing
platformio.ini.Project Profile - Optional environment name.
Automatic Detection
- The script automatically detects if the command is available and retrieves its version.
pio - Parses the list of environments in , extracting platform, board, framework, and upload protocol.
platformio.ini - Identifies in the
default_envssection as the default environment.[platformio] - If no environment is specified and a default environment exists, use the default environment; otherwise, use the first environment.
- Searches for firmware.elf/hex/bin artifacts in , sorted by
.pio/build/<env>/.ELF > HEX > BIN - If multiple equally reasonable environments exist, list candidates instead of making silent guesses.
Execution Steps
- First read references/usage.md to confirm whether this is environment detection, listing environments, executing builds, or just scanning artifacts.
- If unsure whether the environment is ready, first run the mode of the built-in script scripts/platformio_builder.py to confirm.
--detect - Use to confirm available environments, then use
--list-envs --project-dir <dir>+--project-dirto execute the build.--env - Read the build results and artifact scan report output by the script, focusing on the preferred artifacts (ELF > HEX > BIN) and failure categories.
- Write the build environment, artifact path, and board information back to the , and hand it over to downstream skills when needed.
Project Profile
Failure Handling
- When the command is unavailable, return
pio.environment-missing - When does not exist or the environment name is invalid, return
platformio.ini.project-config-error - When the build appears successful but no flashable or debuggable artifacts are found, return .
artifact-missing - When multiple equally reasonable environments exist and arbitrary selection is unsafe, return .
ambiguous-context
Platform Notes
- PlatformIO is fully cross-platform (Linux / macOS / Windows) with no platform restrictions.
- The built-in script uses Python standard libraries and subprocess to call , and the build scheduling path itself is cross-platform.
pio - The build directory and artifact paths in the output should remain absolute paths for direct reuse by downstream flashing and debugging skills.
Output Conventions
- Output the build command, project directory, environment name, board, and preferred artifact path.
- Update the with
Project Profile,artifact_path, and board information.artifact_kind - Recommend or
flash-openocdafter success.debug-gdb-openocd
Handover Relationships
- When the next step is to flash the program to hardware, hand over the successful build result to .
flash-openocd - When the next step requires symbol information or a debugging session, hand over the successful build result to .
debug-gdb-openocd - PlatformIO has a built-in upload function (), which can be used directly in simple scenarios without handover.
--upload