Build & Flash
Supported Build Systems
| System | Command | Detection |
|---|---|---|
| PlatformIO | pio run / pio upload | platformio.ini |
| CMake | cmake --build | CMakeLists.txt + toolchain file |
| Make | make | Makefile with cross-compiler |
| ESP-IDF | idf.py build / idf.py flash | sdkconfig |
| Cargo | cargo build --target <triple> | Cargo.toml + embedded-hal |
| Arduino CLI | arduino-cli compile / upload | Arduino includes |
| Zephyr | west build / west flash | prj.conf / west.yml |
Building
> fw_buildRuns the detected build system's compile command. Build output is parsed for errors and warnings from:
- GCC / arm-none-eabi-gcc
- Clang
- IAR
- Keil ARM-CC
- rustc
- xtensa-gcc
Errors include file:line references that navigate directly to the source.
Binary Size Analysis
> fw_binary_sizeShows section breakdown:
Section Size % Flash % RAM
.text 45,312 4.3% —
.rodata 12,048 1.1% —
.data 1,024 0.1% 0.5%
.bss 8,192 — 4.2%
─────────────────────────────────────
Total 58,384 5.5% Flash 4.7% RAMELF Analysis
> fw_read_elf_symbolsReads symbols from the built ELF via arm-none-eabi-nm.
> fw_lookup_symbols DMA1_Stream0_IRQHandlerFinds symbol addresses and sizes.
> fw_disassemble main 50Disassembles a function via arm-none-eabi-objdump -d.
Stack Usage Analysis
> fw_analyze_stack_usageParses .su files generated by GCC's -fstack-usage flag. Reports per-function stack consumption.
> fw_check_stack_overflow_riskIdentifies functions with deep call chains that may overflow the stack.
MAP File Analysis
> fw_analyze_map_fileParses the linker map file (auto-detected from build/, out/, cmake-build-*/) to show memory usage per section and per object file.
Flash Programming
Detecting Tools
> fw_detect_flash_toolsScans for available programmers on your system.
Supported Programmers
| Tool | Targets | Interface |
|---|---|---|
| OpenOCD | Universal (STM32, nRF, RP2040, ESP32, RISC-V) | SWD / JTAG |
| STM32CubeProgrammer | STM32 family | SWD / JTAG / UART / USB DFU |
| esptool | ESP32 variants | UART (USB-UART bridge) |
| nrfjprog | Nordic nRF52/53/91 | SWD (J-Link) |
| J-Link | Universal (Segger probes) | SWD / JTAG |
| pyOCD | CMSIS-DAP probes | SWD |
| dfu-util | USB DFU bootloader | USB |
Flashing
> fw_flashUses the configured flash tool (from Firmware.inverse or auto-detected).
Toolchain Check
> fw_check_toolchainVerifies that required toolchain components are installed and accessible (compiler, linker, flash tool, debug server).
Build Commands
> fw_get_build_commandReturns the exact build command that would be executed for the current project configuration.
Agent Tools Summary
| Tool | Description |
|---|---|
fw_build | Compile the project |
fw_flash | Flash binary to target |
fw_binary_size | Section size breakdown |
fw_get_build_errors | Parse build errors |
fw_get_build_command | Show build command |
fw_detect_flash_tools | Find available programmers |
fw_check_toolchain | Verify toolchain installation |
fw_analyze_map_file | Parse linker map file |
fw_analyze_stack_usage | Parse GCC .su files |
fw_read_elf_symbols | Read ELF symbol table |
fw_lookup_symbols | Find symbol by name |
fw_disassemble | Disassemble function |
fw_check_stack_overflow_risk | Identify overflow-prone functions |
Last edited