How do you program the boardloader for a DIY Trezor?

As stated here Boardloader - Trezor Wiki the Trezor model T Boardloader is stored in non firmware/software modifyable memory. How do you go about burning this boardloader for a DIY Trezor?

I am assuming it can be programmed via an ftdi programmer via these pads. Are their instructions for doing this anywhere?

In short: boardloader occupies first sector of flash, it’s not on any special memory range. Any SWD adapter can be used to program it, STLink, JLink, FTDI as long as the FTDI chip supports SWD and not just JTAG (older did support only JTAG). You need to connect SWDIO, SWCLK, GND.

One set of instructions - TREZOR Model T Dev Kit

In core/Makefile there is make flash_boardloader option you can derive from, but you need to change the OPENOCD_INTERFACE to something else than STLink if you don’t use STLink.

You can also use GDB with openocd, open boardloader.elf and flash it. E.g.

In one terminal: (this is for STLink, so adapt parameters for FTDI)

openocd -f interface/stlink.cfg -f target/stm32f4x.cfg

That will open SWD connection to chip.

In another terminal run GDB (must be compiled with ARM or multiarch support) with the boardloader executable to flash:

gdb-multiarch core/build/boardloader/boardloader.elf

In GDB (assuming openocd runs at default port localhost:3333) :

target extended remote :3333
monitor reset init

You should be able to run boardloader now.

1 Like