BadgeImageGen / BUILD.md
utkucoban's picture
Upload 88 files
6f99abd verified
|
Raw History Blame Contribute Delete
2.05 kB

Build and inspect

Use ESP-IDF v5.5.1, its riscv32-esp-elf GCC 14.2.0_20241119 toolchain, and esptool 5.6.0. The release was built with CMake 3.30.2 and Ninja 1.12.1. The complete configuration is included as source/firmware/sdkconfig, alongside sdkconfig.defaults. Reproducible-build mode and project version 1.0.0 are set.

After installing/activating official ESP-IDF, from the repository root:

idf.py -C source/firmware build

Build your own merged image with official esptool:

python -m esptool --chip esp32c3 merge-bin -o rebuilt-firmware.bin --flash-mode dio --flash-freq 40m --flash-size 4MB --pad-to-size 4MB 0x0 source/firmware/build/bootloader/bootloader.bin 0x8000 source/firmware/build/partition_table/partition-table.bin 0x10000 source/firmware/build/flower_c3.bin 0x70000 data/model-int8.bin

This writes no device. Flash the resulting file at 0x0 using the same guide. Reproducible-build mode removes variable build metadata; byte identity across independent build environments has not been independently verified.

data/model-int8.json describes the weights as signed INT8 OHWI tensors, with byte offsets, little-endian INT32 biases, and power-of-two quantization exponents. source/generated/model-meta.h contains layer descriptors, lookup tables, and the startup latent. The source retains all trained values from data/original.espdl.

For desktop inference with a C11 compiler:

cc -O3 -std=c11 -Isource/generated -Isource/native source/native/flower.c source/native/render.c source/native/host_main.c -o host-model
./host-model data/model-int8.bin output-int8.bin 2000

The output is 320 × 176 interleaved signed INT8 RGB, plus a packed .epaper frame. Seed 2000 has CRC-32 534cfdc5; the embedded startup seed has CRC-32 4033cceb. Original seed-2000 float reference tensors and a seven-seed test report are in data/. Training source is in training/; reproducing training requires the upstream dataset and dependencies listed in data/original-export.json.