doc: add bootloader

This commit is contained in:
King Kévin 2024-04-18 03:14:59 +02:00
parent bb15bbda72
commit 35aef360cf
1 changed files with 35 additions and 4 deletions

View File

@ -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
~~~