Skip to content
 
 

Repository files navigation

UF2 Loader

UF Loader is a custom bootloader for the RP2040 and RP2350 on the PicoCalc. With UF2 Loader installed, applications can be loaded directly from the SD card at will without needing to plug into a PC. It has been adapted to the ctag-tbd platform.

TBD UF2 Loader

Main adaptations include:

  • SSD1309 display support
  • Adapted UI to match the screen resolution
  • Button mapping to match the ctag-tbd buttons
  • Pin adaptations
  • Small code adaptations i.e. enabling interrupts when jumping to the application
  • Added OpenOCD configs for cmsis-dap flashing (debugging not tested)

Note that the bootloader and ui read from sd-card using the SPI interface. If your application uses the sd-card in sdio mode, you will have to power-cycle the system to re-initialize the sd-card.

Compilation

Clone the source code and initialize the submodules.

git clone https://github.com/ctag-fh-kiel/uf2loader.git
cd uf2loader
git submodule update --init --recursive

Build the bootloader.

PICO_SDK_PATH=/path/to/pico-sdk cmake -DPICO_BOARD=pico2 -B build -S .
cd build
make -j8

The compiled binaries will be placed in the output/ folder.

Installation

Copy BOOT2350.UF2 to the root of the ctag-tbd rp2350 SD card. This is the menu UI and is loaded by the bootloader when needed.

Create a tbd-apps folder on the SD card and copy any UF2 files you want to use to them.

Flash bootloader_pico2.uf2 to ctag-tbd rp2350 using BOOTSEL mode (power up with reset + boot then release reset) or Picotool.

Usage

If an application is already present in flash, by default it will be started immediately on power-on.

Hold Page Up, launch the loader menu.

If an application is present, the first item in the menu (in [square brackets]) will launch it. If the application has the appropriate Binary Information block then the name of the application will be shown here.

Hold Page Down power-on to put the ctag-tbd rp2350 into BOOTSEL mode.

If the menu cannot be loaded for any reason (no SD card, BOOTnnnn.UF2 not found, aliens etc) then the device will fall into BOOTSEL mode.

UF2 files can also be written to the Pico in BOOTSEL mode or via Picotool as normal and will automatically be placed in the app partition.

Technical Implementation Notes

On the RP2350, a flash partition is used, and the application can't directly overwrite (or even see) the bootloader in the normal case (please use RP2350's rom_flash_op instead of the old flash_range_erase/flash_range_program apis, which do not care about the partition table.) The application can get the size of the partition via the bootrom API. (see bl_app_partition_get_info() in proginfo.c for an implementation.)

Credits

  • Hiroyuki Oyama: Special thanks for the firmware loader mechanism and VFS file system.
  • TheKiwil: Special thanks for contributions on supporting pico2 boards with new custom linker script.
  • muzkr: Special thanks for the original boot2/high-mem implementation
  • adwuard: Special thanks for the original Picocalc SD Boot application that UF2 Loader is heavily based on.
  • cuu: Various UI improvements taken from their SD Boot fork
  • nipo: Pico Binary Information parser library
  • Elm-ChaN: because everyone uses their FatFS and Petit FatFS libraries. E. v. e. r. y. o. n. e.
  • pelrun: Base fork of this project

Read More

About

Bootloader that loads firmware from PicoCalc's SD card Slot.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages