spiflash
is a tool used to update the firmware stored in OpenTitan's flash. The tool resets OpenTitan and signals the boot ROM to enter bootstrap mode before sending the update payload.
Currently, the tool only supports Verilator targets.
spiflash
is written in C++17.
Required packages:
$ sudo apt-get install libssl-dev libftdi1-dev
Build command:
$ cd ${REPO_TOP}/util/spiflash $ make clean && make
Build boot_rom:
$ cd ${REPO_TOP}/sw/boot_rom $ make clean && make SIM=1
Build and run Verilator with boot_rom enabled:
$ cd ${REPO_TOP} $ fusesoc --cores-root . sim --build-only lowrisc:systems:top_earlgrey_verilator $ build/lowrisc_systems_top_earlgrey_verilator_0.1/sim-verilator/Vtop_earlgrey_verilator \ --rominit=sw/boot_rom/boot_rom.vmem
Build hello_world program:
$ cd ${REPO_TOP}/sw/hello_world $ make clean && make SIM=1
Run spiflash. In this example we use SPI device /dev/pts/3
as an example. After the transmission is complete, you should be able to see the hello_world output in the UART console.
$ cd ${REPO_TOP}/util/spiflash $ make clean && make $ ./spiflash --input=../../sw/hello_world/hello_world.bin --verilator=/dev/pts/3