Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Errors and warnings

Every failure of the library has a kind and a class. The command prints the message, with its hint when it has one, and --json gives the kind and the fields. The browser package throws a NanoflashError with the same kind, its errorClass, the message and the fields in details. Every message names the partitions and the addresses involved, in 0x hexadecimal.

Classes

The class tells who can fix the error. It also gives the exit code of the command.

ClassWho actsExit code
inputFix the options, the manifest, the layout or the images.1
deviceCheck the device, its connection or its bootloader.2
verificationThe flash does not hold what was written.3

Error kinds

Input

KindMeaning
unsupported-resetThe reset sequence does not apply to the protocol.
out-of-rangeA value does not fit what the protocol can carry.
manifestThe manifest could not be read.
layoutThe layout of a board has errors.
layout-fileThe layout file of a board could not be read or parsed.
tableThe partition table cannot be written for the layout.
image-sourceAn image file could not be read.
checksum-mismatchAn image does not have the SHA-256 digest that the manifest gives.
image-rejectedThe verifier of the caller refused an image.
intel-hexAn Intel HEX image is invalid.
misplaced-intel-hexA valid Intel HEX image does not start where it is written. Its addresses are those of the memory map: the base address of the flash plus the offset that it is written at.
elf-not-enabledAn image is an ELF file, and this build of nanoflash does not read ELF files (the elf feature).
elfAn ELF image cannot be flashed.
misplaced-elfA valid ELF image does not start where it is written.
application-imageThe image source could not build the Espressif application image of an ELF file.
elf-not-an-applicationAn ELF image is written where the Espressif bootloader does not boot an application from: a partition that is not a firmware or update partition, or an offset that starts no partition of the layout.
misaligned-application-imageThe Espressif application image of an ELF file is written at an offset that is not a multiple of 0x10000, or below 0x10000.
image-needs-layoutAn image goes to a partition and the board has no layout.
unknown-partitionAn image or an erase entry names a partition that the layout does not define.
misaligned-imageAn image starts at an offset that the flash cannot erase from.
overlapping-imagesTwo images share flash sectors.
image-too-largeAn image does not fit in its partition.
partition-table-image-for-detected-flashAn image replaces the partition table of a layout whose partitions grow or move with the flash of the chip. The table that nanoflash generates for the chip would be lost.
fixed-offset-on-moving-partitionAn input tied to flash offsets (an image or an erase entry given by offset, an Intel HEX image, an ELF image decoded into flat segments) overlaps a partition that moves with the flash of the chip.
image-outside-flashAn image ends after the end of the flash.
misaligned-eraseAn erase entry does not start and end on the erase unit of the flash.
erase-outside-flashAn erase entry ends after the end of the flash of the layout.
outside-address-rangeAn image or an erase entry ends beyond what the protocol can address.
outside-detected-flashAn image or an erase entry ends after the end of the flash that the chip reports.
nothing-to-flashThe board of the manifest lists no image and no erase entry.
empty-imageAn image file has no byte.
out-of-memoryThere is not enough memory for a buffer.
unknown-boardThe requested board is not in the manifest.
no-matching-boardNo board of the manifest suits the device.
several-protocolsThe candidate boards speak several protocols. Give the board identifier.
several-boardsSeveral boards have the detected chip.
board-requiredThe manifest has several boards and none was chosen.
protocol-requiredThe protocol of the device cannot be told from its USB identity and none was given.
protocol-not-enabledThe protocol was not compiled in.
unknown-flash-sizeThe size of the flash is needed, and neither the layout nor the chip gave it.
flash-size-needs-detect-layoutA flash size was given for a board whose layout does not have size = "detect".
flash-too-smallThe flash of the chip is smaller than the layout.
unknown-bootloader-deviceThe USB identity that the bootloader of a device shows is unknown, so the device cannot be opened again after the reset.
below-writable-flashAn image or an erase entry starts in the flash that the bootloader protects.
above-writable-flashAn image or an erase entry ends in the flash that the bootloader occupies at the top of the flash.
erase-short-of-flash-endAn erase region stops before the end of flash, and the bootloader only erases from an offset to the end of flash (SAMD21).
image-below-writtenAn image comes after an image written above it, and the bootloader erases from the start of an image to the end of flash before it writes it (SAMD21).
page-out-of-erase-orderA page would be programmed where the bootloader does not erase it first. The wiring bootloader of the Mega 2560 erases one page per page programmed, in order from 0x0, wherever the programmed page goes.
not-connectedA backend was asked to erase, write, verify or reset before a successful connect.

Device

KindMeaning
transportThe serial port failed.
no-responseThe board did not answer a command.
no-syncThe board answered no SYNC after any reset.
not-in-download-modeThe boot log shows that the chip started in another mode than download mode.
romThe ROM loader refused a command.
invalid-responseThe board answered a command with something that cannot be its answer.
unknown-chipThe chip could not be identified.
unsupported-chipThe chip was identified, and nanoflash does not support it.
wrong-chipThe chip found is not the one of the selected board.
no-bootloaderNo bootloader answered: none appeared after the reset, or the port is not one.
unsupported-bootloaderThe bootloader lacks the commands that nanoflash needs.

Verification

KindMeaning
verification-failedThe flash does not hold what was written (MD5 or CRC-16).
read-back-differsThe flash read back differs from what was written (AVR).

Transport errors

A transport error (class device) carries the error of the serial port in its error field:

KindMeaning
ioThe operating system or the browser reported an error.
disconnectedThe device went away.
not-foundNo device matches the filter.
not-grantedThe browser has no permission for a device that matches the filter.
replayA replayed transcript diverged from what the host did (tests only).

The browser package gives a transport error the kind of the transport error inside it, such as not-granted or disconnected.

Browser package only

KindClassMeaning
no-port-choseninputThe user closed the port chooser.
port-request-refusedinputThe browser did not show the port chooser. A page in an iframe needs allow="serial", and a permissions policy may block Web Serial.
module-brokendeviceA WebAssembly module trapped. Every later call that needs the module fails with the same error. Reload the page.
invalid-argumentinputAn argument of a layout function does not parse, such as a flashSize text.
internaldeviceThe module threw something that is not an error of the library.

Warnings

A warning does not stop the flash. The report lists the warnings of the image preparation, then the warnings of a detect layout, then erases-to-end, then not-verified-in-secure-download-mode.

KindMeaning
partition-table-differsAn image of the manifest replaces the partition table that nanoflash generates from the layout, and differs from it.
partition-table-not-checkedAn image of the manifest replaces the partition table, and the table could not be generated from the layout to compare with.
not-verified-in-secure-download-modeThe chip is in secure download mode, whose ROM loader refuses SPI_FLASH_MD5: what was written was not read back.
erases-to-endThe bootloader (SAMD21) erased from the lowest image, from, to the end of flash, to. partitions are those of the layout in that range that no image is written to.
partitions-grewThe chip has more flash than the minimum of a detect layout, and the partitions that grow with the flash are larger than on the minimum. On Espressif, the bootloader image must be built for this flash size or with flash size detection.
partitions-movedThe chip has more flash than the minimum of a detect layout, and the partitions that move with the flash start elsewhere than on the minimum.
flash-size-not-detectedThe chip did not report its flash size: a detect layout stays resolved for its minimum.
elf-segments-not-writtenAn ELF image has loadable segments that are not part of the program memory of the chip (on AVR, the data, EEPROM, fuse and lock spaces from 0x800000). They are not written.

layout check also warns when a manifest image of the partition table differs from the generated table.