compile_and_flash
Compile firmware and flash it to microcontrollers using Arduino CLI, PlatformIO, or ESP-IDF; auto-detects toolchain from project files and can upload to a serial port.
Instructions
Compile and/or flash firmware to a microcontroller using Arduino CLI, PlatformIO, or ESP-IDF.
Args:
project_path: Path to the project directory or sketch file.
toolchain: 'auto', 'arduino-cli', 'platformio', or 'esp-idf'.
When 'auto', detects from platformio.ini, CMakeLists.txt, or .ino files.
port: Serial port for uploading (e.g., '/dev/ttyUSB0').
board_fqbn_or_env:
- For arduino-cli: Board FQBN (e.g., 'esp32:esp32:esp32', 'arduino:avr:uno').
- For platformio: Environment name (-e <env>).
- For esp-idf: Target chip (e.g., 'esp32', 'esp32s3') if setting target.
action: 'compile', 'upload', or 'compile_and_upload'.
extra_args: Optional list of extra CLI flags to append.
timeout_sec: Maximum execution time in seconds (default 300).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | ||
| action | No | compile_and_upload | |
| toolchain | No | auto | |
| extra_args | No | ||
| timeout_sec | No | ||
| project_path | Yes | ||
| board_fqbn_or_env | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||