From 35aef360cf850e71ffb65ac40cd49c9846f4fe73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Thu, 18 Apr 2024 03:14:59 +0200 Subject: [PATCH] doc: add bootloader --- README.rst | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index dc0cfb880..1750c4a23 100644 --- a/README.rst +++ b/README.rst @@ -93,9 +93,11 @@ firmware The devices is based on a [STM32F042F6P](https://www.st.com/en/microcontrollers-microprocessors/stm32f042f6.html) micro-controller. The firmware uses the [TinyUSB](https://github.com/hathach/tinyusb) USB stack. -The device comes locked, preventing it to be re-flashed. -I connected a DAPlink programmer to flash it, using the SWD test points on the back. -To compile and flash it: + +If you got the passkey from CuVoodoo, it comes configured with a manufacturer key and locked. +You can also request for a blank devices, and manufacturer it and flash the firmware yourself. + +To compile the firmware, you will need and ARM GCC toolchain and run these commands: ~~~ git clone https://git.cuvoodoo.info/kingkevin/passkey_fw @@ -104,5 +106,34 @@ git checkout passkey cd examples/device/hid_cdc_passkey make BOARD=stm32f042passkey get-deps make BOARD=stm32f042passkey -make flash +~~~ + +When no firmware has been programmed on the passkey, the STM32 bootloader will allow to flash the firmware over USB using dfu-util: + +~~~ +make dfu +~~~ + +Re-plug the dongle in the USB port and the passkey will boot the flashed firmware. + +Using the serial terminal you can then enter the manufacturer key by pressing 'K'. +Finally, you can lock the firmware by pressing 'L'. +This it not revocable. +Once locked, you can re-flash the device, change de manufacturer key, or debug the device. + +Before it is locked, you can erase the firmware using 'E'. +Re-plugging the dongle will start the bootloader again, allowing to re-flash a firmware. +You can also connect an SWD programmer, such as a DAPlink, on the test points. +The pinout is a follow: + +- G: ground +- C: SWCLK +- D: SWDIO +- T: the UART TX used to print debug messages + +You can then flash and debug the firmware. + +~~~ +make flash +make debug ~~~