flashr-update - Update Flashr firmware

Added in version agentOS: v2.0.2

flashr-update programs a flashOS firmware image to a Flashr PER-401 attached to the Test Agent. It is a wrapper around mcumgr, which transfers the image over the Flashr’s firmware update serial port.

Usage

flashr-update

The command takes no arguments. It looks for the firmware image by name, in this order, and uploads the first match:

  1. /var/lib/pltagent/per401-fw-*

  2. /run/pltagent/mnt/per401-fw-*

The second location is the RAMDISK, so an image sent with agentCfg - Configure Agent is found without further setup.

Firmware image

Send the signed application image of the flashOS release, named per401-fw-v<version>-slot0.signed.bin.

Warning

Any file whose name starts with per401-fw- matches, and only the first match is used. Send exactly one such file.

Flashr serial port

agentOS creates the device link /dev/flashr-<serial>-serial for the serial port of an attached Flashr, where <serial> is the Flashr’s USB serial number. flashr-update uses this link. The software expects a single Flashr to be attached to the Test Agent.

Activating the update

flashr-update only programs the image into the Flashr’s alternate firmware slot. The Flashr keeps running its current firmware until the uploaded image is marked for use and the Flashr is restarted:

$ CONN="dev=$(echo /dev/flashr*-serial),baud=115200"
$ mcumgr --conntype serial --connstring "$CONN" image list
$ mcumgr --conntype serial --connstring "$CONN" image test <hash>
$ mcumgr --conntype serial --connstring "$CONN" reset

image list reports the hash of the image in slot 1.

After the restart, the bootloader verifies the image signature and starts the new firmware. If the new firmware does not confirm itself, the Flashr reverts to the previous firmware on the next restart.

Exit status

Status

Meaning

0

The image was uploaded.

1

No firmware image was found.

other

Exit status of mcumgr, non-zero when the Flashr cannot be reached or the upload fails.

Test plan example

title: "Update Flashr firmware"
suite:

 - title: "Setup Test Agent"
   steps:
    - command: agentCfg AGENT
      with:
       - per401-fw-v0.6.0-slot0.signed.bin

 - title: "Upload Flashr firmware"
   steps:
    - command: agentExec AGENT "flashr-update"
      timeout: 2m