> ## Documentation Index
> Fetch the complete documentation index at: https://launchpad.anxlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Flash ANX OS Firmware onto Your Dev Module

> Use the ANX CLI to flash the latest or a specific firmware version onto your ANX dev module over USB with automatic verification.

The ANX CLI handles the entire firmware flashing workflow over USB: it downloads the selected firmware image, puts your device into a known flash state, writes the image to the module's flash partitions, and runs an automatic checksum verification pass before declaring success. You do not need to manually manage binary images or use a separate flashing tool — the `anx flash` command covers every step.

<Warning>
  Never disconnect the USB cable while a flash operation is in progress. Interrupting the write can corrupt the firmware partition and leave your device in an unbootable state. If that happens, follow the [recovery mode](#recovery-mode) steps below.
</Warning>

## Prerequisites

Before flashing, confirm the following:

* **ANX CLI installed** — run `anx --version` to verify. If the command is not found, follow the [Quick Start guide](/quickstart) to install the CLI.
* **Module connected via USB** — use the cable that shipped with your module or any USB-C cable that supports data transfer (charge-only cables will not work).
* **Module in bootloader mode** — the device must be in bootloader mode before the CLI can write firmware. See Step 1 below.

## Flashing Firmware

<Steps>
  <Step title="Enter Bootloader Mode">
    Place your module into bootloader mode so the ANX CLI can access the flash partition:

    1. Hold the **BOOT** button on the module.
    2. While holding BOOT, press and immediately release the **RESET** button.
    3. Release the **BOOT** button.

    The status LED turns **solid blue**, confirming the module is in bootloader mode and waiting for a flash command. If the LED does not turn blue, repeat the sequence — the timing between pressing RESET and releasing BOOT needs to be precise.
  </Step>

  <Step title="Flash the Latest Stable Firmware">
    With the module in bootloader mode, run the following command to download and flash the latest stable release:

    ```bash theme={null}
    anx flash --latest
    ```

    The CLI downloads the image, writes it to flash, and verifies the result. You will see output similar to:

    ```
    Detecting device...        ANX-A1 found on /dev/tty.usbserial-0001
    Fetching firmware...       1.2.0 (stable) — 892 KB
    Erasing flash...           [████████████████████] 100%
    Writing firmware...        [████████████████████] 100%  892/892 KB
    Verifying checksum...      PASS
    Rebooting device...        Done

    Flash complete. Firmware 1.2.0 (stable) is now running.
    ```

    The module reboots automatically after a successful flash.
  </Step>

  <Step title="Verify the Flash">
    Confirm the correct firmware version is running:

    ```bash theme={null}
    anx device info
    ```

    The `Firmware` field in the output should reflect the version you just flashed:

    ```
    Device ID:   ANX-A1-7F3C
    Firmware:    1.2.0 (stable)
    SDK Target:  1.2.x
    Flash Size:  4 MB
    Free Heap:   182 KB
    Uptime:      00:00:08
    ```

    If the firmware version does not match, re-run `anx flash --latest` and ensure the USB connection is stable throughout the process.
  </Step>
</Steps>

## Flashing a Specific Version

To flash a particular firmware version instead of the latest, pass the `--version` flag:

```bash theme={null}
anx flash --version 1.1.5
```

This is useful when you need to pin a device to a known-good release or reproduce a specific firmware environment for debugging. The same bootloader mode requirement and automatic verification apply.

## Listing Available Versions

To see all firmware versions available for download across all channels, run:

```bash theme={null}
anx firmware list
```

Sample output:

```
VERSION           CHANNEL    RELEASED        SIZE
─────────────────────────────────────────────────
1.2.0             stable     2024-11-01      892 KB   ← current
1.2.1-beta.1      beta       2024-11-14      896 KB
1.2.1-beta.2      beta       2024-11-21      897 KB
1.3.0-nightly     nightly    2024-11-28      904 KB
1.1.5             stable     2024-09-12      871 KB
1.1.4             stable     2024-08-03      869 KB
```

Pass `--channel` to filter by channel, for example `anx firmware list --channel beta`.

## Recovery Mode

If your module becomes unresponsive after a failed flash — the LED does not light up, or the CLI cannot detect the device — use recovery mode to force-flash a minimal bootable image:

```bash theme={null}
anx flash --recovery
```

Recovery mode writes a stripped-down firmware image that restores basic USB communication and a working bootloader. Once the recovery image is running, you can follow the normal flashing steps above to install a full firmware version.

If `--recovery` still fails to detect the device, try a different USB port, a different cable, or a different host machine to rule out a driver or hardware issue.

<Tip>
  Once your device is deployed and connected to Wi-Fi, you can update firmware without a USB cable at all. See the [OTA Updates](/firmware/ota-updates) guide to set up wireless firmware updates.
</Tip>
