Blue Clover Flashr PER-401

The Flashr (PER-401) is Blue Clover’s USB programming device. It runs flashOS. Flashr presents itself as a CMSIS-DAP probe, so it is driven with standard CMSIS-DAP tooling to program and debug a target over SWD.

Program a target from a Test Agent

In a test station, attach the Flashr to a Test Agent and program the target with the flashr-flash command included in agentOS:

- command: agentExec AGENT "flashr-flash nrf52 /run/pltagent/mnt/firmware.hex"
  timeout: 2m

See flashr-flash - Program a target through Flashr for the arguments, exit status, and a complete test plan.

Use the Flashr directly

flashr-flash is a wrapper around OpenOCD. The Flashr can also be driven directly, from a Test Agent or from a development computer, with any debug host that supports CMSIS-DAP. This is how to reach what flashr-flash does not offer, such as a different adapter speed or a debugger connection.

The examples below use rp2350 as the target; substitute the name of your target.

OpenOCD

Note

OpenOCD needs a valid configuration file for the target. Some targets are not shipped with OpenOCD 0.12 by default, such as the RP2350. For RP2350 targets use a more recent build or the Raspberry Pi fork.

Check the connection to the target. A successful connect reads the target’s DPIDR and examines its cores:

$ openocd -f interface/cmsis-dap.cfg -c "transport select swd" \
          -c "adapter speed 4000" -f target/rp2350.cfg -c "init" -c "exit"

Program an image with the program command, which erases, writes, verifies, and resets. For .elf and .hex files the load addresses are contained within the file and do not need to be specified:

$ openocd -f interface/cmsis-dap.cfg -c "transport select swd" \
          -c "adapter speed 4000" -f target/rp2350.cfg \
          -c "program firmware.elf verify reset exit"

A raw .bin file needs the load address, for example the RP2350 flash base:

$ openocd -f interface/cmsis-dap.cfg -c "transport select swd" \
          -c "adapter speed 4000" -f target/rp2350.cfg \
          -c "program firmware.bin 0x10000000 verify reset exit"

pyOCD

pyOCD has built-in RP2350 support and needs no target configuration files. It is not included in agentOS at this time, but can be used from a development machine. An attached Flashr device is listed as flashOS CMSIS-DAP:

$ pip3 install pyocd
$ pyocd list

Program an .elf, .hex, or .bin image:

$ pyocd flash -t rp2350 firmware.elf

Update the Flashr firmware

A Flashr attached to a Test Agent is updated with the flashr-update command included in agentOS.

- command: agentCfg AGENT
  with:
   - per401-fw-v0.6.0-slot0.signed.bin
- command: agentExec AGENT "flashr-update"
  timeout: 2m

See flashr-update - Update Flashr firmware for details, including how the uploaded image is activated.