| Foboot Main | **FBM** | Presents a disk drive that makes it easy to load programs |
| User Python Program | **UPY** | Uses a locally-stored Python interpreter to run Python code |
| User RISC-V Program | **URV** | Uses the built-in RISC-V softcore to execute user programs |
| User ICE40 Bitstream | **UBS** | Exits the Foboot RISC-V core and switches to the provided bitstream |
At start, **FBU** is loaded by the hardware. **FBU** will look for a special *FBM signature* at a given offset. If this signature exists, it will transfer execution to that program. Otherwise it will enter *DFU Mode* and await further communication.
## Boot Flags
A series of *Boot Fags* determine how **FBU** and **FBM** hand over execution to the subsequent program.
| 00000001 | QPI_EN | Enable QPI mode on the SPI flash |
| 00000002 | DDR_EN | Enable DDR mode on the SPI flash |
| 00000004 | CFM_EN | Enable CFM mode on the SPI flash |
| 00000008 | FLASH_UNLOCK | Don't lock flash prior to running program |
| 00000010 | FLUSH_CACHE | Issue a "fence.i" prior to running user program |
| 00000020 | NO_USB_RESET | Don't reset the USB -- useful for debugging |
## RAM boot
During development, it may be inconvenient to load a program onto SPI flash. Or maybe you want to run something that doesn't modify the contents of SPI. This is possible with `RAM boot`.
If the DFU bootloader encounters the magic number `0x17ab0f23` within the first 56 bytes, then it will enable *RAM boot* mode. In this mode, the SPI flash won't be erased, and the program will be loaded to RAM.
Note that the value following the magic number indicates the offset where the program will be loaded to. This should be somewhere in RAM. `0x10001000` is a good value, and is guaranteed to not interfere with Foboot itself.