DAPLink bootloader update


Arm Mbed DAPLink is an open-source software project that enables programming and debugging application software running on Arm Cortex CPUs . Commonly referred to as interface firmware, DAPLink runs on a secondary MCU that is attached to the SWD or JTAG port of the application MCU. This configuration is found on nearly all development boards. It creates a bridge between your development computer and the CPU debug access port. DAPLink enables developers with drag-and-drop programming, a serial port and CMSIS-DAP based debugging.

Over the years, DAPLink has been widely adopted and embedded into microcontroller development boards. We've been making many improvements to DAPLink from the kernel to the USB stack and the implementation of a virtual filesystem. This includes robust protections in the bootloader to prevent the MCU from getting corrupted by unexpected SCSI command sequences in mass storage class data transfers. We've now made it possible to get these updates on all development boards that run DAPLink interface firmware or have a DAPLink compatible MCU circuit.

DAPLink updates and Windows

While investigating issues reported on the forums about Windows 10 bricking Mbed Enabled boards when updating the interface firmware, the DAPLink team discovered that boards with older bootloader versions (older than the DAPLink project itself) had a vulnerability to corruption. The symptom has been described as "bricking," or not mounting as a mass storage drive when connected to the computer over USB. The problem can manifest itself in two different ways. In both cases the boards appear unresponsive.

  1. In one case the older bootloader programs the wrong data to the interface application region of ROM, corrupting it. This causes the debug interface application to crash on boot. We'll call this a corrupted state. You can recover the board by updating the debug interface firmware again.
  2. In the second case, the older bootloader programs data to the bootloader region of ROM, not the application region. This causes the bootloader to crash on boot. We'll call this a bricked state. You can only recover the board by flashing a new bootloader with an external debug probe.

While this could happen on any operating system, it has only been verified to happen on Windows 8 and Windows 10 when storage services are running. If your device is in a corrupted state or bricked state, this guide will help you safely update your boards. We'd recommend that all development boards are updated to take advantage of the improvements and fixes in the DAPLink bootloader.

That said, we have narrowed down specific versions that are susceptible to a corrupted state or bricked state. Specifically DAPLink bootloader version 1000.

How to update your boards

The flowchart will let you determine if your board is in a corrupted state or a bricked state. For boards in a corrupt state or boards that you just want to update with the latest version of the DAPLink bootloader, files and steps are provided in this blog If you've determined that your board is in an bricked state we've published a second blog with instructions on how to recover the bootloader. It's important to use the update procedure and corresponding files and not to mix them.

Flowchart used to determine necessary update steps.

Updating the DAPLink bootloader

DAPLink bootloader update images are available for download from the table below. These are built with the same application offset address that the boards originally shipped with (20k or 32k), so the existing DAPLink interface firmware or third party interface firmware will be compatible. There may be more compatible boards than currently listed . Ask a question or start a discussion at the end of this blog post if you have a board not listed and wish to update the bootloader.

Step 1. Download updated DAPLink bootloader image

To download the bootloader image for a specific board, click on the corresponding link in the table below.

BoardDAPLink bootloader image
FRDM-K64F
FRDM-KL82Z
RedBearLab-nRF51822 v1.0
RedBearLab-BLE-Nano v1.0
0244_k20dx_bootloader_update_0x5000.bin
FRDM-K22F
FRDM-K28F
FRDM-K82F
FRDM-KW24D
FRDM-KL28Z
TWR-KL28Z
FRDM-KE15Z
TWR-KE18F
HVP-KE18F
MTS-xDot-L151CC
0244_k20dx_bootloader_update_0x8000.bin
Nordic-nRF51-DK
Nordic-nRF52-DK
Nordic-nRF51-Dongle
Nordic-nRF51822
0244_sam3u2c_bootloader_update_0x5000.bin
Step 2. Disable storage services

On Windows 8 and Windows 10 computers only, you need to disable storage services to prevent the condition that can cause out of order data transfers. Press and hold the Windows Logo Key, and then press R. This opens the Windows Run prompt. Once the Run prompt opens, type in services.msc, and click the OK button.

Open up the services application.

Once the Services application opens, double click the item from the list named Storage Service.

Look for the setting named Storage Service.

Storage Service Properties is now open. Click the button named Stop.

Storage Service settings with the Stop button highlighted.

Step 3: Update the bootloader

While holding the board's reset button, connect it to your computer using the board's debug USB port. The device mounts in its bootloader mode. The drive name or mount point may vary, so replace BOOTLOADER as appropriate.

  • Windows - Open this device's root directory, and then drag and drop the bootloader image downloaded during step 1 into this directory.
  • Mac OSX - sudo mount -u -w -o sync /Volumes/BOOTLOADER ; cp -X <path to interface firmware file> /Volumes/BOOTLOADER/
  • Linux - cp <path to interface firmware file> <BOOTLOADER> && sync

When the file copy operation completes, unplug and replug the board into your computer normally (without holding down the reset button). Your device now has the updated bootloader installed and mounts a drive named MAINTENANCE.

Step 4: Re-enable storage services

If you performed the update on a Windows 8 or Windows 10 computer, turn storage services back on by following the same steps listed in step 2, but this time, click the button name Start instead of Stop.

Step 5: Install an interface firmware application

You can now install any interface firmware version but we suggest getting the latest DAPLink interface firmware. Just enter the board name in the interface firmware update section to get the latest. Then, with the device mounted as MAINTENANCE, open the device's root directory then drag-and-drop the firmware update into this directory. When the file copy operation completes the board will unmount and remount as DAPLINK or the name of the board and the update is complete.


Conclusions

Your boards should now be updated and in good working order. To check the version of the DAPLink bootloader or interface firmware look in the DETAILS.TXT when the device is mounted as MAINTENANCE or DAPLINK