Loading FSBL from SD


(Jonathan Neuschäfer) #1

Hi, I want to load my own FSBL into L2LIM to test my UART driver. I tried the following:

  • I created a partition with the type 5B193300-FC78-40CD-8002-E86C45580B47 (FSBL) after the bbl partition (Thanks for leaving some space!). I made it 4MiB large.
  • I set MSEL to 11 (0b1011)
  • I turned on the board

The result was that ROM1/ZSBL printed “Error 0x0100000000000001”. What does this error number mean?

The manual says “Then, the entire contents of this partition, the FSBL, are
downloaded into the L2 LIM at address 0x0800_0000.” How large may an FSBL partition be? Because it sounds like L2LIM will simply be overflowed if the partition is too large.


(Wesley W. Terpstra) #2

It means boot stage 0, mcause=1, which means Supervisor software interrupt. Presumably you caused an interrupt that was uncaught.


(Jonathan Neuschäfer) #3

Thanks!
Is there a description of all possible error formats available somewhere?


(Wesley W. Terpstra) #4
// Error codes are formatted as follows:
// [63:60]    [59:56]  [55:0]
// bootstage  trap     errorcode
// If trap == 1, then errorcode is actually the mcause register with the
// interrupt bit shifted to bit 55.

(Jonathan Neuschäfer) #5

Some what related idea: For recovery (and, in some cases, development) purposes, it would be interesting to have an (official) SD-card image that contains not only bbl+Linux, but also FSBL, so the HiFive Unleashed could be booted in boot mode MSEL=11 without relying on the content of the SPI flash.


(Wesley W. Terpstra) #6

We have images like this internally to initially program boards and/or debrick them. It’s easy enough to make your own using gdisk.


(Jonathan Neuschäfer) #7

Where do I get FSBL? Should I extract it from SPI flash?

I tried that with FSBL 2018-03-20 as shipped on SPI flash a week ago, and it didn’t work (ZSBL printed an error code), but maybe it was an error on my part (partition to large, maybe).


(Wesley W. Terpstra) #8

The gpt image that get’s flashed includes a partition with a legal FSBL. I usually just create a 1MB partition on my SD card (with the correct GUID code) and then dd the fsbl binary into it.


#9

@terpstra is FSBL on the provided HiFi board? And if not, how do we acquire the FSBL binary? Can’t seem to locate the source code.


(Jim Wilson) #10

The FSBL sources can now be found here
https://github.com/sifive/freedom-u540-c000-bootloader
This is seriously lacking documentation, but issue #9 has some info on how to use it.
https://github.com/sifive/freedom-u540-c000-bootloader/issues/9


#11

I stumbled onto that issue and have been working on building that repo but I’m having some trouble, do you know if there are any fsbl.bin files available online? We just need an FSBL for running some tests.


(Jim Wilson) #12

I’m a toolchain guy. I’m not an expert in this area.

Most of the people that want to build FSBL are doing boot loader work, and know how to debug boot loader problems. It seems odd that someone would request it for any other reason.

We used to have firmware files on our web site. It looks like they got lost when the web site was rewritten. Try looking at
https://web.archive.org/web/20180514063311/https://static.dev.sifive.com/dev-kits/hifive-unleashed/hifive-unleashed-firmware-1.0.zip