Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.

Upstream: https://github.com/ARMmbed/DAPLink

Committer:
Pawel Zarembski
Date:
Tue Apr 07 12:55:42 2020 +0200
Revision:
0:01f31e923fe2
hani: DAPLink with reset workaround

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pawel Zarembski 0:01f31e923fe2 1 # Bootloader updates
Pawel Zarembski 0:01f31e923fe2 2
Pawel Zarembski 0:01f31e923fe2 3 DAPLink has the ability to bundle the bootloader firmware with the interface firmware and apply a bootloader update on the first boot of the interface. This allows bootloader updates to occur at the same time as interface updates and without any special instructions for the user.
Pawel Zarembski 0:01f31e923fe2 4
Pawel Zarembski 0:01f31e923fe2 5 ## Enabling bootloader updates
Pawel Zarembski 0:01f31e923fe2 6
Pawel Zarembski 0:01f31e923fe2 7 To enable bootloader updates for a board or interface circuit, you must define the value ```DAPLINK_BOOTLOADER_UPDATE```. Once you define it, you can use the normal release process, which the [developers guide](DEVELOPERS-GUIDE.md) documents, to create firmware for all targets.
Pawel Zarembski 0:01f31e923fe2 8
Pawel Zarembski 0:01f31e923fe2 9 ## Safety when updating the bootloader
Pawel Zarembski 0:01f31e923fe2 10
Pawel Zarembski 0:01f31e923fe2 11 The interface firmware erases and updates the vector table when updating the bootloader. Because of this, there is a small window of time during which the device will be in a nonbootable state if the device loses power. The cause of this is the lack of a valid vector table. To minimize the time without a valid vector table and to reduce risk, interface firmware replaces the bootloader's vector table with its own before performing the update. This way, while the bulk of the bootloader is being loaded, there is a valid vector table, and a loss of power event does not prevent the device from booting. The update process is below. The critical sections during which the device cannot lose power are in bold:
Pawel Zarembski 0:01f31e923fe2 12
Pawel Zarembski 0:01f31e923fe2 13 1. **Erase the boot vector table, and program the intenterface's vector table to this location**.
Pawel Zarembski 0:01f31e923fe2 14 1. Erase and program each sector of the bootloader with the new firmware.
Pawel Zarembski 0:01f31e923fe2 15 1. **Erase the boot vector table, and program the new bootloader's vector table to this location**.
Pawel Zarembski 0:01f31e923fe2 16
Pawel Zarembski 0:01f31e923fe2 17 Other checks
Pawel Zarembski 0:01f31e923fe2 18 * The interface firmware will not downgrade the bootloader. If the current bootloader has a valid signature and a version greater than the interface's copy of the bootloader then the interface will not replace the bootloader.
Pawel Zarembski 0:01f31e923fe2 19 * The interface firmware does a checksum over itself to check for any corruption. If it finds itself to be corrupt, it will not apply the bootloader update. In addition, an assert will appear on the on mass storage.
Pawel Zarembski 0:01f31e923fe2 20 * Before attempting to update the bootloader the interface firmware compares its internal copy of the bootloader to the curent bootloader. If they are the same then it does not apply an update.
Pawel Zarembski 0:01f31e923fe2 21
Pawel Zarembski 0:01f31e923fe2 22 ## Dangers
Pawel Zarembski 0:01f31e923fe2 23
Pawel Zarembski 0:01f31e923fe2 24 * The DAPLink bootloader has a fixed location for where the interface firmware is loaded (typically an offset of 0x8000 from the start of ROM). If you update to a bootloader that has a different offset then you will no longer be able to use the same interface firmware. Instead, you must use interface firmware built for the new offset.
Pawel Zarembski 0:01f31e923fe2 25
Pawel Zarembski 0:01f31e923fe2 26 * This mechanism does not support downgrading or loading third party bootloaders. To do this, you must use a debugger or create a custom build of DAPLink.
Pawel Zarembski 0:01f31e923fe2 27 * The LPC11U35 does not have a bootloader, so you cannot use bootloader updates on this interface.