Noob: boot from flash on TinyFPGA-bx



I wrote my first program for the TinyFPGA and I am able to upload it to the board (and flash). How to I automatically switch to boot the program after poweroff(and a delay to allow for programming? I currently need to type tinyprob -b to boot to the user flash program

With kind regards


I am going to start answering this question myself.

The ICE40 FPGA family has documentation here.

One document is the iCE40 Programming and Configuration manual

This document talks about the warm boot configuration

A special design primitive, SB_WARMBOOT, allows an FPGA application to choose between four configuration
images using two internal signal ports, S1 and S0, as shown in Figure 10.1. These pins S1 and S0 are used to detect a warm or cold boot.

For TinyFPGA I think these flasgs can only be obtained in two ways:

Using the programmer e.g. invoke tinyprog -b to send “\x00” to the board
This caused the bootloader to enter op_boot state in configure boot_to_user
and later set boot_to_user_design to true/one

The bootloader intself

defines “boot to user design” if no host is detected or boot_to_user_design is true

Causing the S1 and S0 pins to be set and

Perhaps an additional entry can be added to force the user program after a certain timeout?


Interesting - I’m fairly sure mine does that anyway… I’d kind of assumed it was the default behaviour. The only time it seems to stay in the bootloader is if I press the bootloader button. You can see an example of it doing this here with the Game SoC that a few of us are working on:

… but maybe in my case the host presence timeout is causing that (my programming environment is in a VM, so maybe that contributes to delays)…


Recognizing TinyFPGA BX in WSL

The timeout is about 1 second. If I slowly insert the usb on the host side indeed I can get it to directly boot into the user application. This is because the usb plugs are designed to first give power to the board before the data lines are connected. @gundy with the setup you have programming the board might be difficult no?


I haven’t found it to be particularly difficult - whenever I want to program the board I just push the bootloader button. In fact, I think I prefer the idea that the board by default boots to the user program and only goes into “flash” mode when you press the button… I’m pretty sure that’s how other microcontroller boards I have work too.