This repo is cross-platform UF2 Bootloader projects for MCUs based on TinyUSB
.
├── apps # Useful applications such as self-update, erase firmware
├── lib # Sources from 3rd party such as tinyusb, mcu drivers ...
├── ports # Port/family specific sources
│ ├── espressif
│ │ └── boards/ # Board specific sources
│ │ └── Makefile # Makefile for this port
│ └── mimxrt10xx
├── src # Cross-platform bootloader sources files
Supported features are
Not all features are implemented for all MCUs, following is supported MCUs and its feature
MCU | MSC | Double Reset | Self-update | Write Protection | Neopixel | TFT |
---|---|---|---|---|---|---|
ESP32 S2/S3 | ✔ | Need RC | ✔ | ✔ | ✔ | |
K32L2 | ✔ | ✔ | ||||
LPC55 | ✔ | ✔ | ✔ | |||
iMXRT | ✔ | ✔ | ✔ | ✔ | ||
STM32F3 | ✔ | ✔ | ✔ | ✔ | ✔ | |
STM32F4 | ✔ | ✔ | ✔ | ✔ | ✔ |
Following is generic compiling information. Each port may require extra set-up and slight different process e.g esp32s2 require setup IDF.
To build this for a specific board, we need to change current directory to its port folder
$ cd ports/stm32f4
Firstly we need to get all submodule dependency for our board using tools/get_deps.py
script with either family input or using --board option. You only need to do this once for each family
python tools/get_deps.py stm32f4
python tools/get_deps.py --board feather_stm32f405_express
Then compile with all
target:
make BOARD=feather_stm32f405_express all
flash
target will use the default on-board debugger (jlink/cmsisdap/stlink/dfu) to flash the binary, please install those support software in advance. Some board use bootloader/DFU via serial which is required to pass to make command
$ make BOARD=feather_stm32f405_express flash
If you use an external debugger, there is flash-jlink
, flash-stlink
, flash-pyocd
which are mostly like to work out of the box for most of the supported board.
To compile for debugging add DEBUG=1
, this will mostly change the compiler optimization
$ make BOARD=feather_stm32f405_express DEBUG=1 all
Should you have an issue running example and/or submitting an bug report. You could enable TinyUSB built-in debug logging with optional LOG=
.
$ make BOARD=feather_stm32f405_express LOG=1 all
By default log message is printed via on-board UART which is slow and take lots of CPU time comparing to USB speed. If your board support on-board/external debugger, it would be more efficient to use it for logging. There are 2 protocols:
LOGGER=rtt
: use Segger RTT protocol
LOGGER=swo
: Use dedicated SWO pin of ARM Cortex SWD debug header.
$ make BOARD=feather_stm32f405_express LOG=2 LOGGER=rtt all
$ make BOARD=feather_stm32f405_express LOG=2 LOGGER=swo all