No description
Find a file
2025-05-16 12:50:59 +07:00
.github use postbuild script to generate combined/ota.bin to workaround $ escape with ninja target 2025-05-15 17:26:34 +07:00
.idea bump tinyusb to fix warning for khci. bump up gcc to 13.3.Rel1 2025-01-21 10:15:09 +07:00
apps add blinky app to make it easier to test bootloader function 2024-12-03 18:08:30 +07:00
cmake update cmake 2024-05-30 16:35:09 +07:00
lib bump tinyusb to fix warning for khci. bump up gcc to 13.3.Rel1 2025-01-21 10:15:09 +07:00
ports include partition-ota.bin, flash_args to artifacts 2025-05-15 23:42:44 +07:00
src Add One Direction Endpoint Support 2025-04-16 16:41:45 -04:00
tools Fix trailing whitespaces and file endings 2024-11-09 17:29:45 +01:00
.codespellrc add pre-commit hook, codespell dictionary, minor changes 2023-11-07 11:18:09 +07:00
.gitignore move self-update to seperated project since it require app to be built first, which can cause confusion 2023-11-08 17:53:59 +07:00
.gitmodules also remove sct 2024-05-29 20:43:44 +07:00
.pre-commit-config.yaml Remove forbid submodule 2023-11-09 07:52:19 +07:00
changelog.md add pre-commit hook, codespell dictionary, minor changes 2023-11-07 11:18:09 +07:00
CMakeLists.txt refactor and fix cmake build for stm32f3 and imxrt 2023-12-14 18:15:32 +07:00
LICENSE Initial commit 2020-06-03 11:27:51 +07:00
README.md tested self-update, it works but usb does not seems to reset for user notice 2024-12-05 19:35:44 +07:00

TinyUF2 Bootloader

Build StatusLicense

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

Features

Supported features are

  • Double tap to enter DFU, reboot to DFU and quick reboot from application
  • DFU with MassStorage (MSC)
  • Self update with uf2 file
  • Indicator: LED, RGB, TFT
  • Debug log with uart/swd

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
STM32H5

Build and Flash

Following is generic compiling information. Each port may require extra set-up and slight different process e.g esp32s2 require setup IDF.

Clone

Clone this repo with its submodule

$ git clone git@github.com:adafruit/tinyuf2.git tinyuf2
$ cd tinyuf2
$ git submodule update --init

Compile

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

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.

Debug

To compile for debugging add DEBUG=1, this will mostly change the compiler optimization

$ make BOARD=feather_stm32f405_express DEBUG=1 all

Log

Should you have an issue running example and/or submitting an bug report. You could enable TinyUSB built-in debug logging with optional LOG=.

  • LOG=1 will print message from bootloader and error if any from TinyUSB stack.
  • LOG=2 and LOG=3 will print more information with TinyUSB stack events
$ make BOARD=feather_stm32f405_express LOG=1 all

Logger

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
    • Cons: requires jlink as the debugger.
    • Pros: work with most if not all MCUs
    • Software viewer is JLink RTT Viewer/Client/Logger which is bundled with JLink driver package.
$ make BOARD=feather_stm32f405_express LOG=2 LOGGER=rtt all