A binary-level emulator for embedded e-ink devices. inkemu runs the real, unmodified firmware image of a device on a virtual replica of its hardware. You can check how a firmware renders and behaves before you flash it.
Status: early development. inkemu boots the real ESP32-C3 mask ROM from its reset vector. From a full flash image, the ROM loads the stock ESP-IDF second-stage bootloader, which starts the application; the application runs its whole life — FreeRTOS scheduler, tick interrupt, timers, watchdogs — and when it restarts, the chip boots again. The flash is written as on the device: the bootloader records the OTA slot it chose, NVS keeps what the firmware stores, and
--flash-filekeeps the flash of a device from one run to the next. An application.bingiven on its own boots too: inkemu composes the flash around it with the ESP-IDF bootloader it ships and the partition table of the device. The RV32IMC core, with its user mode and its physical memory protection, is validated against riscv-tests and, through RISCOF, against the Sail reference model. The consoles work in both directions. The GPIO matrix, GP-SPI2, I2C0 and the SAR ADC are modelled, and chips attach to the pins through signal traits; the boards of the X4 and the X3 are wired to them: the X4's e-paper panel, buttons, power latch and key, battery and SD card slot; the X3's panel behind its UC8253 controller, its buttons and power key, its switched SD card slot, and the fuel gauge, real-time clock and motion sensor of its I2C bus. Two real firmwares of the Xteink X4 run under inkemu without touching an unmodelled register: CrossPoint 1.6.5 mounts a blank card and draws its home screen, the stock firmware 3.0.2 draws its menu, and the desktop application shows them and passes them its buttons. CrossPoint 1.6.5 recognizes the X3 by its I2C chips and draws its home screen on it too. A firmware sleeps in deep sleep and wakes by the RTC timer as the chip does. Compared with Espressif's QEMU after every instruction, the reference image runs its whole first life — ROM, bootloader,app_main, the ticks of its countdown, to its restart — without a difference outside a numbered table of admitted ones. See the design spec and the roadmap.
cargo build --release
# Boot a virtual Xteink X4 from a full flash image: mask ROM, 2nd-stage bootloader, application.
# Stop after 50 million cycles of the CPU clock...
target/release/inkemu run --device x4 --flash flash.bin --max-cycles 50000000
# ...or after five seconds of device time.
target/release/inkemu run --device x4 --flash flash.bin --max-time 5The console shown is the one the device profile names: for the X3 and the X4, USB-Serial-JTAG, where the ROM and the bootloader mirror their lines and where CrossPoint writes its own (the USB-C port of the X4; whether the magnetic connector of the X3 carries USB data is not known). --console uart0 shows UART0 instead, where an ESP-IDF example writes by default. This is the console of the reference image (the stock ESP-IDF v5.5.2 bootloader and its hello_world example, see Third-party material). The timestamps are those of the emulated device:
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5820,len:0x15a4
load:0x403cbf10,len:0xc64
load:0x403ce710,len:0x2fd0
entry 0x403cbf1a
I (21) boot: ESP-IDF v5.5.2 2nd stage bootloader
I (21) boot: chip revision: v0.3
I (21) boot: efuse block revision: v1.2
…
I (65) boot: End of partition table
I (68) esp_image: segment 0: paddr=00010020 vaddr=3c010020 size=0656ch ( 25964) map
…
I (116) boot: Loaded app from partition at offset 0x10000
I (118) boot: Disabling RNG early entropy source...
I (134) cpu_start: Unicore app
…
--flash takes a full flash image: a dump of a device (esptool.py read_flash 0 ALL flash.bin), or the output of esptool.py merge_bin (bootloader at offset 0, partition table at 0x8000, application). The file may be shorter than the flash of the device; the rest reads as erased. inkemu refuses, before anything runs, a file that cannot be the flash of the device (exit code 2, with the cause and the remedy): an encrypted .xota, an application image alone, an image for another chip, an image that declares more flash than the device has, a file longer than the flash, an empty file. For example:
$ target/release/inkemu run --device x4 --flash app.bin
error: app.bin: the file starts with an image but holds no partition table at offset 0x8000, so it is an application or a bootloader alone, not a full flash image; use an application with --firmware, or give --flash a flash dump or the output of `esptool.py merge_bin` (bootloader, partition table and application)
Without --flash or --firmware the flash is erased and the ROM prints invalid header: 0xffffffff in a loop, as a blank chip does. An application .bin on its own goes to --firmware (below).
The reference image (hello_world of ESP-IDF v5.5.2, saved as flash_hello.bin) runs its whole life: it prints Hello world!, counts down eleven seconds, calls esp_restart(), and the ROM boots again, announcing rst:0xc (RTC_SW_CPU_RST). The seconds the application spends waiting are not executed: the CPU sleeps in wfi and device time jumps to the next timer event, so the eleven seconds of the countdown take about 0.05 s of host time, and the whole run below, 50 million cycles of the CPU, about 1.1 s (measured on one development machine). Its console is UART0, shown with --console uart0 (USB-Serial-JTAG, the default of the X4, carries the same lines, which the ROM mirrors there). With --max-cycles 50000000, standard error reads:
inkemu: Xteink X4 (ESP32-C3 v0.3, mask ROM rev3); timing model datasheet-uncalibrated (not calibrated); console: uart0 (--console); flash: flash_hello.bin (16777216 bytes in 16 MiB)
inkemu: reset by the firmware, a CPU reset (rst:0xc) at pc 0x40048b92, sp 0x3fc8eb10, at 11245787 us of device time
inkemu: cycle limit reached; raise --max-cycles to run longer
inkemu: stopped at pc 0x4004c0d6 after 50000000 cycles (33218861 instructions)
inkemu: 11459206 us of device time; CPU clock at 160 MHz
inkemu: USB host open
inkemu: flash at start: sha256 fc05ef5dbe85372e1da52abdec3bfcbbb110738a60163734666095fcd8c39bf2
The second line is the restart the application asked for: inkemu reports every reset with its cause, the program counter and the stack pointer it found, and the device time it took place at, one line per reset. With --strict-mmio the same run touches no register inkemu does not model and takes no CPU exception, across the restart.
With --max-time 5 instead, the run stops in the middle of the countdown, while the CPU sleeps between two lines; the console ends with Restarting in 6 seconds... and standard error reads:
inkemu: Xteink X4 (ESP32-C3 v0.3, mask ROM rev3); timing model datasheet-uncalibrated (not calibrated); console: uart0 (--console); flash: flash_hello.bin (16777216 bytes in 16 MiB)
inkemu: device-time limit reached; raise --max-time to run longer
inkemu: stopped at pc 0x40381d1a after 27292714 cycles (18155657 instructions)
inkemu: 5000000 us of device time; CPU clock at 160 MHz; the CPU is asleep, waiting for an interrupt
inkemu: USB host open
inkemu: flash at start: sha256 fc05ef5dbe85372e1da52abdec3bfcbbb110738a60163734666095fcd8c39bf2
The last line names the flash the run started from: the whole chip, erased bytes included, so it is what sha256sum says of a 16 MiB image. It is an input of the run, as the ROM and the device are.
Most firmware comes as an application image alone: a release of a community firmware, the firmware.bin of a PlatformIO build, the .bin of an ESP-IDF build. --firmware boots it as a freshly flashed device would:
target/release/inkemu run --device x4 --firmware hello_world.bin --max-time 12inkemu composes the flash first: at offset 0 the ESP-IDF v5.5.2 2nd-stage bootloader it ships (built from unmodified sources, see ADR 0005), at 0x8000 the partition table of the device profile (for the X4, its stock table), the application in the slot the bootloader starts (the factory application, else the first OTA slot), and every other byte erased. The bootloader is chosen by the profile, from its chip; --bootloader <file> puts another one in its place, the bootloader.bin of your build for instance. Standard error says what the flash is made of:
inkemu: Xteink X4 (ESP32-C3 v0.3, mask ROM rev3); timing model datasheet-uncalibrated (not calibrated); console: usb-serial-jtag (the default of the device profile; --console shows another); flash: hello_world.bin (hello_world 1, ESP-IDF v5.5.2) in app0 at 0x10000, behind the ESP-IDF v5.5.2 bootloader inkemu ships (esp-idf-v5.5.2-esp32c3-dio), under the partition table of the profile (16 MiB)
On the first boot the bootloader prints the partition table, No factory image, trying OTA 0 and Set actual ota_seq=1 in otadata[0], as on a device whose otadata is blank. The same files give the same flash: its SHA-256 is printed as flash at start. A file that cannot be booted is refused before the run, with the cause and the remedy (exit code 2): a file that is not an ESP-IDF image, an encrypted .xota, an image for another chip (an ESP32-S3 image on an X4), an application larger than its slot, a corrupt checksum or digest, a whole flash image (it goes to --flash), a bootloader given as the firmware or an application given as the bootloader, an application or a bootloader that requires a later chip revision than the device has. --firmware is only read and, like --flash, is refused next to a flash file that exists unless --reset-flash is given.
inkemu licenses prints the notices and licences of the third-party material inkemu embeds as data: the register descriptions and the bootloader. The notices of the Rust libraries the binary links are not gathered yet; they come with the packaging of releases.
Two firmwares of real X4 units run under inkemu, as the device shows them on its USB-C port, with no register they touch left unmodelled (verified on 2026-10-15, release build, on the machine of a user who has the files; the CI cannot, since neither file may be shipped or downloaded):
-
CrossPoint 1.6.5, the release asset
crosspoint-1.6.5-x3-x4.bin(SHA-2568eccf614b6d6f82284d3ec775a383fd421ec1880481ff863cf44a831e0385764):target/release/inkemu run --device x4 --firmware crosspoint-1.6.5-x3-x4.bin --max-time 5
The console shows the ROM, the bootloader inkemu ships and CrossPoint's own log: it probes the board over I2C, whose address bytes get the NACK of an empty bus as on a real X4 (
i2c_master_transmit_receive failed: [259] ESP_ERR_INVALID_STATE, then[INF] [HW] Xteink probe scores: pass1=0 pass2=0 verdict=0), so the board is an X4 ([INF] [MAIN] Hardware detect: X4); it reads its buttons and its battery on the SAR ADC, then goes on to the SD card and the panel. Without--sd-imageit says[SD] SD card not detectedand draws "SD card error" in the middle of the portrait; with a blank card (inkemu sd create card.img --size 1024, then--sd-image card.img) it says[SD] SD card detected, refreshes its panel three times and draws its home screen ("No open book", "Browse Files", "Library", "File Transfer", "Settings"). Standard error has no warning, and--strict-mmioruns the same run. -
The stock firmware 3.0.2 EN, from a dump of the whole flash of a unit (SHA-256
03866a1fc23a6a624469f508da3a747159b2315303b98779fd8161276a989a88), given to--flash: the X4 starts while its power key is held (the gesture of the device profile, 1.5 s), the firmware latches its supply, stays on and draws its menu ("Read", "Folder", "Settings", "Sync"). With--power-hold 0, the key let go at once, it finds the key released and lets go of its latch: the board cuts the supply at 0.64 s, the run ends there with exit code 0 and says so, with no warning.
The GPIO matrix, GP-SPI2, I2C0 and the SAR ADC of the chip are modelled (sub-project 2b); the chips of the board (the panel, the SD card, the buttons, the battery) are attached to its pins through the signal traits of emu-core (ADR 0012; the I2C bus of the X3, ADR 0015), and the device profile says which pin each one is on (sub-project 2d, ADR 0013). The tests that hold this, crates/emu-cli/tests/real_firmware.rs and crates/host/tests/real_firmware.rs (which runs the firmwares as the desktop application does and writes what the panel shows as PNG files under target/real-firmware/), run on such a machine only: their header says which variables name the files, and each refuses a file whose SHA-256 differs. A dump holds what the device stored, network credentials among it: the tests hash it and never print its bytes, nor the stack dump of a firmware's panic, which may show RAM read from it. The CI exercises the same peripherals with firmwares of this repository: soc_signals, whose test attaches a panel, an SD card and a voltage to the pins of the X4, adc_wait_panic, the wait for the SAR ADC that used to stop both firmwares, and x4_panel_buttons, which uses the wired X4 as a firmware does: its latch, its panel (the tests read the pixels of the glass), its button ladders and its power key, on battery and on a cable (see tools/reference-firmware/README.md).
The X3 has the X4's chip, flash and display bus, but a UC8253 panel controller and an I2C bus with three chips: a BQ27220 fuel gauge, a DS3231 real-time clock and a QMI8658 motion sensor. CrossPoint 1.6.5, one image for both devices, tells them apart by probing those chips. The X3 has no power latch: it powers off into deep sleep, woken by its power key. Its first boot keeps a verdict in NVS, so keep the flash in a flash file and boot twice (verified on 2026-10-15 with the file above):
target/release/inkemu sd create card.img --size 1024
target/release/inkemu run --device x3 --firmware crosspoint-1.6.5-x3-x4.bin --flash-file x3.bin --sd-image card.img --max-time 2
target/release/inkemu run --device x3 --flash-file x3.bin --sd-image card.img --max-time 10The first boot finds the three chips ([INF] [HW] Xteink probe scores: pass1=3 pass2=3 verdict=1), writes the verdict to NVS, then blocks for good on the mutex of Arduino's Wire: the probe ends with Wire.end(), which frees the buffers but keeps the mutex; the read of the gauge's current that follows takes the mutex and returns on the freed buffer without giving it back; the next Wire.begin() takes it again from the same task. No access to the hardware happens on that path. It is a fault of the firmware, deduced from the run under inkemu and from the source, not observed on a new X3: by the source, a unit would meet it too, once, on a first install (a unit updated from an earlier CrossPoint keeps the verdict in NVS), and upstream removed that path after 1.6.5 (crosspoint-reader PR #3809); the analysis and its evidence are in docs/research/sp3-x3-firmware.md §7. Before it, the probe of the panel reads VER=FF FF FF through the pull-up of the board's data line and keeps the UC8253, as reported from the field. The second boot reads the verdict back (Using cached device type: X3), initializes the motion sensor, finds the clock (SDK RTC found), mounts the card and draws its home screen, upright in portrait, the battery at the 70 % the gauge of the profile reports. The desktop application shows it: choose the X3 and keep its flash in a flash file. The chips' values (a battery at 3.85 V, the clock's time at power-on, the sensor lying flat) are parameters of the device profile, [wiring.i2c] of crates/boards/profiles/x3.toml; the clock runs from its start by the device's time, never the host's, so a recorded session replays the same time. The CI holds the same path with a firmware of this repository, x3_panel_sensors, whose test reads every value it gets from the three chips, compares both of its refreshes byte by byte, and wakes it from deep sleep by its power key (see tools/reference-firmware/README.md).
A firmware that calls esp_sleep_enable_timer_wakeup() then esp_deep_sleep_start() sleeps as the chip does: at the write that sets RTC_CNTL.STATE0.SLEEP_EN with the digital domain set to power down, the CPU stops, device time jumps to the alarm of the RTC timer without executing anything, and the chip wakes as a core reset of cause 5. The ROM prints rst:0x5 (DSLEEP),boot:0x8 (SPI_FAST_FLASH_BOOT), checks the CRC of the RTC fast memory and calls the wake stub; the RTC memory (RTC_DATA_ATTR), the RTC timer and the STORE registers are what they were, and ESP-IDF reads the wake cause "timer". Standard error says it at each wake, with the device time of the wake: inkemu: woken from deep sleep by the RTC timer (rst:0x5), a core reset at … us of device time; the CPU had stopped at pc …. A sleep of an hour costs no more host time than one of a second, and where the run is cut into slices changes nothing.
- A pin wakes it too. A firmware that enables the wake by a pin (
esp_deep_sleep_enable_gpio_wakeup, GPIO0 to 5, low or high) wakes at the first instant one of them is at its level, or at the alarm of the RTC timer if that comes first; ESP-IDF reads the wake cause "GPIO". On the X4 the power key is such a pin, and a press of it, from the window, a console script or a session, wakes the device as on the board. A pad held by its own bit (PAD_HOLD,DIG_PAD_HOLD) keeps its output through the reset of the wake; the automatic hold and the isolation of the pads in sleep (DIG_ISO) are not modelled. - A sleep nothing can end ends the run. A firmware that sleeps with no wake source, or with one inkemu does not model, and no press of a button to come, turns the device off: the run ends there with exit code 0, and standard error says since when the device sleeps and what it waits for (
inkemu: the device is in deep sleep since … us of device time; it waits for nothing: the firmware enabled no wake source). A wake source other than the RTC timer and a pin is named in a warning when the chip goes to sleep. A run that reaches its limit while the device sleeps says when the timer wakes it. - Light sleep is refused by name (
esp_light_sleep_start, automatic light sleep): the request is rejected as the chip rejects one, the firmware gets its error code and goes on, and--strict-mmiostops on it. - The CI holds this with
deep_sleep_timer, an application of this repository: it counts its lives in RTC memory, sleeps 2 s on the RTC timer three times, then sleeps with no wake source. Its own wake stub counts its runs in RTC memory, so the test sees that the ROM found the CRC right and ran the stub at each wake, which the console would not show otherwise: when the CRC is wrong, the ROM skips the stub and boots from flash all the same (seetools/reference-firmware/README.md).
What a firmware writes to the flash (NVS settings, the OTA slot the bootloader chose, a file system) lives in the emulated chip, and is lost when the run ends unless --flash-file names a file to keep it in. The second reference image, ESP-IDF's nvs_rw_value_cxx example saved as flash_nvs.bin, keeps a restart counter in NVS:
$ target/release/inkemu run --device x4 --console uart0 --flash flash_nvs.bin --flash-file x4.bin --max-time 5
…
Reading restart counter from NVS ... The value is not initialized yet!
…
inkemu: Xteink X4 (ESP32-C3 v0.3, mask ROM rev3); timing model datasheet-uncalibrated (not calibrated); console: uart0 (--console); flash: flash_nvs.bin (16777216 bytes in 16 MiB), kept in x4.bin
inkemu: device-time limit reached; raise --max-time to run longer
inkemu: stopped at pc 0x40381d1a after 27896912 cycles (18604937 instructions)
inkemu: 5000000 us of device time; CPU clock at 160 MHz; the CPU is asleep, waiting for an interrupt
inkemu: USB host open
inkemu: flash at start: sha256 c3f0eed129d85de6c0f959d481bb99101d14d18ec6fab8bfd11c541128ec757f
inkemu: flash at end: sha256 cfab4ffe5187eeea8ec2ee6e9794886289282f0242ce56aad2842144a6ffb17b; 1 of its 4 KiB sectors was modified; saved to x4.bin
$ target/release/inkemu run --device x4 --console uart0 --flash-file x4.bin --max-time 5
…
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
…
Reading restart counter from NVS ... Done
Restart counter = 1
…
inkemu: Xteink X4 (ESP32-C3 v0.3, mask ROM rev3); timing model datasheet-uncalibrated (not calibrated); console: uart0 (--console); flash: x4.bin (flash file, 16 MiB)
inkemu: device-time limit reached; raise --max-time to run longer
inkemu: stopped at pc 0x40381d1a after 27503374 cycles (18341463 instructions)
inkemu: 5000000 us of device time; CPU clock at 160 MHz; the CPU is asleep, waiting for an interrupt
inkemu: USB host open
inkemu: flash at start: sha256 cfab4ffe5187eeea8ec2ee6e9794886289282f0242ce56aad2842144a6ffb17b
inkemu: flash at end: sha256 7ad0acf62e5a4e20aa6d47be0f1d922a7b89cb204941feac1ab2fea71363b709; 1 of its 4 KiB sectors was modified; saved to x4.bin
The second run is a power-on of the device the first run left: it finds the counter. The rules of the flash file:
- It is the chip and nothing else: a raw image of exactly the size of the flash of the device (16 MiB for the X4), with no header.
esptool.pyandsha256sumread it. A file of another size is refused with both sizes, and is never padded or cut; a directory or a symbolic link at the path is refused, and a link is not followed. - Read at the start, written at the end. A run reads the file when it exists and replaces it when it ends, whatever ends it: a limit, the first Ctrl-C, a
--strict-mmiostop, a CPU that waits for ever, a reader that went away, a console that cannot be written. A run that started from the file and modified nothing leaves it as it is; if the file was removed while the run went on, it is written again, and the summary says so. The file is replaced in one step (a temporary file in the same directory,.x4.bin.tmp, then a rename), never written while the run goes on: a run that is killed, or ended by a second Ctrl-C before its summary begins, loses what it wrote to the flash and leaves the file of before. Once the summary has begun, Ctrl-C ends nothing: the summary and the save complete. A run killed while it saves can leave the temporary file behind. That name is inkemu's: the next run on the same flash file removes whatever sits there, once nothing can refuse that run any more and before its first instruction, and says so on standard error (inkemu: removed .x4.bin.tmp, found at the name where a save of the flash file x4.bin puts its temporary file (an interrupted save leaves one there); nothing to do: the flash file itself is left as it is, and that name is kept for its saves). There is nothing to do about that line. What is put at that name while the run goes on is removed by the save, which says so too (inkemu: removed .x4.bin.tmp, put while the run went on at the name where a save of the flash file x4.bin puts its temporary file; nothing to do: the flash file is saved through that name now). A link at that name is removed itself, never what it points to. A run that is refused, for its flash file, for its image or for a missing ROM, removes nothing. --flashis a seed, and is never written. It is what a run starts from when the flash file does not exist yet. Given with a flash file that exists, it is refused before anything runs, because a run cannot start from two flashes: drop--flashto go on from the file, or add--reset-flashto start again from the image (or from an erased flash) and replace the file when the run ends. The two options cannot name the same file, since one is only read and the other is replaced: by the same path, another spelling of it, a symbolic link or a hard link, with or without--reset-flash, the run is refused before anything runs and the file is left as it is. Nor can--flashname the temporary file of the flash file (.x4.bin.tmp, where an interrupted save can leave the flash) or its lock file (x4.bin.lock), which the run writes and locks: by any of the same routes, the run is refused before anything runs and the image is left as it is. To start from what an interrupted save left, copy it to another name and give that copy to--flash.- What would keep the file from being saved is refused when the run starts, before the ROM is loaded, whenever it can be known then: a path that ends as the path of a directory does (
x4.bin/), a directory that does not exist or in which no file can be created, a name too long for its lock file and its temporary file (each is five bytes longer), something at the path that is not a flash of the device. A run refused for what is at the path leaves no lock file. One refusal comes later, once the ROM is loaded and still before the first instruction: something at the name of the temporary file that cannot be removed (a directory), because nothing at that name is touched until no other refusal can come. What happens while the run goes on (the directory removed, the disk full) is the error of the end of the run, below. - For its owner alone. A flash holds what the firmware keeps, network credentials among it. On Unix, a flash file that inkemu creates is readable and writable by its owner only (mode
0600), and one that it replaces keeps its mode. A flash file you cannot write (mode0400, say) is refused when the run starts, also with--reset-flash, because replacing it would get round its mode: make it writable, or keep it as it is and give it to--flash, which is only read, with another path for--flash-file. On other systems the file gets the access rights the system gives a new file. - One run at a time. A lock file beside the flash file (
x4.bin.lock) is held for the whole run; a secondinkemu runon the same file is refused at once, with the name of the lock. The lock file is left in place; it is empty, and the system frees the lock when the process ends, however it ends. What sits at that name and is no regular file (a symbolic link, a named pipe, a directory) is refused by name: it is neither followed nor opened. - A flash file that cannot be written when the run ends is an error: the message says what could not be done and that the writes of the run are lost, and the exit code is 2 (a
--strict-mmiostop keeps 3). One case gives no message: a file-size limit of the host (ulimit -f) smaller than the flash makes the system kill inkemu while it saves. The flash file of before stays, and what the run wrote to the flash is lost. - Without
--flash-file, the summary says what was lost:flash at end: 1 of its 4 KiB sectors was modified and is not kept, since the run has no flash file; pass --flash-file <path> to keep the flash of the device from one run to the next.
Things worth knowing:
- Two limits, two clocks.
--max-cycles Nstops the run when the CPU has executed N cycles of its clock;--max-time Sstops it when S seconds of device time have elapsed since power-on (a decimal number:30,2.5,0.001).--max-cyclescounts the cycles the CPU executes, not device time: a sleeping CPU executes none while device time goes on, as it does across resets. A firmware that sleeps therefore reaches that limit late (the reference image waits on a timer for eleven seconds and still stops at--max-cycles 50000000), and one whose sleep nothing interrupts never does;--max-timebounds both. Both may be given; the first one reached ends the run, with exit code 0. The stop is exact and the same on every host: the first instruction boundary at or after the limit, or the limit itself when the CPU is asleep. A firmware that waits for an interrupt nothing can raise ends the run by itself, with exit code 4. - Ctrl-C and
kill. Without a limit a run ends with Ctrl-C, which prints the same summary as a limit, with exit code 0. A second Ctrl-C before the run begins its summary exits at once, with code 130 and no summary, and the flash file is the one of before. Once the summary has begun (its first line says why the run ended; the warnings above it are not part of it), Ctrl-C ends nothing: the summary is printed to its end, the flash file is saved, and the exit code is that of the end of the run (0 when the first Ctrl-C ended it). A plainkillis not handled and ends the process without a summary either. With--trace-hash, the hash of an interrupted run covers what ran up to the cut, which depends on host timing: it is not reproducible; the hash of a run ended by a limit is. - The watchdogs are real. Without
--flash, the ROM printsinvalid header: 0xffffffffuntil the watchdog the chip arms at reset expires, 1.3 s later, and boots again withrst:0x7 (TG0WDT_SYS_RST), as a blank chip does. A firmware that stops feeding its watchdogs is reset the same way, and the next boot names the watchdog and the address it was caught at (Saved PC). inkemu's ownreset by …line gives the cause, the program counter, the stack pointer and the device time of every reset, one line each, also after a system reset, where the ROM prints noSaved PC. Past 4096 resets in one run, the later ones are counted and the summary says how many were not listed. - The console is as slow as the line. A UART byte lasts the frame the firmware programmed (start bit, data bits, parity, stop bits) at its baud rate; a USB-Serial-JTAG packet reaches the host 50 µs after the firmware commits it, if a host reads the port. When a run stops, what was still on its way is printed too.
--consolechooses which serial output of the device goes to standard output:uart0,uart1orusb-serial-jtag; the ROM prints on the first and on the last. Without it, the console is the one the device profile names (itsconsolekey):usb-serial-jtagfor the X3 and the X4, the port a user of the device reads. The first line on standard error names the console shown and says whether the profile or--consolechose it. What the device receives comes from a console script (below), never from the terminal: typing makes sense only when device time follows the clock on the wall, which inkemu does not do yet. - Pipes and redirections.
inkemu run … | head -5ends whenheadhas its lines: a run whose reader went away says so and ends with exit code 0. On Unix this also holds when the firmware prints nothing more: every so often, after a slice that had nothing to print, inkemu asks whether its reader is still there, and a reader that left is noticed after 64 such slices at most (a few milliseconds to half a second on the machine it was measured on, depending on what the firmware does). A run that ends by itself in the meantime ends as what it is, with the exit code of that end. On other systems such a silent run goes on to its limit or to Ctrl-C. When standard output cannot be written for another reason (a full disk), the run ends with exit code 2; a--strict-mmiostop keeps its code whatever happened to the console. A closed standard output (>&-) cannot be told from/dev/null, because the Rust runtime reopens it on the null device before the program starts: it behaves like/dev/null, the console is dropped and the run ends as it would have, with exit code 0. - What is not emulated yet. Light sleep, refused by name: see Deep sleep. There is no radio. The panels of the X4 and the X3 are approximations: their waveforms are built for the model (or, on the X3, sent by the firmware) and their optics assumed, not measured on a device, and the window says so under the screen; which edge of the X3's glass its first gate drives, and the durations of its UC8253 that the datasheet does not give, are assumed too (ADR 0015). GDMA, the multi-channel scan of the SAR ADC, and the DMA, dual and quad modes of GP-SPI2 stop a strict run by name. The line of standard error that names the device says
timing model datasheet-uncalibrated (not calibrated): the cycle cost of each instruction is estimated, not measured on a device, so a device time is plausible, not exact (the calibration bench is sub-project 8). The CI holds it within one published figure: Espressif's CoreMark example (GCC 14.2.0, CoreMark at-O3, code in IRAM), timed by the firmware itself on inkemu's device time, scores 424.6 (on 2026-10-15), within 15 % of the 483.27 the ESP32-C3 datasheet publishes (−12.1 %), as criterion 5 of the specification asks. That bounds the average cost of CoreMark's instructions (between about 0.97 and 1.31 cycles each); it does not make the model calibrated (ADR 0009). - The flash is written as a NOR chip is. A program can only clear bits (each byte becomes the AND of the old one and the new one) and wraps to the start of its 256-byte page; an erase sets a 4 KiB sector, a 64 KiB block or the whole chip to
0xFF; both need the write-enable latch, which the chip clears when the operation completes. On the first boot of a layout with OTA slots and a blankotadatapartition, which is the layout of the Xteink X4, the bootloader erases and programsotadata, and the next boots find it. Every operation completes at once: an erase that takes a tenth of a second on a device takes no time here (real durations come with the calibration bench, sub-project 8). What the model does not do is refused by name, never guessed. The chip refuses a command it does not have, a command in another frame than its own (each command has one: its address width, its dummy clocks and its data, so a write enable sent with an address is refused as well), an address past the end of the chip, and a program or an erase while a block-protect bit of the status register is set. The controller refuses a transfer whose data phase is longer than 64 bytes or is not a whole number of bytes, a hard-wired program of no byte or of more than 64, a suspend request, and several command bits in one write ofSPI1.CMD. A refused command reads nothing and changes nothing. The status register is not part of the flash file: it starts from its factory value at every run. - A read that may differ from the device is said. inkemu reads the flash at every access through the cache windows; a device reads its cache, which keeps the bytes it loaded until the firmware invalidates it. When a firmware reads flash through a window, programs or erases it, and reads it again without invalidating the cache, inkemu returns the new bytes and warns that a device may still return the old ones (
read of the flash window at … may differ from the device);--strict-mmiostops there. The warning is given for a 64 KiB page of flash, not for a cache line, which is why it says "may". No path of the ROM, the bootloader or ESP-IDF that was read or measured triggers this, and the reference images (hello_world, and the NVS example under its own partition table and under that of the X4) run without it in strict mode; ESP-IDF's invalidation after a write to mapped flash is held by unit tests only, no reference image exercises it. - The PMP is enforced, the other protections are not yet. The 16 entries of the CPU's physical memory protection are checked at every fetch, load and store, with the rules of the ESP32-C3 (its TRM, §1.8: an access succeeds when an entry that holds it grants it, without the static priority of the RISC-V specification), and the user mode exists. ESP-IDF locks entries over the whole address space at start-up: a firmware that dereferences a null pointer, writes to the flash data window or executes from data memory gets the access fault the device gives it, and its panic handler runs; the reference firmwares never do. The permission registers of the
SENSITIVEblock and the stack guard ofASSIST_DEBUGare stored and never raise a fault (sub-project 4).
The options and the exit codes, as inkemu run --help prints them:
Boot a device from its mask ROM and print its console
Usage: inkemu run [OPTIONS] --device <DEVICE>
Options:
--device <DEVICE> Device profile id; an unknown id prints the available ones
--flash <FLASH> Full flash image to boot: a dump of a device (`esptool.py read_flash 0 ALL flash.bin`), or the output of `esptool.py merge_bin`. Its bootloader, partition table and application run as on the device. Without it the flash is erased and the ROM reports an invalid header, as a blank chip does. The image is only read: what the firmware writes to the flash is kept by --flash-file, or lost when the run ends
--firmware <FILE> Application image to boot (the .bin of an ESP-IDF build or of a release, its first byte 0xE9): the flash is composed from it, as a device freshly flashed holds it. The bootloader inkemu ships for the device goes at offset 0, the partition table of the device profile at 0x8000, the application in the slot the bootloader starts (the factory application, else the first OTA slot), and every other byte is erased, the OTA data partition included. The file is only read. A whole flash image goes to --flash instead
--bootloader <FILE> Bootloader to compose the flash with instead of the one inkemu ships for the device: the bootloader.bin of a build. It is checked against the device and written as it is
--flash-file <FILE> Keep the flash of the device in this file from one run to the next: a raw image of exactly the size of the flash. A run starts from the file when it exists (--flash or --firmware is then refused unless --reset-flash is given) and writes it when it ends: at a limit, at the first Ctrl-C, at a --strict-mmio stop, when the CPU waits for ever. The file is replaced in one step, never written while the run goes on, so a run that is killed leaves the file of before. The new content goes through a temporary file beside it (.FILE.tmp, the name of FILE after a dot): what is found at that name (an interrupted save leaves its file there) is removed by the next run that starts, and by the save, which say so. A lock file beside it (FILE.lock) refuses a second run on the same file; it is left in place. A flash holds what the firmware keeps, network credentials among it: on Unix a file created here is readable and writable by its owner only, one that is replaced keeps its mode, and one that cannot be written is refused
--reset-flash Start from the --flash image, or from an erased flash, although the flash file exists, and replace the file when the run ends. With --firmware, start from the flash composed from it
--max-cycles <MAX_CYCLES> Stop when the CPU has executed this many cycles of its clock. The limit counts executed cycles, not device time: a sleeping CPU executes none, so a firmware that sleeps reaches it late, and one whose sleep nothing interrupts never does; --max-time bounds both
--max-time <SECONDS> Stop when this many seconds of device time have elapsed since power-on (a decimal number: 30, 2.5, 0.001). Device time goes on while the CPU sleeps and across resets
--strict-mmio Stop at the first access to a register the emulator does not model, 8/16-bit write to a peripheral register, operation the emulator cannot perform faithfully, access to flash that is not mapped, or read through a flash window that may differ from the device (exit code 3)
--console <CONSOLE> Which console of the device goes to standard output. Without it, the console the device profile names; the first line on standard error says which console is shown and where the choice came from [possible values: uart0, uart1, usb-serial-jtag]
--console-script <FILE> What the host sends to the consoles, and when: a text file whose first line is `inkemu-console-script 1`, then one step per line: `send CHANNEL "BYTES"`, `wait 250ms`, `wait-for CHANNEL "TEXT"` (the next steps are dated from the device time the text reached the host), `usb-host absent|attached|open`. CHANNEL is uart0, uart1 or usb-serial-jtag; strings take \r \n \t \\ \" \xHH, and Enter is \r. Every step is dated in device time, so two runs with the same script are the same run. A script not through when the run ends makes it exit 5
--usb-host <USB_HOST> The USB host on the USB-Serial-JTAG port when the device starts: absent (no cable), attached (the port closed: frames, nothing read) or open (a program reads and writes the port) [default: open] [possible values: absent, attached, open]
--rom-dir <ROM_DIR> Use the ROM ELF files of this directory and never download
--trace-hash Print the execution trace hash at the end (determinism checks)
--record <FILE> Record the run in this file, a session that `inkemu replay` replays: the identity of the ROM (not the ROM), the device profile, the whole flash the run starts from, the limits, the USB host at power-on, the blocks of the SD card that are not all zeros (64 MiB at most), every input the consoles, the USB host and the board (its keys, its cable) received with its device time, and what the run came to (its end, device time, cycles, instructions, trace hash, final flash, changes of the SD card and consoles). The file is written when the run ends, however it ends but at a second Ctrl-C: a run cut by Ctrl-C or by its reader is recorded with the device time it stopped at. The path may not be a file the run reads or writes, even one that does not exist yet (the flash file, its lock and temporary files, the SD image and its journals, a ROM file), and its directory must exist. A session holds the whole flash: on Unix the file is readable and writable by its owner only. Recording turns the trace hash on
--power-hold <MS> How long the power key is held when the device starts, in milliseconds: on its battery the X4 starts only while its key is held, and its firmware checks that it still is. Without it, the hold of the device profile (`[power] hold_ms`); 0 presses nothing. The press and the release are inputs of the run, which a session records
--usb-power A cable powers the device from power-on: its USB detection line reads high, and the supply holds whatever the firmware does with its power latch
--sd-image <FILE> The image of the SD card in the slot of the device: the card's blocks, from block 0, exactly its capacity (`inkemu sd create` makes a blank one). It is locked while the run lasts, read as the card is read, and what the firmware writes is saved to it in place, through a journal beside it (.FILE.journal), when the run ends. It may not be a file the run reads or writes besides
--sd-read-only Insert the card write-protected: the firmware cannot write it, and the image is never written
-h, --help Print help
Exit codes:
0 the run ended normally: the cycle limit or the device-time limit was reached, Ctrl-C was
pressed, the reader of standard output went away, the device went into a deep sleep
nothing inkemu models can wake it from, or the device turned its own supply off
2 error: unknown device, missing or invalid ROM, refused flash image, flash file or SD image,
standard output cannot be written, or the flash file or the SD image could not be written
when the run ended (what the firmware wrote to them is then lost), or the session of
--record could not be written
3 stopped by --strict-mmio (an unmodelled register, an 8/16-bit register write, an operation the
emulator cannot perform faithfully, flash that is not mapped, or a read through a flash
window that may differ from the device)
4 the CPU waits for an interrupt and none can come: no interrupt line is pending and no device
has anything scheduled
5 the run would have exited 0, but the --console-script was not through: it was waiting for a
text, or one of its steps is dated after the end of the run
130 Ctrl-C was pressed a second time before the run began its summary: no summary was printed,
and the flash file is the one of before. Once the summary has begun, Ctrl-C ends nothing:
the summary and the save of the flash file complete, with the exit code of the end of the run
The device console goes to standard output. Everything inkemu has to say goes to standard error:
- first, what was done before the run could start, when something was: the download of a ROM, the removal of what sat at the temporary name of the flash file;
- then the device, the timing model, the console shown (and whether the profile or
--consolechose it) and the flash in use; - as the run goes, one
warning:line for each thing it cannot do faithfully or that the firmware got wrong — an unmodelled register read or write (with the peripheral, the register, its address and the program counter), an 8- or 16-bit write to a peripheral register, an operation it cannot perform faithfully (a flash command the chip model does not have, or one it has, sent in another frame than its own or at an address past the end of the chip; a program or an erase while a block-protect bit is set; a flash suspend request; several flash command bits written at once; an SPI flash transfer whose command is not 8 bits long, or whose data phase is longer than 64 bytes or not a whole number of bytes; a hard-wired program of no byte or of more than 64; SHA through DMA; a SHA mode the chip does not have; a clock source it cannot turn into a frequency; an RTC slow clock other than the RC oscillator; a byte written to a UART whose transmit FIFO is full; a UART byte sent on a source clock it has no frequency for, such as the RC fast clock), an access to flash that no MMU entry maps, a read through a flash window that may differ from the device, a CPU exception (named in words, with its program counter and stack pointer) — and oneinkemu:line for each reset, which is an event of the run and not a warning; - at the end, why the run stopped, where (program counter, cycles, instructions), the device time elapsed and the CPU clock, followed by
; the CPU is asleep, waiting for an interruptwhen it is, then the state of the USB host and, with a console script, how far it got, then the most repeated lines with their count, the trace hash when it was asked for, and the flash: the SHA-256 of the content the run started from, then what became of it. With a flash file: saved, with its SHA-256 and the number of 4 KiB sectors modified; left as it was, when the run started from the file and modified nothing; or written again, when that file was removed while the run went on. Without one: the number of sectors modified and not kept, and no line at all when nothing was modified.
Each distinct warning and each distinct reset is listed once, however often it comes. --strict-mmio turns the first warning into a stop with exit code 3, for CI; CPU exceptions and resets are excepted, because they are what the firmware does on the device. Registers that inkemu stores without modelling their effect are listed in docs/registers-accepted-without-effect.md.
To build the reference images yourself (it needs Docker; nothing is executed on the host), see tools/reference-firmware/README.md. Run the tests (cargo test --workspace) as an ordinary user, not as root: some of them need a file or a directory that their user cannot write, and under root they fail with a message that says so.
The first run downloads the ROM (4.9 MB) from Espressif's esp-rom-elfs release 20260528 and checks its SHA-256 before using it. To work offline, extract the archive yourself and pass --rom-dir <directory>. inkemu run reads only the ROM of its device's chip revision from that directory: esp32c3_rev3_rom.elf for --device x4 and --device x3. inkemu rom fetch --all [--rom-dir <directory>] fills a directory in advance, with a single download, with the three ROMs of the supported chips (esp32c3_rev0_rom.elf, esp32c3_rev3_rom.elf and esp32c3_rev101_rom.elf); inkemu rom fetch --device x4 fetches just the one that device needs.
Other commands: inkemu inspect <app.bin> describes an ESP-IDF application image and explains what is wrong when it refuses a file; inkemu licenses prints the notices of the third-party material the binary embeds as data; inkemu rvtest <elf> runs a bare-metal RISC-V conformance test, on a hart with machine and user modes and a 16-entry PMP. For the pinned conformance suites and how to run riscv-arch-test against Sail, see tools/conformance/README.md.
A console script says what the host sends to the device, and when, in device time: two runs with the same script are the same run, to the trace hash.
inkemu-console-script 1
# Wait for the prompt of the firmware, then type a command and Enter.
wait-for uart0 "login: "
send uart0 "root\r"
wait 2s
# Pull the USB cable, then plug it back and open the port.
usb-host absent
wait 100ms
usb-host open
wait-for usb-serial-jtag "ready"
inkemu run --device x4 --firmware app.bin --console-script steps.txt --max-time 30- Steps, one per line, in order:
send CHANNEL "BYTES"sends at the time of the step;wait 250ms(unitsns,us,ms,s) moves that time on;wait-for CHANNEL "TEXT"moves it to the device time at which the last byte ofTEXTreached the host, searched in what the channel sent from the time of the step on;usb-host absent|attached|openchanges the USB host at that time.CHANNELisuart0,uart1orusb-serial-jtag. Strings take\r,\n,\t,\\,\"and\xHH; any other character is sent as its UTF-8 bytes, and nothing is translated: Enter is\r, as a terminal sends it.#begins a comment. The first line isinkemu-console-script 1, a comment allowed after it. The script is UTF-8 without a byte order mark, its lines ended by LF or CRLF. - Time: the waits after a
wait-forare added up, and rounded up to a cycle of the device's 160 MHz time base once. Await-forsearches only what its channel sent from the time of its step on, so the text a channel sent before awaitis not found by thewait-forafter it. Steps at one time reach the device in their order, except that ausb-hoststep applies before asend usb-serial-jtagof that time; a packet of the host reaches the device 50 µs after its time, while the port is open. - The host of the UARTs sends at the rate and in the frame the UART is set to. On USB-Serial-JTAG it sends 64-byte packets; it is
openunless--usb-hostsays otherwise:attachedis a cable without a program reading the port (the device sees frames, its output is not read),absentno cable. - Refusals: a script is read whole before the run starts, and every refusal names its line and its column, then what to write instead. The limits are those of
crates/console-script/src/parse.rs(1 MiB of script, 10,000 steps, 1,024 bytes a send, 256 bytes a text to wait for). - The end: the summary says how far the script got. A run that would exit 0 exits 5 when its script was not through: it was still waiting for a text, or one of its steps is dated after the end of the run.
inkemu run --device x4 --firmware app.bin --console-script steps.txt --max-time 30 --record run.inkrec
inkemu replay run.inkrec--record FILEwrites a session when the run ends, however it ends: the identity of the mask ROM (its revision and SHA-256, never the ROM itself), the device profile as text, the whole flash the run started from,--strict-mmio,--max-cyclesand--max-time, the USB host at power-on, every input the machine accepted on its consoles and from the USB host, dated in device time, and what the run came to: its end, device time, cycles, instructions, trace hash, the SHA-256 of the final flash and of each console. No path, no time of the host. A run that Ctrl-C or its reader cut is recorded with the device time it stopped at, which makes it replayable; a second Ctrl-C ends the process at once (exit code 130), and nothing is recorded. A session holds at most 1 MiB of input and 16,384 chunks of input (eachsendof a script is one) per console, and 16,384 changes of the USB host over the run; a run that sends more says so as soon as it happens, and is not recorded (exit code 2, 3 after a--strict-mmiostop). The file holds the whole flash: it is written through a temporary file (.FILE.tmp) renamed when complete, readable and writable by its owner only on Unix.--recordmay not name a file the run reads or writes, even one that does not exist yet: the files given to the run, the flash file, its lock and its temporary file, the ROM file of--rom-diror the ROM cache; and its directory must exist. All of this is checked before the run starts. Recording turns the trace hash on.inkemu replay FILEchecks that the ROM is the one recorded (--rom-diras forrun), rebuilds the device from the session alone, hands it the recorded inputs, runs it to the same limits, showing the console asrundoes (--consolechooses it), then compares what it gives with what was recorded. It reads no path of the recording and writes nothing of the run, not even the flash; without--rom-dir, the ROM is downloaded into the cache on first use, as forrun. What the session says reaches the terminal with its control characters escaped. A replay gives the same outcome whatever the host and however it is cut into slices.- Exit codes:
0when everything is identical;6when the replay diverges, with the first quantity that differs and its two values;2for a file that is refused (another version, cut short, a length past its bound, a SHA-256 that does not match, each refusal naming the field), a missing or different ROM, and a replay that Ctrl-C or its reader cut before the end of its session (nothing was compared);130for a second Ctrl-C before the replay begins its summary. The format is described in ADR 0007 (French).
inkemu sd create card.img --size 1024 # a blank 1 GiB card, FAT32, label INKEMU
inkemu sd create books.img --size 4096 --label BOOKS
inkemu sd recover card.img # finish a save a run left unfinishedThe X4 reads a microSD card in SPI mode; CrossPoint mounts it before its first screen and shows "SD card error" without one. inkemu sd create makes the image of a blank card: an empty FAT32 volume on one MBR partition, laid out as the SD Association's file system specification lays it (partition and data area on 4 MiB boundaries), which is all CrossPoint needs to reach its home screen (it creates its /.crosspoint directory itself). The size is in MiB, from 64 to 2,097,024: up to 2 GiB the card is a standard-capacity one (SDSC, byte addresses), above a high-capacity one (SDHC/SDXC, block addresses). On Unix filesystems the file is sparse, so it takes on disk only what is written (on NTFS it takes its whole size from its creation); it is created through a temporary file moved into place when complete, readable and writable by its owner only on Unix, and never replaces an existing file. Two creations of one size and label give the same bytes. Exit codes: 0 created, 2 refused or not written.
The card itself (chips::sdcard) and its image file (host::sd_image, locked during a run and written in place through a journal when a life ends, so that an interruption leaves the image of before or of after) are ready; a run finishes an interrupted save when it opens the image, and inkemu sd recover does it alone. A journal is bound to its image file; the journal of an image copied, or moved to another filesystem, is refused until inkemu sd recover <image> --accept-journal applies it, still checked whole (given another image's journal, that would overwrite blocks of this one). A journal that cannot be applied may have been applied in part: the message says so, and leaves the choice to the user. Exit codes of recover: 0 applied or nothing to finish, 2 refused. The card sits in the slot of the X4 (inkemu run --sd-image, --sd-read-only for a write-protected one, or the "SD card" section of the window's start dialog, which can make a blank one); a session keeps what the card held at the start (its blocks that are not all zeros, up to 64 MiB of them) and the fingerprint of what the last life changed on it, which a replay compares. See ADR 0014 (French).
app/ is a desktop application (Tauri 2, React, TypeScript) that does what inkemu run and inkemu replay do, from a window: choose the model (the X4 by default), power it on from an erased flash, a whole flash image or an application behind the bootloader inkemu ships, keep its flash in a flash file, run, pause, step one instruction, reset, power off, at real speed or as fast as the host goes; read and type into the three consoles, open or close the USB host; record a session and replay one, with its verdict; capture the screen as a PNG; follow the status (device time, cycles, PC, CPU clock, deep sleep, USB host) and the journal of the run. Its strings are in French and English, the language of the system first; it follows the light or dark theme of the system unless told otherwise; every control works from the keyboard, and the device takes the arrows, Enter, Escape or Backspace and P while it has the focus.
The screen of the X4 is its panel, drawn by the firmware through the SSD1677, in the greys of the panel's optical model, turned upright as the device is held; a full refresh flashes before its image. Under it the window says "Approximate rendering: optical parameters not measured" while the panel's parameters are the model's. The buttons around it press the firmware's buttons, and its power key, held as on the device, turns the device on again after the firmware turned it off (let go too soon, the firmware turns itself off again). The start dialog offers a USB cable and an SD card (none, an existing image, or a new blank one). The screen of the X3 is its panel too, drawn through its UC8253 controller in the same optical model and turned upright the same way, with the same notice; its buttons and power key are around it, and the start dialog offers an SD card but no cable: the X3 has no line that tells a firmware a cable is in. The window and the command line share one host library, crates/host.
To run it in development (Node.js 24 with corepack, the Rust toolchain of the repository, and on Linux the libraries of the Tauri prerequisites: libwebkit2gtk-4.1-dev libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev):
cd app
corepack enable # pnpm, at the version app/package.json pins
pnpm install
pnpm tauri dev # Vite on port 1420, then the window
pnpm check # Biome, the types (TypeScript 7) and the tests (Vitest)The ROM is downloaded into the cache on first use, as for inkemu run. Closing the window, quitting or a SIGINT/SIGTERM first powers the device off, so that its flash file and its session are written; what could not be kept is shown before the window goes. The shell is a Cargo workspace of its own (app/src-tauri); no package is built or signed yet (sub-project 9). See ADR 0011 (French).
The debugger. The Debugger button of the toolbar opens a panel under the device: the 32 registers by their ABI names, the PC, the mode of the CPU and its CSRs; the code around the PC, disassembled as objdump writes it (or at an address you give); the memory (ROM, SRAM, SRAM0, RTC memory) 16 bytes to a row with its text. Click the dot of a line of code to set a breakpoint there, or give an address; watch bytes for reads, writes or both. The run pauses at a point and says which, in the panel, the status and the journal; Run goes on past it, Step executes one instruction and says the watched access it made. The panel reads the machine again whenever the run does not move, and on Refresh while it does; after the end of a life it shows the state that life ended in. Nothing it does changes what the machine executes: a run stopped a thousand times has the trace hash of a run in one go, and a replay stopped at points gives "identical". It reads memory without the effects of a load: peripheral registers are never read (a read can change them), and the content of the flash is never shown (it may hold personal data): of the flash, the disassembly reads only the 64 KiB pages the CPU has fetched an instruction from during this life, as decoded text only (any other page is said not executed, since it may hold data), and a watchpoint on a flash window is refused. The points are kept from one start to the next. Read only: registers and memory cannot be written yet. A GDB server for gdb and VS Code is sub-project 4d. See ADR 0016 (French).
inkemu-lockstep is a development tool of this workspace, not part of the distributed inkemu. It runs a flash image in Espressif's QEMU and in inkemu and compares, after every instruction, the PC, x1–x31 and the eight machine CSRs both have (mstatus, mie, mip, mtvec, mepc, mcause, mtval, mscratch). QEMU runs only inside the pinned image espressif/idf:v5.5.2 (tools/conformance/versions.env), never on the host: Docker must be installed and the image pulled (the tool does not pull it), the flash image, a whole flash of the profile's size, is mounted read-only, and running QEMU needs a Unix host (--trace works anywhere).
tools/reference-firmware/build.sh # builds target/reference-firmware/flash_hello.bin
inkemu rom fetch --all --rom-dir rom
cargo run --release -p inkemu-lockstep -- --window hello \
--flash target/reference-firmware/flash_hello.bin --rom-dir rom \
--expect-compared 6813949 --expect-end reset \
--expect-usage tools/ci/lockstep-hello.usage-
--windownames what is compared and under which rows:hello(flash_hello.bin),nvs(flash_nvs.bin) andnvs-ota(flash_nvs_ota.bin) go through the resetesp_restartasks for and end at the next one. The windows, their rows and their pinned counts are listed in docs/lockstep-differences.md.--firmware FILEgives an application image instead of--flash: the flash both sides boot is composed asinkemu run --firmwarecomposes it, behind the bootloader inkemu ships. -
The window
crosspointcompares CrossPoint 1.6.5 (crosspoint-1.6.5-x3-x4.bin), which cannot be distributed: only in local, never in the CI, by an ignored test that refuses any file but the pinned one. Measured on 2026-10-14: 31 088 420 instructions compared, the ROM, the bootloader and the start of the application, up to its read of the temperature sensor, which QEMU does not have.export INKEMU_ROM_ELF_DIR=/path/to/rom export INKEMU_CROSSPOINT_X3_X4=/path/to/crosspoint-1.6.5-x3-x4.bin cargo test --release -p inkemu-lockstep --test crosspoint -- --ignored
-
inkemu runs under the timing model
qemu-icount: 8 ns per instruction, no interrupt latency, so that the timers of both sides fire on the same instruction. Every difference the comparison admits is a numbered row of docs/lockstep-differences.md, with its source and its exact parameters. A row is one of:- a CSR whose bits hold a known pair of values;
- a register or a CSR QEMU keeps through its reset where the chip's CPU reset clears it, held until written;
- register bits copied from QEMU under a mask, every other bit compared, some only after a reset;
- a counter both sides read from their own models, whose gap may move only as the row's sourced bound says;
- QEMU's missing RTC timer, held to the slow clock at device time;
- a behaviour of QEMU the machine takes on for the lockstep only.
Anything else is a divergence.
-
Every run prints what each row did: registers, bits taken from QEMU, the largest move of each counter, what a setting changed. The run fails if a row, a register of a row or a bit of its mask was never used, or if a row was used outside what it declares; a window cut by
--max-instructionsonly lists what it left unused.--expect-usage FILEpins how often each row was used. -
The window goes on through the resets of both sides it declares, with nothing of the machine touched: the chip, as inkemu, resets only its CPU at
esp_restart, where QEMU resets its whole machine. It ends at the next one, at its own bound if it has one, at an access to a register no QEMU peripheral covers (SPI2, I2C0, a measurement of the SAR ADC, the radio…) unless a row names that register, or at--max-instructions. A reset of one side only is a divergence, and a trace that ends before the window does is an error.--trace FILE(or-for standard input) reads a captured-d cpu,nochain,inttrace instead of running QEMU. -
A divergence prints the instruction, the state before it and both states after it with the differences marked, the 64 instructions before it with every value taken from QEMU on the way, and the row that comes nearest to applying.
-
Exit codes:
0: the window ended without a divergence, every row used at every register and bit it declares and within them, as the--expect-*options said;1: a divergence, a reset of one side included;2: an error (arguments, files, Docker, QEMU ending on its own, a trace that is not QEMU's, holds no block or ends early);3: the window ended otherwise than expected, or a row was used a different number of times;4: inkemu stopped on its own;5: a row, a register or a bit was never used, or a row was used outside what it declares;130: Ctrl-C (the container is removed whatever ends the run).
-
The CI runs the command above and the windows
nvsandnvs-otain thereference-bootjob, then four more times, each time with a fault put in inkemu on purpose, which must diverge: in a register of the CPU, and in a read of the SYSTIMER's model, each before the reset and after it. See ADR 0008 (French).
Existing simulators for small e-ink devices recompile the firmware sources against a fake display driver. That only works when you have the sources, and it hides the bugs that live in the real hardware path. inkemu takes the opposite approach. It emulates the SoC, the bus and every chip on the board, then boots the vendor's binary through its real boot chain.
- Any firmware binary: vendor firmware, community firmware, or your own. No sources or symbols required.
- Hardware fidelity: the device's exact memory map and RAM size, a cycle-level timing model, watchdogs, deep sleep.
- Realistic e-ink rendering: display controllers are emulated command by command, and each pixel has an optical state driven by the waveform LUTs. Full-refresh flashing, ghosting, grayscale and refresh durations come out of that model naturally.
- Devices as data: a device is a declarative TOML profile listing its SoC, external chips, wiring and button layout. Adding one does not touch the core.
- Deterministic: every input is a timestamped event, so any session can be recorded and replayed bit-for-bit. That includes network traffic.
- Tooling: serial console, GDB remote server, resource monitor (RAM, CPU, battery), headless CLI with input scripts and visual regression for CI.
- Connectivity: emulated Wi-Fi with real Internet access through a virtual access point, and BLE with virtual devices or bridged to the host adapter.
- Everywhere: one Rust core, compiled natively for Linux, macOS and Windows (Tauri app) and to WebAssembly for the browser. UI in English and French.
| Family | SoC / ISA | Devices |
|---|---|---|
| Espressif ESP32-C3 | RISC-V RV32IMC | Xteink X4, Xteink X3 |
| Espressif ESP32-S3 | Xtensa LX7 (dual core) | Xteink X4 Pro, Xteink X4C |
Xteink devices are the first targets. The architecture is not tied to them, and more devices and SoCs will follow.
- RV32IMC core, minimal ESP32-C3, firmware loader, CLI: boot a firmware to its console logs. 1a done; 1b-1, the SoC skeleton and the ROM boot, done; 1b-2, flash and the bootloader, done; 1b-3a, interrupts, timers, watchdogs and reset, done; 1b-3b, flash writes and the device's flash file, done; 1b-3c, a firmware given on its own (
--firmware), done; 1b-3d, the serial consoles in both directions, done; 1b-3e, two real firmwares of the X4 start, done; 1b-3f, deep sleep and the wake by the RTC timer, done; 1b-4a, the documentation without a warning, done; 1b-4b, recording and replaying a run, done; 1b-4c, the lockstep against QEMU over the first life of the reference image, done; 1b-4d, the lockstep through a reset, on two more reference firmwares, and on CrossPoint in local, done; 1b-4e, CoreMark within 15 % of the published score, done; 1b-4f, the PMP enforced and the user mode, with the arch-test grouppmp32, done. - X4 peripherals, desktop UI, e-ink rendering: first visual milestone. 2a, the chips around the SoC (the SSD1677 display controller with an optical model of the panel, the button ladders and the battery read by the ADC), as a library, done; 2b, the peripherals of the SoC (GPIO matrix and IO MUX, GP-SPI2, I2C0, the SAR ADC) and the signal traits the chips plug into, done; 2c, the desktop application and the host library it shares with the command line, done; 2e, the SD card in SPI mode, its block storage and the image file of the host, with
inkemu sd create, done; 2d, the wiring of the X4 (its panel, buttons, power latch and key, battery, cable and SD card on the pins of its profile, the inputs of the board in sessions, the wake from deep sleep by a pin), done. - X3 support (UC8253 panel, I2C sensors). Done: I2C0 reaches the chips through the GPIO matrix, the UC8253 and UC8279d controllers, the BQ27220, DS3231 and QMI8658, the X3 wired from its profile and shown in the desktop application; CrossPoint 1.6.5 reaches its home screen on it.
- Debugging, resource monitor, headless test runner. 4a, the debugger in the application (registers, CSRs, disassembly, memory read without effect, breakpoints and watchpoints that change nothing of the run), done; then 4b the resource monitor, 4c the live device and the technical view of the panel, 4d ELF symbols and a GDB server, 4e headless scenarios and visual regression, 4f the debug hardware of the chip.
- Wi-Fi (real Internet access) and BLE
- WebAssembly build and web UI
- Xtensa LX7 core and ESP32-S3: X4 Pro (touch, PSRAM, SDMMC) and X4C
- Timing calibration bench
- Signed release packages
- Design specification (French)
- Xteink hardware research, with a source for every fact
- External chips research: the SSD1677's commands, the byte sequences the X4's firmware sends, the optical model of the panel and its assumptions, the button ladders and the battery
- Registers accepted without effect: what is stored but not modelled, and the plan that makes each real
- ADR 0002: the flash model and the cache windows (French)
- ADR 0003: the context every peripheral access receives, device time, and the three levels of reset (French)
- ADR 0004: what an input of a run is, and the life of the flash file (French)
- ADR 0005: the 2nd-stage bootloader inkemu ships, chosen by the device profile and replaceable (French)
- ADR 0006: what the host sends to the consoles and the USB host, inputs of a run dated in device time (French)
- ADR 0007: the format of a recorded session, how it is read and how it is replayed (French)
- ADR 0008: the lockstep against QEMU and its admitted differences (French), with the table
- ADR 0009: the reference of time, CoreMark within 15 % of the score Espressif publishes, and why that does not make the timing model calibrated (French)
- ADR 0010: the user mode, the PMP and the conformance bench (French)
- ADR 0011: the host library, the emulator on its thread, and the ports of the screen and the buttons (French)
- ADR 0012: the signals between the SoC and the chips of a board, five traits of
emu-core, attached by pin or advanced in device time (French) - ADR 0013: the wiring of a device in its profile, the inputs of the board, its supply and the power-on gesture, the wake by a pin, and the sessions of format 2 (French)
- ADR 0014: the SD card in SPI mode, its block storage, and the image file of the host written in place through a journal (French)
- ADR 0015: the I2C bus to the chips through the GPIO matrix, one condition at a time, the UC8253, and the X3 wired from its profile (French)
- X3 research: how CrossPoint 1.6.5 and FreeInk drive the X3, and its chips: the UC8253 and UC8279d, the BQ27220, the DS3231 and the QMI8658
- ADR 0016: the debugger, stops that change nothing of the run, a read without effect, and the flash never shown (French)
- Debugging research: what sub-project 4 can do and with which sources (the GDB remote protocol, disassembly, the debug hardware of the ESP32-C3, FreeRTOS tasks, headless scenarios)
Cette partie reprend le document en français, section par section et en plus court ; les exemples de sortie et les tableaux sont dans la partie anglaise. Les messages de la commande sont en anglais.
inkemu est un émulateur au niveau binaire d'appareils embarqués à écran e-ink. Il exécute l'image réelle d'un firmware, sans la modifier, sur une réplique virtuelle du matériel : on peut vérifier ce qu'un firmware affiche et comment il se comporte avant de le flasher.
État : début du développement. inkemu démarre la vraie ROM masquée de l'ESP32-C3 depuis son vecteur de reset. À partir d'une image flash complète, la ROM charge le bootloader de second niveau d'ESP-IDF, qui lance l'application ; celle-ci vit toute sa vie — ordonnanceur FreeRTOS, interruption de tick, timers, watchdogs — et, quand elle redémarre, la puce démarre de nouveau. La flash s'écrit comme sur l'appareil : le bootloader enregistre l'emplacement OTA qu'il a choisi, NVS garde ce que le firmware y range, et --flash-file conserve la flash d'un appareil d'une exécution à la suivante. Un .bin d'application fourni seul démarre aussi : inkemu compose la flash autour de lui avec le bootloader ESP-IDF qu'il embarque et la table de partitions de l'appareil. Le cœur RV32IMC, avec son mode utilisateur et sa protection mémoire physique, est validé contre riscv-tests puis, avec RISCOF, contre le modèle de référence Sail. Les consoles fonctionnent dans les deux sens. La matrice GPIO, GP-SPI2, I2C0 et le SAR ADC sont modélisés, et des puces se branchent aux broches par des traits de signaux ; les cartes du X4 et du X3 y sont câblées : pour le X4, sa dalle e-paper, ses boutons, son verrou et son bouton d'allumage, sa batterie et son lecteur de carte SD ; pour le X3, sa dalle derrière son contrôleur UC8253, ses boutons et son bouton d'allumage, son lecteur de carte SD à alimentation commutée, et la jauge, l'horloge temps réel et le capteur de mouvement de son bus I2C. Deux firmwares réels du Xteink X4 tournent sous inkemu sans toucher un registre non modélisé : CrossPoint 1.6.5 monte une carte vierge et dessine son écran d'accueil, le firmware d'origine 3.0.2 dessine son menu, et l'application de bureau les montre et leur transmet ses boutons. CrossPoint 1.6.5 reconnaît aussi le X3 à ses puces I2C et y dessine son écran d'accueil. Un firmware dort en sommeil profond et se réveille par le timer RTC comme la puce. Comparée au QEMU d'Espressif après chaque instruction, l'image de référence vit toute sa première vie — ROM, bootloader, app_main, les ticks de son compte à rebours, jusqu'à son redémarrage — sans différence hors d'un tableau numéroté de différences admises.
cargo build --release, puis target/release/inkemu run --device x4 --flash flash.bin --max-cycles 50000000, ou --max-time 5 pour s'arrêter après cinq secondes d'appareil. --flash attend une image flash complète : le dump d'un appareil (esptool.py read_flash 0 ALL flash.bin) ou la sortie d'esptool.py merge_bin. Le fichier peut être plus court que la flash de l'appareil ; le reste se lit comme effacé. Un fichier qui ne peut pas être la flash de l'appareil est refusé avant toute exécution, avec la cause et le remède (code de sortie 2) : un .xota chiffré, une application seule, une image pour une autre puce, une image qui déclare plus de flash que l'appareil n'en a, un fichier plus long que la flash, un fichier vide. Sans --flash ni --firmware, la flash est effacée et la ROM affiche invalid header: 0xffffffff en boucle, comme une puce vierge.
Démarrer une image d'application. --firmware <fichier> démarre un .bin d'application seul (une version d'un firmware communautaire, le firmware.bin d'une construction PlatformIO, le .bin d'une construction ESP-IDF) comme le ferait un appareil qu'on vient de flasher. inkemu compose d'abord la flash : à l'adresse 0 le bootloader de second niveau d'ESP-IDF v5.5.2 qu'il embarque (construit depuis des sources non modifiées, voir l'ADR 0005), à 0x8000 la table de partitions du profil (celle d'origine pour le X4), l'application dans l'emplacement que le bootloader lance (l'application d'usine, sinon le premier emplacement OTA), et tous les autres octets effacés. Le profil choisit le bootloader d'après sa puce ; --bootloader <fichier> en met un autre à sa place, le bootloader.bin de votre construction par exemple. Au premier démarrage, le bootloader affiche la table, No factory image, trying OTA 0 et Set actual ota_seq=1 in otadata[0]. Les mêmes fichiers donnent la même flash, dont le SHA-256 est imprimé (flash at start). Un fichier qui ne peut pas démarrer est refusé avant l'exécution, avec la cause et le remède (code de sortie 2) : un fichier qui n'est pas une image ESP-IDF, un .xota chiffré, une image pour une autre puce, une application plus grande que son emplacement, une somme de contrôle ou une empreinte fausse, une image flash entière (elle va à --flash), un bootloader donné comme firmware ou une application donnée comme bootloader, une application ou un bootloader qui demande une révision de puce plus récente que celle de l'appareil. --firmware n'est que lu et, comme --flash, est refusé à côté d'un fichier de flash qui existe, sauf avec --reset-flash. inkemu licenses imprime les avis et les licences des éléments tiers qu'inkemu embarque comme données : les descriptions de registres et le bootloader. Les avis des bibliothèques Rust liées dans l'exécutable ne sont pas encore rassemblés ; ils viendront avec la distribution des versions.
Firmwares réels du X4. Deux firmwares d'appareils réels tournent sous inkemu, tels que l'appareil les montre sur son port USB-C, sans toucher un registre non modélisé (vérifié le 2026-10-15, construction release, sur la machine d'un utilisateur qui a les fichiers ; la CI ne le peut pas, aucun des deux ne pouvant être livré ni téléchargé). CrossPoint 1.6.5 (crosspoint-1.6.5-x3-x4.bin, SHA-256 8eccf614b6d6f82284d3ec775a383fd421ec1880481ff863cf44a831e0385764), par inkemu run --device x4 --firmware crosspoint-1.6.5-x3-x4.bin --max-time 5 : la ROM, le bootloader livré, puis le journal de CrossPoint : il sonde la carte en I2C, dont les octets d'adresse reçoivent le NACK d'un bus vide comme sur un vrai X4 (Xteink probe scores: pass1=0 pass2=0 verdict=0), donc la carte est un X4 (Hardware detect: X4) ; il lit ses boutons et sa batterie sur le SAR ADC, puis va jusqu'à la carte SD et à l'écran. Sans --sd-image, il dit [SD] SD card not detected et dessine « SD card error » au milieu du portrait ; avec une carte vierge (inkemu sd create card.img --size 1024, puis --sd-image card.img), il dit [SD] SD card detected, rafraîchit son écran trois fois et dessine son écran d'accueil (« No open book », « Browse Files », « Library », « File Transfer », « Settings »). L'erreur standard n'a aucun avertissement, et --strict-mmio fait la même exécution. Le firmware d'origine 3.0.2 EN, depuis le dump de la flash entière d'un appareil (SHA-256 03866a1fc23a6a624469f508da3a747159b2315303b98779fd8161276a989a88), par --flash : le X4 démarre bouton d'allumage tenu (le geste du profil, 1,5 s), le firmware verrouille son alimentation, reste allumé et dessine son menu (« Read », « Folder », « Settings », « Sync »). Avec --power-hold 0, le bouton lâché aussitôt, il trouve le bouton relâché et lâche son verrou : la carte coupe l'alimentation à 0,64 s, l'exécution s'arrête là avec le code 0 et le dit, sans avertissement. La matrice GPIO, GP-SPI2, I2C0 et le SAR ADC de la puce sont modélisés (sous-projet 2b) ; les puces de la carte s'attachent à ses broches par les traits de signaux d'emu-core (ADR 0012 ; le bus I2C du X3, ADR 0015), et le profil de l'appareil dit sur quelle broche est chacune (sous-projet 2d, ADR 0013). Les tests qui le tiennent, crates/emu-cli/tests/real_firmware.rs et crates/host/tests/real_firmware.rs (qui fait tourner les firmwares comme l'application de bureau et écrit ce que montre l'écran en PNG sous target/real-firmware/), ne tournent que sur une telle machine : leur en-tête dit quelles variables nomment les fichiers, et chacun refuse un fichier d'un autre SHA-256. Un dump contient ce que l'appareil a gardé, des identifiants réseau entre autres : les tests en calculent l'empreinte et n'en affichent jamais les octets, ni le vidage de pile d'une panique du firmware, qui peut montrer de la RAM lue dans la flash. La CI exerce les mêmes périphériques avec des firmwares de ce dépôt : soc_signals, dont le test attache un écran, une carte SD et une tension aux broches du X4, adc_wait_panic, l'attente du SAR ADC qui arrêtait les deux firmwares, et x4_panel_buttons, qui se sert du X4 câblé comme un firmware : son verrou, son écran (les tests lisent les pixels du verre), ses échelles de boutons et son bouton d'allumage, sur batterie et sur câble (voir tools/reference-firmware/README.md).
CrossPoint sur le X3. Le X3 a la puce, la flash et le bus d'écran du X4, mais un contrôleur d'écran UC8253 et un bus I2C qui porte trois puces : une jauge BQ27220, une horloge temps réel DS3231 et un capteur de mouvement QMI8658. CrossPoint 1.6.5, une seule image pour les deux appareils, les distingue en sondant ces puces. Le X3 n'a pas de verrou d'alimentation : il s'éteint en sommeil profond, réveillé par son bouton d'allumage. Son premier démarrage range un verdict dans NVS : gardez la flash dans un fichier de flash et démarrez deux fois (vérifié le 2026-10-15 avec le fichier ci-dessus) : inkemu sd create card.img --size 1024, puis inkemu run --device x3 --firmware crosspoint-1.6.5-x3-x4.bin --flash-file x3.bin --sd-image card.img --max-time 2, puis inkemu run --device x3 --flash-file x3.bin --sd-image card.img --max-time 10. Le premier démarrage trouve les trois puces (Xteink probe scores: pass1=3 pass2=3 verdict=1), écrit le verdict dans NVS, puis se bloque pour de bon sur le mutex du Wire d'Arduino : la sonde finit par Wire.end(), qui libère les tampons mais garde le mutex ; la lecture du courant de la jauge qui suit prend le mutex et sort sur le tampon libéré sans le rendre ; le Wire.begin() suivant le reprend depuis la même tâche. Aucun accès au matériel n'a lieu sur ce chemin. C'est une faute du firmware, déduite de l'exécution sous inkemu et de la source, non observée sur un X3 neuf : par la source, un appareil la rencontrerait aussi, une fois, à une première installation (un appareil mis à jour depuis un CrossPoint antérieur garde le verdict dans NVS), et l'amont a retiré ce chemin après 1.6.5 (PR #3809 de crosspoint-reader) ; l'analyse et ses preuves sont dans docs/research/sp3-x3-firmware.md §7. Avant lui, la sonde de l'écran lit VER=FF FF FF à travers le tirage de la ligne de données de la carte et garde l'UC8253, comme le relevé de terrain. Le second relit le verdict (Using cached device type: X3), initialise le capteur de mouvement, trouve l'horloge (SDK RTC found), monte la carte et dessine son écran d'accueil, droit en portrait, la batterie aux 70 % que donne la jauge du profil. L'application de bureau le montre : choisissez le X3 et gardez sa flash dans un fichier de flash. Les valeurs des puces (une batterie à 3,85 V, l'heure de l'horloge à la mise sous tension, le capteur à plat) sont des paramètres du profil, [wiring.i2c] de crates/boards/profiles/x3.toml ; l'horloge avance depuis son départ au temps de l'appareil, jamais à celui de l'hôte, donc une session enregistrée rejoue la même heure. La CI tient le même chemin avec un firmware de ce dépôt, x3_panel_sensors, dont le test lit chaque valeur qu'il obtient des trois puces, compare ses deux rafraîchissements octet par octet et le réveille du sommeil profond par son bouton d'allumage (voir tools/reference-firmware/README.md).
L'image de référence (hello_world d'ESP-IDF v5.5.2) vit toute sa vie : Hello world!, onze secondes de compte à rebours, esp_restart(), puis un second démarrage que la ROM annonce par rst:0xc (RTC_SW_CPU_RST). Les secondes d'attente ne sont pas exécutées : le CPU dort dans wfi et le temps de l'appareil saute au prochain événement de timer, si bien que les onze secondes du compte à rebours prennent environ 0,05 s de temps d'hôte, et l'exécution entière de 50 millions de cycles du CPU environ 1,1 s (mesuré sur une machine de développement). Avec --strict-mmio, la même exécution ne touche aucun registre qu'inkemu ne modélise pas et ne prend aucune exception, redémarrage compris.
Conserver la flash d'une exécution à l'autre. Ce qu'un firmware écrit en flash (réglages NVS, emplacement OTA choisi par le bootloader, système de fichiers) vit dans la puce émulée et se perd à la fin de l'exécution, sauf si --flash-file <fichier> nomme un fichier où le garder. La seconde image de référence (l'exemple nvs_rw_value_cxx d'ESP-IDF, flash_nvs.bin) tient un compteur de redémarrages en NVS : une première exécution avec --flash flash_nvs.bin --flash-file x4.bin affiche The value is not initialized yet!, une seconde avec --flash-file x4.bin seul démarre à froid et affiche Restart counter = 1. Les règles du fichier :
- C'est la puce et rien d'autre : une image brute d'exactement la taille de la flash de l'appareil (16 Mio pour le X4), sans en-tête, lisible par
esptool.pyet parsha256sum. Un fichier d'une autre taille est refusé avec les deux tailles ; il n'est jamais complété ni tronqué. Un répertoire ou un lien symbolique à ce chemin est refusé, et un lien n'est pas suivi. - Lu au départ, écrit à la fin. Une exécution lit le fichier s'il existe et le remplace quand elle se termine, quelle que soit sa fin : une limite, le premier Ctrl-C, un arrêt par
--strict-mmio, un CPU qui attend indéfiniment, un lecteur parti, une console impossible à écrire. Une exécution partie du fichier et qui n'a rien modifié le laisse tel quel ; si le fichier a été supprimé pendant l'exécution, il est réécrit, et le résumé le dit. Le fichier est remplacé en une seule opération (fichier temporaire du même répertoire,.x4.bin.tmp, puis renommage), jamais écrit en cours d'exécution : une exécution tuée, ou terminée par un second Ctrl-C avant le début de son résumé, perd ce qu'elle a écrit en flash et laisse le fichier d'avant. Une fois le résumé commencé, Ctrl-C ne termine plus rien : le résumé et l'enregistrement vont à leur terme. Une exécution tuée pendant l'enregistrement peut laisser le fichier temporaire. Ce nom appartient à inkemu : l'exécution suivante sur le même fichier de flash supprime ce qui s'y trouve, une fois que plus rien ne peut la refuser et avant sa première instruction, et le dit sur l'erreur standard (inkemu: removed .x4.bin.tmp, found at the name where a save of the flash file x4.bin puts its temporary file (an interrupted save leaves one there); nothing to do: the flash file itself is left as it is, and that name is kept for its saves). Il n'y a rien à faire de cette ligne. Ce qui est placé à ce nom pendant l'exécution est supprimé par l'enregistrement, qui le dit aussi (inkemu: removed .x4.bin.tmp, put while the run went on at the name where a save of the flash file x4.bin puts its temporary file; nothing to do: the flash file is saved through that name now). Un lien à ce nom est supprimé lui-même, jamais ce qu'il désigne. Une exécution refusée, pour son fichier de flash, pour son image ou pour une ROM absente, ne supprime rien. --flashest l'image de départ, jamais écrite. C'est ce dont part une exécution tant que le fichier de flash n'existe pas. Donnée avec un fichier de flash qui existe, elle est refusée avant toute exécution, parce qu'une exécution ne peut pas partir de deux flashs : retirer--flashpour continuer depuis le fichier, ou ajouter--reset-flashpour repartir de l'image (ou d'une flash effacée) et remplacer le fichier à la fin. Les deux options ne peuvent pas désigner le même fichier, puisque l'une est seulement lue et que l'autre est remplacée : par le même chemin, une autre écriture de ce chemin, un lien symbolique ou un lien matériel, avec ou sans--reset-flash, l'exécution est refusée avant de commencer et le fichier reste tel quel.--flashne peut pas non plus désigner le fichier temporaire du fichier de flash (.x4.bin.tmp, où un enregistrement interrompu peut laisser la flash) ni son fichier de verrou (x4.bin.lock), que l'exécution écrit et verrouille : par chacune de ces mêmes voies, l'exécution est refusée avant de commencer et l'image reste telle quelle. Pour repartir de ce qu'un enregistrement interrompu a laissé, le copier sous un autre nom et donner cette copie à--flash.- Ce qui empêcherait d'enregistrer le fichier est refusé au départ, avant le chargement de la ROM, chaque fois que cela peut se savoir à ce moment : un chemin qui se termine comme celui d'un répertoire (
x4.bin/), un répertoire qui n'existe pas ou dans lequel aucun fichier ne peut être créé, un nom trop long pour son fichier de verrou et son fichier temporaire (chacun compte cinq octets de plus), autre chose qu'une flash de l'appareil à ce chemin. Une exécution refusée pour ce qui se trouve au chemin ne laisse aucun fichier de verrou. Un refus vient plus tard, une fois la ROM chargée et toujours avant la première instruction : ce qui occupe le nom du fichier temporaire sans pouvoir être supprimé (un répertoire), parce que rien n'est touché à ce nom tant qu'un autre refus peut encore venir. Ce qui survient pendant l'exécution (répertoire supprimé, disque plein) est l'erreur de fin d'exécution, ci-dessous. - Pour son seul propriétaire. Une flash contient ce que le firmware conserve, identifiants réseau compris. Sous Unix, un fichier de flash qu'inkemu crée n'est lisible et modifiable que par son propriétaire (mode
0600), et un fichier qu'il remplace garde son mode. Un fichier de flash que l'utilisateur ne peut pas écrire (mode0400, par exemple) est refusé au départ, même avec--reset-flash, parce que le remplacer contournerait son mode : le rendre modifiable, ou le garder tel quel et le donner à--flash, qui ne fait que lire, avec un autre chemin pour--flash-file. Sur les autres systèmes, le fichier reçoit les droits que le système donne à un nouveau fichier. - Une exécution à la fois. Un fichier de verrou voisin (
x4.bin.lock) est tenu pendant toute l'exécution ; une seconde exécution sur le même fichier est refusée aussitôt, avec le nom du verrou. Le fichier de verrou reste en place ; il est vide, et le système libère le verrou à la fin du processus, quelle que soit cette fin. Ce qui se trouve à ce nom sans être un fichier ordinaire (lien symbolique, tube nommé, répertoire) est refusé en le nommant : il n'est ni suivi ni ouvert. - Un fichier de flash impossible à écrire à la fin est une erreur : le message dit ce qui n'a pas pu être fait et que les écritures de l'exécution sont perdues, et le code de sortie est 2 (un arrêt par
--strict-mmiogarde 3). Un cas ne donne aucun message : une limite de taille de fichier de l'hôte (ulimit -f) plus petite que la flash fait tuer inkemu par le système pendant l'enregistrement. Le fichier d'avant reste, et ce que l'exécution a écrit en flash est perdu. - Sans
--flash-file, le résumé dit ce qui a été perdu (flash at end: 1 of its 4 KiB sectors was modified and is not kept…). Dans tous les cas il nomme la flash de départ par son SHA-256 (flash at start: sha256 …), calculé sur la puce entière, octets effacés compris : c'est ce quesha256sumdit d'une image de 16 Mio. La flash de départ est une entrée de l'exécution, comme la ROM et l'appareil.
À savoir :
- Deux limites, deux horloges.
--max-cycles Narrête l'exécution quand le CPU a exécuté N cycles de son horloge ;--max-time Sl'arrête quand S secondes du temps de l'appareil se sont écoulées depuis la mise sous tension (un nombre décimal :30,2.5,0.001).--max-cyclescompte les cycles que le CPU exécute, non le temps de l'appareil : un CPU qui dort n'en exécute aucun alors que le temps de l'appareil continue, comme à travers les resets. Un firmware qui dort atteint donc cette limite tard (l'image de référence attend un timer pendant onze secondes et s'arrête tout de même à--max-cycles 50000000), et celui dont rien n'interrompt le sommeil ne l'atteint jamais ;--max-timeborne les deux. Les deux peuvent être données ; la première atteinte termine l'exécution, avec le code de sortie 0. L'arrêt est exact et le même sur tout hôte : la première frontière d'instruction à la limite ou après, ou la limite elle-même quand le CPU dort. Un firmware qui attend une interruption que rien ne peut lever termine l'exécution de lui-même, avec le code 4. - Ctrl-C et
kill. Sans limite, une exécution se termine par Ctrl-C, qui affiche le même résumé qu'une limite, avec le code 0. Un second Ctrl-C avant le début du résumé sort aussitôt, avec le code 130 et sans résumé, et le fichier de flash reste celui d'avant. Une fois le résumé commencé (sa première ligne dit pourquoi l'exécution s'est terminée ; les avertissements au-dessus d'elle n'en font pas partie), Ctrl-C ne termine plus rien : le résumé est affiché jusqu'au bout, le fichier de flash est enregistré, et le code de sortie est celui de la fin de l'exécution (0 quand c'est le premier Ctrl-C qui l'a terminée). Un simplekilln'est pas géré et termine le processus sans résumé non plus. Avec--trace-hash, l'empreinte d'une exécution interrompue couvre ce qui a tourné jusqu'à la coupure, qui dépend de l'hôte : elle n'est pas reproductible ; celle d'une exécution terminée par une limite l'est. - Les watchdogs sont réels. Sans
--flash, la ROM afficheinvalid header: 0xffffffffjusqu'à l'expiration du watchdog que la puce arme au reset, 1,3 s plus tard, et redémarre avecrst:0x7 (TG0WDT_SYS_RST), comme une puce vierge. Un firmware qui cesse de nourrir ses watchdogs est réinitialisé de la même façon, et le démarrage suivant nomme le watchdog et l'adresse où il a été pris (Saved PC). La lignereset by …d'inkemu donne la cause, le compteur de programme, le pointeur de pile et le temps de l'appareil de chaque reset, une ligne par reset, y compris après un reset système, où la ROM n'affiche pas deSaved PC. Au-delà de 4096 resets dans une exécution, les suivants sont comptés et le résumé dit combien n'ont pas été listés. - La console est aussi lente que la ligne. Un octet UART dure la trame que le firmware a programmée (bit de start, bits de données, parité, bits de stop) à son débit ; un paquet USB-Serial-JTAG atteint l'hôte 50 µs après que le firmware l'a validé, si un hôte lit le port. Quand une exécution s'arrête, ce qui était encore en route est affiché aussi.
--consolechoisit quelle sortie série de l'appareil va sur la sortie standard :uart0,uart1ouusb-serial-jtag; la ROM écrit sur la première et sur la dernière. Sans cette option, la console est celle que nomme le profil de l'appareil (sa cléconsole) :usb-serial-jtagpour le X3 et le X4, le port que lit un utilisateur de l'appareil. La première ligne de l'erreur standard nomme la console affichée et dit si le profil ou--consolel'a choisie. Ce que l'appareil reçoit vient d'un script de console (ci-dessous), jamais du terminal : taper n'a de sens que si le temps d'appareil suit l'horloge murale, ce qu'inkemu ne fait pas encore. - Tubes et redirections.
inkemu run … | head -5se termine quandheada ses lignes : une exécution dont le lecteur est parti le dit et finit avec le code 0. Sous Unix, c'est vrai aussi quand le firmware n'affiche plus rien : de temps en temps, après une tranche qui n'avait rien à afficher, inkemu demande si son lecteur est encore là, et un lecteur parti est remarqué après 64 de ces tranches au plus (de quelques millisecondes à une demi-seconde sur la machine où cela a été mesuré, selon ce que fait le firmware). Une exécution qui finit d'elle-même entre-temps finit comme telle, avec le code de sortie de cette fin. Ailleurs, une telle exécution muette continue jusqu'à sa limite ou jusqu'à Ctrl-C. Quand la sortie standard ne peut pas être écrite pour une autre raison (un disque plein), l'exécution finit avec le code 2 ; un arrêt par--strict-mmiogarde son code quoi qu'il soit arrivé à la console. Une sortie standard fermée (>&-) ne se distingue pas de/dev/null, parce que l'exécutable Rust la rouvre sur le périphérique nul avant que le programme ne commence : elle se comporte comme/dev/null, la console est abandonnée et l'exécution finit comme elle l'aurait fait, avec le code 0. - Sommeil profond. Un firmware qui appelle
esp_sleep_enable_timer_wakeup()puisesp_deep_sleep_start()dort comme la puce : à l'écriture deRTC_CNTL.STATE0.SLEEP_EN, domaine numérique mis hors tension, le CPU s'arrête, le temps de l'appareil saute jusqu'à l'alarme du timer RTC sans rien exécuter, et la puce se réveille par un reset du cœur de cause 5. La ROM imprimerst:0x5 (DSLEEP),boot:0x8 (SPI_FAST_FLASH_BOOT), vérifie le CRC de la mémoire RTC rapide et appelle le stub de réveil ; la mémoire RTC (RTC_DATA_ATTR), le timer RTC et les registresSTOREsont ce qu'ils étaient, et ESP-IDF lit la cause de réveil « timer ». L'erreur standard le dit à chaque réveil, avec son temps de l'appareil (inkemu: woken from deep sleep by the RTC timer (rst:0x5), a core reset at … us of device time; …). Une broche le réveille aussi (esp_deep_sleep_enable_gpio_wakeup, GPIO0 à 5, niveau bas ou haut), au premier instant où l'une est à son niveau, ou à l'alarme du timer RTC si elle vient avant ; sur le X4, le bouton d'allumage en est une, et un appui, depuis la fenêtre, un script ou une session, réveille l'appareil comme sur la carte. Un sommeil sans source de réveil, ou dont la source n'est pas modélisée, et sans appui à venir, éteint l'appareil : l'exécution s'arrête là avec le code 0, et l'erreur standard dit depuis quand l'appareil dort et ce qu'il attend. Le sommeil léger est refusé en le nommant : la demande est rejetée comme la puce la rejette, le firmware reçoit son code d'erreur et continue, et--strict-mmios'y arrête. La CI le tient avecdeep_sleep_timer, une application de ce dépôt, dont le propre stub de réveil compte ses passages en mémoire RTC : le test voit ainsi que la ROM a trouvé le CRC juste et lancé le stub à chaque réveil, ce que la console ne montrerait pas autrement, puisque la ROM, quand le CRC est faux, saute le stub et démarre tout de même depuis la flash. - Ce qui n'est pas encore émulé. Le sommeil léger, refusé en le nommant. Il n'y a pas encore de radio. Les écrans du X4 et du X3 sont des approximations : leurs formes d'onde sont construites pour le modèle (ou, sur le X3, envoyées par le firmware) et leur optique supposée, non mesurées sur un appareil, et la fenêtre le dit sous l'écran ; le bord du verre du X3 que pilote sa première gate et les durées de son UC8253 que la fiche ne donne pas sont supposés aussi (ADR 0015). GDMA, le balayage multi-canaux du SAR ADC et les modes DMA, dual et quad de GP-SPI2 arrêtent une exécution stricte en les nommant. La ligne de l'erreur standard qui nomme l'appareil dit
timing model datasheet-uncalibrated (not calibrated): le coût en cycles de chaque instruction est estimé, pas mesuré sur un appareil, donc un temps d'appareil est plausible, pas exact (le banc de calibration est le sous-projet 8). La CI le tient à un chiffre publié : l'exemple CoreMark d'Espressif (GCC 14.2.0, CoreMark en-O3, code en IRAM), chronométré par le firmware lui-même sur le temps d'appareil d'inkemu, obtient 424,6 (le 2026-10-15), à moins de 15 % des 483,27 que publie la fiche technique de l'ESP32-C3 (−12,1 %), comme le demande le critère 5 de la spécification. Cela borne le coût moyen des instructions de CoreMark (entre 0,97 et 1,31 cycle environ) ; cela ne rend pas le modèle calibré (ADR 0009). - La flash s'écrit comme une puce NOR. Une programmation ne peut que mettre des bits à 0 (chaque octet devient l'ET de l'ancien et du nouveau) et reboucle au début de sa page de 256 octets ; un effacement met à
0xFFun secteur de 4 Kio, un bloc de 64 Kio ou toute la puce ; les deux exigent le verrou d'écriture, que la puce fait retomber à la fin de l'opération. Au premier démarrage d'une disposition à emplacements OTA dont la partitionotadataest vierge, celle du Xteink X4, le bootloader efface puis programmeotadata, et les démarrages suivants la retrouvent. Chaque opération s'achève aussitôt : un effacement qui prend un dixième de seconde sur un appareil ne prend ici aucun temps (les durées réelles viennent avec le banc de calibration, sous-projet 8). Ce que le modèle ne fait pas est refusé en le nommant, jamais deviné. La puce refuse une commande qu'elle n'a pas, une commande dans une autre trame que la sienne (chaque commande en a une : sa largeur d'adresse, ses cycles d'attente et ses données ; une autorisation d'écriture envoyée avec une adresse est donc refusée elle aussi), une adresse au-delà de la fin de la puce, et une programmation ou un effacement quand un bit de protection de bloc du registre d'état est à 1. Le contrôleur refuse un transfert dont la phase de données dépasse 64 octets ou n'est pas un nombre entier d'octets, une programmation câblée de zéro octet ou de plus de 64, une demande de suspension, et plusieurs bits de commande dans une même écriture deSPI1.CMD. Une commande refusée ne lit rien et ne change rien. Le registre d'état n'est pas dans le fichier de flash : il repart de sa valeur d'usine à chaque exécution. - Une lecture qui peut différer de l'appareil est signalée. inkemu lit la flash à chaque accès par les fenêtres du cache ; un appareil lit son cache, qui garde les octets qu'il a chargés jusqu'à ce que le firmware l'invalide. Quand un firmware lit de la flash par une fenêtre, la programme ou l'efface, puis la relit sans invalider le cache, inkemu renvoie les nouveaux octets et avertit qu'un appareil peut encore renvoyer les anciens (
read of the flash window at … may differ from the device) ;--strict-mmios'y arrête. L'avertissement se prononce par page de flash de 64 Kio, non par ligne de cache : c'est pourquoi il dit « peut ». Aucun chemin lu ou mesuré de la ROM, du bootloader ou d'ESP-IDF ne le déclenche, et les images de référence (hello_world, et l'exemple NVS sous sa propre table de partitions et sous celle du X4) s'exécutent sans lui en mode strict ; l'invalidation que fait ESP-IDF après une écriture dans de la flash projetée n'est tenue que par des tests unitaires, aucune image de référence ne l'exerce. - La PMP est appliquée, les autres protections pas encore. Les 16 entrées de la protection mémoire physique du CPU sont contrôlées à chaque fetch, chargement et rangement, selon les règles de l'ESP32-C3 (son TRM, §1.8 : un accès réussit quand une entrée qui le contient l'autorise, sans la priorité statique de la spécification RISC-V), et le mode utilisateur existe. ESP-IDF verrouille au démarrage des entrées sur tout l'espace d'adresses : un firmware qui déréférence un pointeur nul, écrit dans la fenêtre des données de la flash ou exécute depuis la mémoire de données prend la faute d'accès que l'appareil lui donne, et son gestionnaire de panique s'exécute ; les firmwares de référence ne le font jamais. Les registres de permission du bloc
SENSITIVEet le garde-pile d'ASSIST_DEBUGsont mémorisés et ne lèvent jamais de faute (sous-projet 4). - Codes de sortie : 0 quand l'exécution s'est terminée normalement (limite de cycles ou limite en temps de l'appareil atteinte, Ctrl-C, ou lecteur de la sortie standard parti) ; 2 pour une erreur (appareil inconnu, ROM absente ou invalide, image flash ou fichier de flash refusé, sortie standard impossible à écrire, fichier de flash impossible à écrire à la fin de l'exécution) ; 3 pour un arrêt par
--strict-mmio; 4 quand le CPU attend une interruption et qu'aucune ne peut venir ; 5 quand l'exécution aurait fini avec 0 mais que son script de console n'est pas allé au bout ; 130 pour un second Ctrl-C pressé avant le début du résumé (une fois le résumé commencé, Ctrl-C ne termine plus rien).
La console de l'appareil va sur la sortie standard. Tout ce qu'inkemu a à dire va sur l'erreur standard : d'abord ce qui a été fait avant que l'exécution puisse commencer, quand quelque chose l'a été (le téléchargement d'une ROM, la suppression de ce qui occupait le nom temporaire du fichier de flash) ; puis l'appareil, le modèle de temps et la flash utilisée ; au fil de l'exécution, une ligne warning: pour chaque chose qu'il ne sait pas faire fidèlement ou que le firmware a mal faite (lecture ou écriture d'un registre non modélisé, écriture de 8 ou 16 bits dans un registre de périphérique, opération qu'il ne peut pas exécuter fidèlement, accès à de la flash qu'aucune entrée MMU ne projette, lecture par une fenêtre de flash qui peut différer de l'appareil, exception CPU) et une ligne inkemu: pour chaque reset, qui est un événement de l'exécution et non un avertissement ; à la fin, la raison de l'arrêt, l'endroit, le temps d'appareil écoulé et l'horloge du CPU, puis l'état de l'hôte USB et, avec un script de console, jusqu'où il est allé, puis les lignes les plus répétées, l'empreinte de trace si elle est demandée, et la flash : le SHA-256 du contenu de départ, puis ce qu'il est devenu. Avec un fichier de flash : enregistré, avec son SHA-256 et le nombre de secteurs de 4 Kio modifiés ; laissé tel quel, quand l'exécution est partie du fichier et n'a rien modifié ; ou réécrit, quand ce fichier a été supprimé pendant l'exécution. Sans fichier : le nombre de secteurs modifiés et non conservés, et aucune ligne quand rien n'a été modifié. Chaque avertissement et chaque reset distinct n'est listé qu'une fois. --strict-mmio fait du premier avertissement un arrêt avec le code 3, pour la CI ; les exceptions CPU et les resets font exception, parce qu'ils sont ce que le firmware fait sur l'appareil. Les registres mémorisés sans que leur effet soit modélisé sont listés dans docs/registers-accepted-without-effect.md.
Pour construire soi-même les images de référence (il faut Docker ; rien n'est exécuté sur l'hôte), voir tools/reference-firmware/README.md. Les tests (cargo test --workspace) se lancent sous un utilisateur ordinaire, pas sous root : certains ont besoin d'un fichier ou d'un répertoire que leur utilisateur ne peut pas écrire, et échouent sous root avec un message qui le dit. Le premier lancement télécharge la ROM (4,9 Mo) depuis la version 20260528 d'esp-rom-elfs d'Espressif et vérifie son SHA-256 avant de s'en servir ; pour travailler hors ligne, extraire l'archive soi-même et passer --rom-dir <répertoire>, ou remplir un répertoire à l'avance avec inkemu rom fetch --all [--rom-dir <répertoire>]. Autres commandes : inkemu inspect <app.bin> décrit une image d'application ESP-IDF et explique ce qui ne va pas quand il refuse un fichier ; inkemu rvtest <elf> exécute un test de conformité RISC-V sans système, sur un hart à modes machine et utilisateur et à PMP de 16 entrées (tools/conformance/README.md).
Un script de console dit ce que l'hôte envoie à l'appareil, et quand, en temps d'appareil : deux exécutions avec le même script sont la même exécution, jusqu'à l'empreinte de trace. Le format est celui de l'exemple de la partie anglaise, ci-dessus, et s'utilise avec inkemu run … --console-script <fichier>.
- Les étapes, une par ligne, dans l'ordre :
send CANAL "OCTETS"envoie à l'instant de l'étape ;wait 250ms(unitésns,us,ms,s) avance cet instant ;wait-for CANAL "TEXTE"le porte à l'instant d'appareil où le dernier octet deTEXTEa atteint l'hôte, cherché dans ce que le canal a envoyé depuis l'instant de l'étape ;usb-host absent|attached|openchange l'hôte USB à cet instant.CANALvautuart0,uart1ouusb-serial-jtag. Les chaînes acceptent\r,\n,\t,\\,\"et\xHH; tout autre caractère est envoyé en ses octets UTF-8, et rien n'est traduit : Entrée s'écrit\r, comme un terminal l'envoie.#commence un commentaire. La première ligne estinkemu-console-script 1, un commentaire permis après. Le script est en UTF-8 sans marque d'ordre des octets, ses lignes terminées par LF ou CRLF. - Le temps : les attentes qui suivent un
wait-fors'additionnent, et la somme est arrondie une seule fois au cycle supérieur de la base de temps de 160 MHz de l'appareil. Unwait-forne cherche que ce que son canal a envoyé depuis l'instant de son étape : le texte envoyé avant unwaitn'est pas trouvé par lewait-forqui le suit. Les étapes d'un même instant atteignent l'appareil dans leur ordre, sauf qu'une étapeusb-hosts'applique avant unsend usb-serial-jtagdu même instant ; un paquet de l'hôte atteint l'appareil 50 µs après son instant, tant que le port est ouvert. - L'hôte des UART envoie au débit et dans la trame de l'UART. Sur l'USB-Serial-JTAG, il envoie des paquets de 64 octets ; il est
opensauf si--usb-hostdit autre chose :attachedest un câble sans programme qui lit le port (l'appareil voit les trames, sa sortie n'est pas lue),absentl'absence de câble. - Les refus : un script est lu en entier avant le départ, et chaque refus donne sa ligne et sa colonne, puis ce qu'il faut écrire. Les limites sont celles de
crates/console-script/src/parse.rs(1 Mio de script, 10 000 étapes, 1 024 octets par envoi, 256 octets par texte attendu). - La fin : le résumé dit jusqu'où le script est allé. Une exécution qui sortirait avec 0 sort avec 5 quand son script n'est pas allé au bout : il attendait encore un texte, ou l'une de ses étapes est datée après la fin de l'exécution.
inkemu run … --record session.inkrec enregistre l'exécution, puis inkemu replay session.inkrec la rejoue (voir l'exemple de la partie anglaise).
--record FICHIERécrit une session à la fin de l'exécution, quelle qu'en soit la fin : l'identité de la ROM masquée (sa révision et son SHA-256, jamais la ROM), le profil de l'appareil sous forme de texte, la flash entière du départ,--strict-mmio,--max-cycleset--max-time, l'hôte USB à la mise sous tension, chaque entrée que la machine a acceptée sur ses consoles et de l'hôte USB, datée en temps d'appareil, et ce à quoi l'exécution est arrivée : sa fin, le temps d'appareil, les cycles, les instructions, l'empreinte de trace, le SHA-256 de la flash finale et de chaque console. Aucun chemin, aucune heure de l'hôte. Une exécution coupée par Ctrl-C ou par le départ de son lecteur est enregistrée avec l'instant d'appareil où elle s'est arrêtée, ce qui la rend rejouable ; un second Ctrl-C termine le processus sur-le-champ (code 130), et rien n'est enregistré. Une session porte au plus 1 Mio d'entrée et 16 384 morceaux d'entrée (chaquesendd'un script en est un) par console, et 16 384 changements d'hôte USB sur toute l'exécution ; une exécution qui envoie davantage le dit dès que cela arrive, et n'est pas enregistrée (code 2, 3 après un arrêt de--strict-mmio). Le fichier contient la flash entière : il est écrit par un fichier temporaire (.FICHIER.tmp) renommé une fois complet, lisible et modifiable par son seul propriétaire sous Unix.--recordne peut pas désigner un fichier que l'exécution lit ou écrit, même s'il n'existe pas encore : les fichiers donnés à l'exécution, le fichier de flash, son verrou et son fichier temporaire, le fichier de ROM de--rom-dirou le cache des ROM ; et son répertoire doit exister. Tout cela est vérifié avant le départ. Enregistrer active l'empreinte de trace.inkemu replay FICHIERvérifie que la ROM est celle de l'enregistrement (--rom-dircomme pourrun), reconstruit l'appareil depuis la seule session, lui remet les entrées enregistrées, l'exécute jusqu'aux mêmes limites en affichant la console commerun(--consolela choisit), puis compare ce qu'il obtient à ce qui a été enregistré. Il ne lit aucun chemin de l'enregistrement et n'écrit rien de l'exécution, pas même la flash ; sans--rom-dir, la ROM est téléchargée dans le cache à la première utilisation, comme pourrun. Ce que dit la session parvient au terminal avec ses caractères de contrôle échappés. Un rejeu donne le même résultat quel que soit l'hôte et quel que soit son découpage.- Codes de sortie :
0quand tout est identique ;6quand le rejeu diverge, avec la première grandeur qui diffère et ses deux valeurs ;2pour un fichier refusé (autre version, tronqué, longueur au-delà de sa borne, SHA-256 qui ne correspond pas, chaque refus nommant le champ), une ROM absente ou différente, et un rejeu coupé par Ctrl-C ou par son lecteur avant la fin de sa session (rien n'a été comparé) ;130pour un second Ctrl-C avant le résumé du rejeu. Le format est décrit dans l'ADR 0007.
inkemu sd create carte.img --size 1024 crée une carte vierge de 1 Gio (FAT32, étiquette INKEMU) ; --label LIVRES en change l'étiquette. inkemu sd recover carte.img finit une sauvegarde qu'une exécution a laissée inachevée.
Le X4 lit une carte microSD en mode SPI ; CrossPoint la monte avant son premier écran et affiche « SD card error » sans elle. inkemu sd create fait l'image d'une carte vierge : un volume FAT32 vide sur une partition MBR, disposé comme le dispose la spécification du système de fichiers de l'association SD (partition et zone de données alignées sur 4 Mio), ce qui suffit à CrossPoint pour atteindre son écran d'accueil (il crée lui-même son dossier /.crosspoint). La taille est en Mio, de 64 à 2 097 024 : jusqu'à 2 Gio la carte est à capacité standard (SDSC, adresses en octets), au-delà à haute capacité (SDHC/SDXC, adresses en blocs). Sur les systèmes de fichiers Unix, le fichier est creux : il ne prend sur le disque que ce qui est écrit (sur NTFS, il prend toute sa taille dès sa création) ; il est créé par un fichier temporaire mis à son nom une fois complet, lisible et modifiable par son seul propriétaire sous Unix, et ne remplace jamais un fichier existant. Deux créations de même taille et même étiquette donnent les mêmes octets. Codes de sortie : 0 créée, 2 refusée ou non écrite.
La carte elle-même (chips::sdcard) et son fichier image (host::sd_image, verrouillé pendant une exécution et écrit en place par un journal à la fin d'une vie, si bien qu'une interruption laisse l'image d'avant ou celle d'après) sont prêts ; une exécution finit une sauvegarde interrompue en ouvrant l'image, et inkemu sd recover le fait seul. Un journal est lié au fichier de son image : celui d'une image copiée, ou déplacée sur un autre système de fichiers, est refusé jusqu'à ce que inkemu sd recover <image> --accept-journal l'applique, toujours vérifié en entier (le journal d'une autre image écraserait alors des blocs de celle-ci). Un journal qui ne peut pas être appliqué a pu l'être en partie : le message le dit et laisse le choix à l'utilisateur. Codes de sortie de recover : 0 appliquée ou rien à finir, 2 refusée. La carte se met dans le lecteur du X4 (inkemu run --sd-image, --sd-read-only pour une carte protégée en écriture, ou la section « Carte SD » du dialogue de démarrage de la fenêtre, qui sait en créer une vierge) ; une session garde ce que la carte contenait au départ (ses blocs non nuls, 64 Mio au plus) et l'empreinte de ce que la dernière vie y a changé, que le rejeu compare. Voir l'ADR 0014.
app/ est une application de bureau (Tauri 2, React, TypeScript) qui fait ce que font inkemu run et inkemu replay, depuis une fenêtre : choisir le modèle (le X4 par défaut), l'allumer avec une flash effacée, une image de flash entière ou une application derrière le bootloader qu'inkemu livre, garder sa flash dans un fichier de flash, lancer, mettre en pause, avancer d'une instruction, faire un reset, éteindre, en temps réel ou au plus vite ; lire les trois consoles et y taper, ouvrir ou fermer l'hôte USB ; enregistrer une session et en rejouer une, avec son verdict ; capturer l'écran en PNG ; suivre l'état (temps d'appareil, cycles, PC, horloge du CPU, sommeil profond, hôte USB) et le journal de l'exécution. Ses textes sont en français et en anglais, la langue du système d'abord ; elle suit le thème clair ou sombre du système, sauf choix contraire ; tout se commande au clavier, et l'appareil prend les flèches, Entrée, Échap ou Retour arrière et P quand il a le focus.
L'écran du X4 est sa dalle, dessinée par le firmware à travers le SSD1677, dans les gris du modèle optique de la dalle, redressée comme on tient l'appareil ; un rafraîchissement complet clignote avant son image. Dessous, la fenêtre dit « Rendu approché : paramètres optiques non mesurés » tant que les paramètres de la dalle sont ceux du modèle. Les boutons autour appuient sur ceux du firmware, et le bouton d'allumage, maintenu comme sur l'appareil, rallume l'appareil après que le firmware l'a éteint (relâché trop tôt, le firmware s'éteint de nouveau). Le dialogue de démarrage propose un câble USB et une carte SD (aucune, une image existante ou une nouvelle carte vierge). L'écran du X3 est aussi sa dalle, dessinée à travers son contrôleur UC8253 dans le même modèle optique, redressée de même, avec le même avertissement ; ses boutons et son bouton d'allumage l'entourent, et le dialogue de démarrage propose une carte SD mais pas de câble : le X3 n'a aucune ligne qui dise à un firmware qu'un câble est branché. La fenêtre et la commande partagent une bibliothèque hôte, crates/host.
Pour la lancer en développement (Node.js 24 avec corepack, la chaîne Rust du dépôt et, sous Linux, les bibliothèques des prérequis de Tauri : libwebkit2gtk-4.1-dev libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev) : cd app, corepack enable, pnpm install, puis pnpm tauri dev (Vite sur le port 1420, puis la fenêtre) ; pnpm check lance Biome, les types (TypeScript 7) et les tests (Vitest). La ROM est téléchargée dans le cache à la première utilisation, comme pour inkemu run. Fermer la fenêtre, quitter ou un SIGINT/SIGTERM éteint d'abord l'appareil, pour que son fichier de flash et sa session s'écrivent ; ce qui n'a pas pu être gardé est montré avant que la fenêtre se ferme. L'enveloppe est un espace de travail Cargo à part (app/src-tauri) ; aucun paquet n'est encore construit ni signé (sous-projet 9). Voir l'ADR 0011.
Le débogueur. Le bouton Débogueur de la barre ouvre un panneau sous l'appareil : les 32 registres par leurs noms ABI, le PC, le mode du processeur et ses CSR ; le code autour du PC, désassemblé comme l'écrit objdump (ou à une adresse donnée) ; la mémoire (ROM, SRAM, SRAM0, mémoire RTC), 16 octets par ligne avec leur texte. Un clic sur le point d'une ligne de code y pose un point d'arrêt, ou donnez une adresse ; surveillez des octets en lecture, en écriture ou les deux. L'exécution se met en pause à un point et dit lequel, dans le panneau, l'état et le journal ; Lancer repart au-delà, Pas exécute une instruction et dit l'accès surveillé qu'elle a fait. Le panneau relit la machine chaque fois que l'exécution n'avance pas, et sur Rafraîchir pendant qu'elle avance ; après la fin d'une vie, il montre l'état où elle a fini. Rien de ce qu'il fait ne change ce que la machine exécute : une exécution arrêtée mille fois a l'empreinte de trace d'une exécution d'un seul tenant, et un rejeu arrêté à des points donne « identique ». Il lit la mémoire sans les effets d'un chargement : les registres de périphériques ne sont jamais lus (une lecture peut les changer), et le contenu de la flash n'est jamais montré (elle peut contenir des données personnelles) : de la flash, le désassemblage ne lit que les pages de 64 Kio d'où le processeur a chargé une instruction pendant cette vie, en texte décodé seulement (toute autre page est dite non exécutée, car elle peut contenir des données), et un point de surveillance sur une fenêtre de flash est refusé. Les points sont gardés d'un lancement à l'autre. Lecture seule : registres et mémoire ne s'écrivent pas encore. Un serveur GDB pour gdb et VS Code est le sous-projet 4d. Voir l'ADR 0016.
inkemu-lockstep est un outil de développement de l'espace de travail, absent de l'inkemu distribué (voir la commande de la partie anglaise). Il exécute une image flash dans le QEMU d'Espressif et dans inkemu et compare, après chaque instruction, le PC, x1–x31 et les huit CSR machine que les deux ont (mstatus, mie, mip, mtvec, mepc, mcause, mtval, mscratch). QEMU ne tourne que dans l'image épinglée espressif/idf:v5.5.2 (tools/conformance/versions.env), jamais sur l'hôte : il faut Docker et l'image déjà téléchargée (l'outil ne la télécharge pas), l'image flash, une flash entière de la taille du profil, est montée en lecture seule, et lancer QEMU demande un hôte Unix (--trace fonctionne partout).
-
--windowdit ce qui est comparé et sous quelles lignes :hello(flash_hello.bin),nvs(flash_nvs.bin) etnvs-ota(flash_nvs_ota.bin) traversent le reset que demandeesp_restartet finissent au suivant. Les fenêtres, leurs lignes et leurs comptes épinglés sont dans docs/lockstep-differences.md.--firmware FICHIERdonne une image d'application au lieu de--flash: la flash que les deux côtés démarrent est composée commeinkemu run --firmwarela compose, derrière le bootloader livré. -
La fenêtre
crosspointcompare CrossPoint 1.6.5 (crosspoint-1.6.5-x3-x4.bin), qui ne peut pas être distribué : en local seulement, jamais dans la CI, par un test ignoré qui refuse tout autre fichier que celui épinglé (voir la commande de la partie anglaise). Mesure du 2026-10-14 : 31 088 420 instructions comparées, la ROM, le bootloader et le début de l'application, jusqu'à sa lecture du capteur de température, que QEMU n'a pas. -
inkemu tourne sous le modèle de temps
qemu-icount: 8 ns par instruction, aucune latence d'interruption, pour que les timers des deux côtés se déclenchent à la même instruction. Chaque différence admise est une ligne numérotée de docs/lockstep-differences.md, avec sa source et ses paramètres exacts. Une ligne est l'une de ces formes :- un CSR dont des bits valent une paire de valeurs connue ;
- un registre ou un CSR que QEMU garde à son reset là où le reset du CPU de la puce le remet à zéro, tenu jusqu'à son écriture ;
- des bits de registre copiés de QEMU sous un masque, les autres bits comparés, certains après un reset seulement ;
- un compteur que chaque côté lit dans son propre modèle, dont l'écart ne bouge que comme la borne sourcée de la ligne le dit ;
- le temporisateur RTC absent de QEMU, tenu à l'horloge lente au temps de l'appareil ;
- un comportement de QEMU que la machine adopte pour le lockstep seulement.
Tout le reste est une divergence.
-
Chaque exécution imprime ce que chaque ligne a fait : registres, bits pris à QEMU, plus grand mouvement de chaque compteur, ce qu'un réglage a changé. L'exécution échoue si une ligne, un registre d'une ligne ou un bit de son masque n'a jamais servi, ou si une ligne a servi hors de ce qu'elle déclare. Une fenêtre coupée par
--max-instructionsliste seulement ce qu'elle a laissé inutilisé.--expect-usage FICHIERépingle le nombre d'usages de chaque ligne. -
La fenêtre traverse les resets des deux côtés qu'elle déclare, sans rien toucher de la machine : la puce, comme inkemu, ne réinitialise que son CPU à
esp_restart, là où QEMU réinitialise toute sa machine. Elle s'arrête au suivant, à sa propre borne si elle en a une, au premier accès à un registre qu'aucun périphérique de QEMU ne couvre (SPI2, I2C0, une mesure de l'ADC SAR, la radio…) sauf si une ligne nomme ce registre, ou à--max-instructions. Un reset d'un seul côté est une divergence, et une trace qui finit avant la fenêtre est une erreur.--trace FICHIER(ou-) lit une trace-d cpu,nochain,intcapturée au lieu de lancer QEMU. -
Une divergence affiche l'instruction, l'état d'avant et les deux états d'après avec les différences marquées, les 64 instructions précédentes avec chaque valeur prise à QEMU en chemin, et la ligne du tableau la plus proche.
-
Codes de sortie :
0: fenêtre terminée sans divergence, chaque ligne utilisée à chaque registre et chaque bit qu'elle déclare, et dans ces limites, comme les options--expect-*l'annonçaient ;1: divergence, reset d'un seul côté compris ;2: erreur (arguments, fichiers, Docker, QEMU qui s'arrête de lui-même, trace qui n'est pas celle de QEMU, ne contient aucun bloc ou finit trop tôt) ;3: fenêtre terminée autrement qu'annoncé, ou ligne utilisée un autre nombre de fois ;4: inkemu s'est arrêté de lui-même ;5: une ligne, un registre ou un bit jamais utilisé, ou une ligne utilisée hors de ce qu'elle déclare ;130: Ctrl-C (le conteneur est supprimé quoi qu'il arrive).
-
La CI l'exécute, avec les fenêtres
nvsetnvs-ota, dans le jobreference-boot, puis quatre fois encore, chacune avec une faute mise exprès dans inkemu, qui doit diverger : dans un registre du CPU, et dans une lecture du modèle du SYSTIMER, chacune avant le reset et après. Voir l'ADR 0008.
Les simulateurs existants pour petits appareils e-ink recompilent les sources du firmware contre un faux pilote d'écran : cela ne marche qu'avec les sources, et cache les bogues du vrai chemin matériel. inkemu fait l'inverse : il émule le SoC, le bus et chaque puce de la carte, puis démarre le binaire du fabricant par sa vraie chaîne de démarrage.
Ce qui est visé, pas ce qui existe déjà (voir « État » et la feuille de route) : n'importe quel binaire de firmware, sans sources ni symboles ; la fidélité au matériel (carte mémoire et taille de RAM exactes, modèle de temps au cycle, watchdogs, sommeil profond) ; un rendu e-ink réaliste, contrôleur émulé commande par commande et état optique par pixel (flash de rafraîchissement complet, ghosting, niveaux de gris, durées de rafraîchissement) ; des appareils décrits par des données, un profil TOML par appareil ; le déterminisme, toute session pouvant être enregistrée et rejouée bit pour bit, trafic réseau compris ; l'outillage (console série, serveur GDB, moniteur de ressources, CLI sans écran avec scripts d'entrée et régression visuelle pour la CI) ; la connectivité (Wi-Fi émulé avec accès Internet réel, BLE) ; partout, un seul cœur Rust compilé pour Linux, macOS et Windows et en WebAssembly pour le navigateur, interface en anglais et en français.
Espressif ESP32-C3 (RISC-V RV32IMC) : Xteink X4 et X3. Espressif ESP32-S3 (Xtensa LX7, deux cœurs) : Xteink X4 Pro et X4C. Les appareils Xteink sont les premières cibles ; l'architecture ne leur est pas liée, d'autres appareils et d'autres SoC suivront.
- Cœur RV32IMC, ESP32-C3 minimal, chargeur de firmware, CLI : démarrer un firmware jusqu'à ses journaux de console. 1a fait ; 1b-1, squelette du SoC et démarrage de la ROM, fait ; 1b-2, flash et bootloader, fait ; 1b-3a, interruptions, timers, watchdogs et reset, fait ; 1b-3b, écritures en flash et fichier de flash de l'appareil, fait ; 1b-3c, firmware fourni seul (
--firmware), fait ; 1b-3d, consoles série dans les deux sens, fait ; 1b-3e, démarrage de deux firmwares réels du X4, fait ; 1b-3f, sommeil profond et réveil par le timer RTC, fait ; 1b-4a, documentation sans avertissement, fait ; 1b-4b, enregistrement et rejeu d'une exécution, fait ; 1b-4c, lockstep avec QEMU sur la première vie de l'image de référence, fait ; 1b-4d, lockstep à travers un reset, sur deux autres firmwares de référence et sur CrossPoint en local, fait ; 1b-4e, CoreMark à moins de 15 % du score publié, fait ; 1b-4f, PMP appliquée et mode utilisateur, avec le groupepmp32d'arch-test, fait. - Périphériques du X4, interface de bureau, rendu e-ink : premier jalon visuel. 2a, les puces autour du SoC (le contrôleur d'écran SSD1677 avec un modèle optique de la dalle, les échelles de boutons et la batterie lues par l'ADC), en bibliothèque, fait ; 2b, les périphériques du SoC (matrice GPIO et IO MUX, GP-SPI2, I2C0, le SAR ADC) et les traits de signaux où se branchent les puces, fait ; 2c, l'application de bureau et la bibliothèque hôte qu'elle partage avec la commande, fait ; 2e, la carte SD en mode SPI, son stockage par blocs et le fichier image de l'hôte, avec
inkemu sd create, fait ; 2d, le câblage du X4 (son écran, ses boutons, son verrou et son bouton d'allumage, sa batterie, son câble et sa carte SD sur les broches de son profil, les entrées de la carte dans les sessions, le réveil du sommeil profond par une broche), fait. - Prise en charge du X3 (dalle UC8253, capteurs I2C). Fait : I2C0 atteint les puces par la matrice GPIO, les contrôleurs UC8253 et UC8279d, la BQ27220, la DS3231 et le QMI8658, le X3 câblé par son profil et montré dans l'application de bureau ; CrossPoint 1.6.5 y atteint son écran d'accueil.
- Débogage, moniteur de ressources, exécution de tests sans écran. 4a, le débogueur dans l'application (registres, CSR, désassemblage, mémoire lue sans effet, points d'arrêt et de surveillance qui ne changent rien à l'exécution), fait ; ensuite 4b le moniteur de ressources, 4c l'appareil vivant et la vue technique de la dalle, 4d les symboles ELF et un serveur GDB, 4e les scénarios sans écran et la régression visuelle, 4f le matériel de débogage de la puce.
- Wi-Fi (accès Internet réel) et BLE
- Version WebAssembly et interface web
- Cœur Xtensa LX7 et ESP32-S3 : X4 Pro (tactile, PSRAM, SDMMC) et X4C
- Banc de calibration du temps
- Paquets de version signés
La spécification, les ADR 0002 (modèle de la flash et fenêtres de cache) 0003 (contexte des périphériques, temps de l'appareil et resets) 0004 (entrées d'une exécution et fichier de flash), 0005 (bootloader embarqué), 0006 (entrées des consoles et hôte USB), 0007 (format des sessions), 0008 (lockstep et différences admises, avec le tableau), 0009 (le temps de référence : CoreMark dans ±15 % du score publié), 0010 (le mode utilisateur, la PMP et le banc de conformité), 0011 (la crate hôte, l'émulateur sur un fil, les ports de l'écran et des boutons), 0012 (les signaux entre le SoC et les puces d'une carte), 0013 (le câblage d'un appareil dans son profil, les entrées de la carte, son alimentation et le geste d'allumage, le réveil par une broche, les sessions au format 2), 0014 (la carte SD en mode SPI, son stockage par blocs, le fichier image de l'hôte écrit en place par un journal), 0015 (le bus I2C vers les puces par la matrice GPIO, une condition à la fois, l'UC8253 et le X3 câblé par son profil) et 0016 (le débogueur : des arrêts qui ne changent rien, une lecture sans effet, la flash jamais montrée) sont en français ; la recherche sur le débogage (protocole GDB, désassemblage, matériel de débogage de l'ESP32-C3, tâches FreeRTOS, scénarios sans écran) est en anglais ; la recherche sur le matériel Xteink, la recherche sur les puces externes (commandes du SSD1677, séquences du firmware du X4, modèle optique, échelles de boutons, batterie), la recherche sur le X3 (firmware et puces) et la table des registres acceptés sans effet sont en anglais.
La ROM masquée de l'ESP32-C3 est le code d'Espressif et n'est pas libre : inkemu ne la distribue jamais, il télécharge les fichiers ELF qu'Espressif publie sous Apache-2.0 dans esp-rom-elfs et les vérifie contre des empreintes épinglées. Le firmware de référence (bootloader ESP-IDF, Apache-2.0, quatre exemples ESP-IDF non modifiés, hello_world, nvs_rw_value_cxx, uart_select et usb_serial_jtag_echo, dans le domaine public, et six petites applications de ce dépôt sous Apache-2.0, usb_serial_jtag_console, adc_wait_panic, deep_sleep_timer, soc_signals, x4_panel_buttons et x3_panel_sensors, et l'exemple CoreMark d'Espressif, dont les sources sont copiées sans modification dans tools/reference-firmware/coremark_example/ : sources EEMBC sous Apache-2.0 avec l'accord d'usage de la marque CoreMark, couche de portage d'Espressif sous Apache-2.0, exemple sous CC0-1.0) est construit dans Docker et vérifié de même. CoreMark est une marque d'EEMBC ; le score qu'imprime ce firmware sous inkemu est celui d'une puce émulée, pas le résultat d'un appareil. Le seul binaire de firmware tiers du dépôt est le bootloader qu'inkemu embarque, third_party/esp-idf-bootloader/ (ESP-IDF v5.5.2, Apache-2.0, avec deux avis BSD-3-Clause, sa licence et sa provenance) : la CI vérifie qu'il est celui de la construction de référence, et son avis dit la seule modification qu'inkemu lui apporte (pour une flash qui ne fait pas 16 Mio, la taille de flash de son en-tête et son empreinte ajoutée) ; aucun autre binaire de firmware n'est stocké. third_party/espressif-svd/ contient une copie non modifiée du esp32c3.svd d'Espressif (Apache-2.0), dont crates/svd-regs est généré. Les tests de crates/chips envoient la LUT de gris d'usine du X4, 110 octets copiés du SDK FreeInk (lut_factory_quality ; MIT, Copyright (c) 2026 FreeInk, elle-même dérivée de l'OpenX4 E-Paper Community SDK, MIT, Copyright (c) 2025 Open X4 E-Paper Contributors) : third_party/freeink-sdk/ contient la licence et l'avis de FreeInk, non modifiés, avec la provenance de la table ; seul du code de test la contient, et le binaire d'inkemu ne contient rien de FreeInk (voir docs/research/sp2a-external-chips.md §9). Voir les ADR 0001 et 0005 ; inkemu licenses imprime les avis. inkemu est sous licence Apache 2.0. Xteink est une marque de son propriétaire ; ce projet n'est affilié ni à Xteink ni à Espressif.
- Mask ROM. The ESP32-C3 ROM is Espressif's code and is not open source. inkemu never ships it: it downloads the ROM ELF files that Espressif publishes under Apache-2.0 in
esp-rom-elfsand verifies them against pinned hashes. - Reference firmware. The tests boot the stock ESP-IDF bootloader (Apache-2.0), four unmodified ESP-IDF examples,
hello_world,nvs_rw_value_cxx,uart_selectandusb_serial_jtag_echo(public domain,Unlicense OR CC0-1.0), six small applications of this repository,usb_serial_jtag_console,adc_wait_panic,deep_sleep_timer,soc_signals,x4_panel_buttonsandx3_panel_sensors(Apache-2.0, each in its directory oftools/reference-firmware/), and Espressif's CoreMark example, whose sources are copied unmodified intotools/reference-firmware/coremark_example/(the EEMBC sources under Apache-2.0 with the CoreMark Acceptable Use Agreement on the trademark, Espressif's port under Apache-2.0, the example under CC0-1.0; see itsPROVENANCE.md). They are built in Docker bytools/reference-firmware/build.shand checked against pinned hashes; no firmware binary is stored in this repository but the one below. CoreMark is a trademark of EEMBC; the score this firmware prints under inkemu is that of an emulated chip, not a result of a device. - The bootloader inkemu ships.
third_party/esp-idf-bootloader/holds the ESP-IDF v5.5.2 2nd-stage bootloader of the reference build (Apache-2.0, with two BSD-3-Clause notices), with its licence, its notice and its provenance; it is embedded in the binary, and the CI checks that it is the one the reference build produces. Its notice also states the one change inkemu makes to it: for a flash other than 16 MiB, the flash size in its header and its appended digest.inkemu licensesprints the notices. - Register descriptions.
third_party/espressif-svd/holds an unmodified copy of Espressif'sesp32c3.svd(Apache-2.0), from whichcrates/svd-regsis generated. - A LUT of the X4, in tests. The tests of
crates/chipssend the X4's factory grey LUT, 110 bytes copied from the FreeInk SDK (lut_factory_quality; MIT, Copyright (c) 2026 FreeInk, itself derived from the OpenX4 E-Paper Community SDK, MIT, Copyright (c) 2025 Open X4 E-Paper Contributors).third_party/freeink-sdk/holds FreeInk's licence and notice, unmodified, with the provenance of the table. Only test code holds it; the inkemu binary contains nothing from FreeInk (seedocs/research/sp2a-external-chips.md§9).
Xteink is a trademark of its respective owner. This project is not affiliated with Xteink or Espressif.