The two packbeam partitions an update alternates between.
An update never writes over the running application. It writes the whole archive into the slot that is not running, points AtomVM's boot path at it, and reboots — so a download that fails, a power cut halfway through, or an archive that turns out to be corrupt all leave the device booting the firmware it already had.
esp32init falls back to /dev/partition/by-name/main.avm when NVS holds no
boot path, so a device flashed at the factory boots from main.avm with
nothing provisioned. Naming the pair a/b would mean every device needed
an NVS write before it would boot at all.
nh_flash for how
the running slot is read back.
| all/0 | Both slots, in no meaningful order. |
| boot_path/1 | The NVS boot path that makes AtomVM boot a slot. |
| default/0 | The slot a device boots when nothing has told it otherwise. |
| from_boot_path/1 | The slot a stored boot path refers to. |
| is_slot/1 | Whether a partition label is one of the pair. |
| other/1 | The slot an update should be written into, given the running one. |
all() -> [binary()]
Both slots, in no meaningful order.
boot_path(Slot::binary()) -> binary()
The NVS boot path that makes AtomVM boot a slot.
default() -> binary()
The slot a device boots when nothing has told it otherwise.
from_boot_path(Path::binary() | string()) -> {ok, binary()} | {error, {unknown_slot, binary()}}
The slot a stored boot path refers to.
Accepts a bare label as well as a full path, because a device that has never been updated has no stored path at all and falls back todefault/0.
is_slot(Label::binary()) -> boolean()
Whether a partition label is one of the pair.
other(Label::binary()) -> {ok, binary()} | {error, {unknown_slot, binary()}}
The slot an update should be written into, given the running one.
An error rather than a guess when the running slot is not one of the pair: a device booting something else is one this scheme does not describe, and writing to whichever slot happened to be free could overwrite what it is running.Generated by EDoc