Skip to content

Update

The Update module provides a way to apply firmware updates to flash memory partitions.

import update from "embedded:update";

Instantiates an Update instance for a specific flash partition.

update.open({ partition, mode, byteLength })

options

partition - A Flash Partition instance to be updated.

mode - A string indicating the mode. Values are "a" (append) and "w" (random access). Defaults to "a".

byteLength - The total size of the update in bytes.

Writes update data. If mode is "a", data is appended. If mode is "w", data is written at the specified offset.

Indicates that the update has been completely applied and should be activated. This typically requires a device restart.

Releases any resources. If complete() has not been called, the update is aborted.

import update from "embedded:update";
import flash from "embedded:storage/flash";
const partition = flash.open({ path: "ota-partition" });
const updater = update.open({ partition });
updater.write(new Uint8Array([/* update data */]));
updater.complete();
updater.close();

Update