Bootloader for Fomu
Go to file
Sean Cross b84a24a853 foboot-bitstream: use modern method of indicating debug
The litex core has changed how debug is indicated, instead preferring to
add suffixes to configurations.

Follow this convention when instantiating the main CPU.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-23 21:54:33 +08:00
doc doc: add BOOT-SEQUENCE.md 2019-05-01 14:08:54 -07:00
examples examples: usb-cdcacm: fix example with good usb core 2019-05-12 21:36:51 +08:00
fobooster fobooster: add initial, non-working version 2019-04-28 19:43:06 -07:00
foboot-main foboot-main: wip commit 2019-05-20 21:31:01 +08:00
hw foboot-bitstream: use modern method of indicating debug 2019-05-23 21:54:33 +08:00
sw usb-desc: use PID assigned to Fomu 2019-05-22 11:21:45 +08:00
.gitattributes gitattributes: try fixing lf/crlf issue 2019-04-11 10:41:23 +08:00
.gitignore gitignore: ignore all elf, bin, and hex files 2019-04-11 15:51:23 +08:00
.gitmodules deps: valentyusb: change url to im-tomu organization 2019-04-24 13:38:46 +08:00
LICENSE doc: fix line endings 2019-04-11 15:53:37 +08:00
README.md doc: fix line endings 2019-04-11 15:53:37 +08:00

Foboot: The Bootloader for Fomu

Foboot is a failsafe bootloader for Fomu. It exposes a DFU interface to the host. Foboot comes in two halves: A Software half and a Hardware half. These two halves are integrated into a single "bitstream" that is directly loaded onto an ICE40UP5k board, such as Fomu.

Requirements

To build the hardware, you need:

  • Python 3.5+
  • Nextpnr
  • Icestorm
  • Yosys
  • Git

Subproject hardware dependencies will be taken care of with lxbuildenv.

To build the software, you need:

  • RISC-V toolchain

Building the project

The hardware half will take care of building the software half, if it is run with --boot-source bios (which is the default). Therefore, to build Foboot, enter the hw/ directory and run:

$ python3 foboot-bitstream.py --revision hacker

This will verify you have the correct dependencies installed, compile the Foboot software, then synthesize the Foboot bitstream. The resulting output will be in build/gateware/. You should write build/gateware/top-multiboot.bin to your Fomu device in order to get basic bootloader support.

Usage

You can write the bitstream to your SPI flash. If you're using fomu-flash, you would run the following:

$ fomu-flash -w build/gateware/top-multiboot.bin
Erasing @ 018000 / 01973a  Done
Programming @ 01973a / 01973a  Done
$ fomu-flash -r
resetting fpga
$

Fomu should now show up when you connect it to your machine:

[172294.296354] usb 1-1.3: new full-speed USB device number 33 using dwc_otg
[172294.445661] usb 1-1.3: New USB device found, idVendor=1209, idProduct=70b1
[172294.445675] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[172294.445684] usb 1-1.3: Product: Fomu Bootloader (0)
[172294.445692] usb 1-1.3: Manufacturer: Kosagi

To load a new bitstream, use the dfu-util -D command. For example:

$ dfu-util -D blink.bin

This will reflash the SPI beginning at offset 262144.

To exit DFU and run the bitstream at offset 262144, run:

$ dfu-util -e

Note that, unlike Toboot, Foboot requires you to issue dfu-util -e in order to start the program.

Building the Software

Software is contained in the sw/ directory.