Skip to main content
Master firmware is the complete flash image used to initialize fresh boards on a factory line. It is different from the application-only binary used for OTA updates.

Choose the correct binary

Do not upload an application-only binary as master firmware. A fresh board also needs its bootloader, partition table, and other required boot images.

Arduino IDE

  1. Select the production Board, Flash Size, and Partition Scheme.
  2. Open Sketch → Export Compiled Binary.
  3. Locate the generated file ending in .merged.bin.
  4. Open Dashboard → Firmware → Upload Firmware.
  5. Enable As Master Firmware Fleet and upload the .merged.bin file.
Arduino also exports a regular .bin file. Keep that application-only file for OTA updates.

PlatformIO

PlatformIO normally produces .pio/build/<environment>/firmware.bin as an application-only image. For fresh boards, merge the exact bootloader, partition table, boot application data, and application images produced by the selected environment.

Generate it automatically from platformio.ini

Add a post-build script to the production environment:
Create scripts/merge_firmware.py in the PlatformIO project:
Build the environment normally:
The post-build script generates:
The script reads PlatformIO’s FLASH_EXTRA_IMAGES and ESP32_APP_OFFSET, so it follows the selected board instead of assuming every ESP32 variant uses the same bootloader offset.

Generate it manually

Replace esp32dev-factory with the production environment name from your platformio.ini. First, confirm the image offsets:
You do not need to complete the upload. Copy the image-offset pairs shown in the generated esptool write-flash command. Bootloader offsets can differ between ESP32 variants, so do not reuse offsets from another board. Then merge the images: For a classic ESP32 build whose upload command uses 0x1000, 0x8000, 0xe000, and 0x10000, run:
Replace the environment directory, chip, image paths, and offsets with the values from your PlatformIO upload command.
ESP32-C3, ESP32-S3, ESP32-C6, and other variants may use a different bootloader offset. Always use the offsets generated for the selected PlatformIO board.
The resulting factory artifact should be named clearly, for example:
Upload that merged image with As Master Firmware Fleet enabled. Continue uploading the regular firmware.bin for OTA releases.

Keep factory and OTA builds compatible

Build the merged image and OTA image with the same board, flash size, and partition scheme. Changing the partition layout later can prevent boot or overwrite persistent device identity stored during factory provisioning. After the master image is uploaded, use Firmngin Factory CLI to burn each board and inject its unique device identity.