# espload

A lightweight, blazingly fast command-line utility written in Rust to flash firmware onto Espressif ESP8266 (and future ESP) microcontrollers over a serial port.

`espload` aims to be a minimal, robust, and modern alternative to heavy Python-based flashing tools, leveraging Rust's type-safe error handling and efficient I/O operations.

## Features

* **Zero-Configuration Handshake:** Automatically triggers the hardware DTR/RTS lines to reset the ESP into bootloader mode.
* **Smart Address Autodetection:** Built-in seamless integration with parsed Intel HEX or SREC firmware files—no need to manually specify the target memory flash offset if the file provides it.
* **Robust Error Architecture:** Fully type-safe communication stack built with custom error enums to ensure zero silent failures.
* **Granular Logging:** Clean, structured log outputs adjustable from silent operations up to deep SLIP-frame debugging filters.

## Installation

You can install `espload` directly via Cargo from crates.io:

```bash
cargo install espload
```

Alternatively, clone the repository and build it from source:

```bash
git clone [https://gitlab.com/zeppelin1979/rust/espload.git](https://gitlab.com/zeppelin1979/rust/espload.git)
cd espload
cargo build --release

```

Usage

espload provides a clean and informative command-line interface.
Verify Connection (Ping)

Test the serial link and trigger the hardware handshake to verify the ESP bootloader responds:

```bash

espload --port /dev/ttyUSB0 ping
```

Flash Firmware

Flash a firmware file (.hex, .srec, or raw .bin). The tool automatically chunks data into 1024-byte blocks and handles sector erasing:

```bash

# Flash with autodetected start address from a HEX file

espload --port /dev/ttyUSB0 flash --file firmware.hex

# Overriding or specifying a manual start address and boosting verbosity (-vv)

espload --port /dev/ttyUSB0 --baud 921600 flash --file firmware.bin --address 0x00000 -vv

Options & Verbosity Levels

    -v: Standard progress insights (INFO)

    -vv: Internal state machines and hardware reset sequence logs (DEBUG)

    -vvv: Raw underlying SLIP data frame transfers (TRACE)
```

License

This project is licensed under the MIT License - see the LICENSE file for details.
