# Building the Firmware ## Prerequisites - [PlatformIO](https://platformio.org/) (CLI or IDE) - MeshCore library at `../MeshCore` ## Build Commands ```bash # Full build pio run # Clean build (removes all artifacts) pio run -t clean && pio run # Verbose build (shows compiler commands) pio run -v ``` ## Build Output After a successful build: ``` RAM: 17.6% (57KB / 320KB) Flash: 32.0% (1.0MB / 3.3MB) ``` **Output files in `.pio/build/heltec_v3_repeater/`:** | File | Size | Purpose | |------|------|---------| | `firmware.bin` | ~1.1 MB | OTA updates | | `firmware.elf` | ~2.5 MB | Debugging | | `firmware.factory.bin` | ~1.2 MB | Initial flash (includes bootloader) | ## Build Configuration Key settings in `platformio.ini`: ### LoRa Parameters ```ini -D LORA_FREQ=910.525 # Frequency in MHz -D LORA_BW=62.5 # Bandwidth in kHz -D LORA_SF=7 # Spreading factor (7-12) -D LORA_CR=5 # Coding rate (5-8) -D LORA_TX_POWER=22 # TX power in dBm ``` ### Debug Options Uncomment to enable: ```ini ; -D MESH_PACKET_LOGGING=1 # Log all mesh packets ; -D MESH_DEBUG=1 # Verbose debug output ``` ## Troubleshooting ### Missing MeshCore ``` Error: symlink://../MeshCore not found ``` Ensure MeshCore exists at the expected path: ```bash ls ../MeshCore/library.json ``` ### Library Dependency Errors Clear the library cache: ```bash rm -rf .pio/libdeps pio run ```