Guide: Upgrading firmware with only a serial/uart connection via u-boot

Please use a terminal that supports YMODEM file transfers. For Windows there is Tera Term. On Linux I recommend GNU screen, but ensure lrzsz is also installed, as the file transfer feature uses it.

Set up connection at 115200 bps, 8N1.

First, prepare the files you want to flash, such as from the latest release:

https://github.com/starfive-tech/VisionFive2/releases

  • u-boot-spl.bin.normal.out
  • visionfive2_fw_payload.img

Boot in flash mode, without a sdcard inserted, or otherwise interrupt u-boot’s autoboot:

Hit any key to stop autoboot:  0
StarFive #

After sending loady command, start the YMODEM upload through your terminal’s interface.

Like:

StarFive # loady
## Ready for binary (ymodem) download to 0xA0000000 at 115200 bps...
CCxyzModem - CRC mode, 1(SOH)/128(STX)/0(CAN) packets, 7 retries
## Total Size      = 0x0001fe80 = 130688 Bytes
StarFive #

There is some assurance that the transfer went well, as YMODEM uses a CRC16 checksum on every block sent (1KB blocks). Should that not be enough, it is possible to check CRC32 of the whole file and manually compare.

StarFive # crc32 $loadaddr $filesize
crc32 for a0000000 ... a001fe7f ==> ca14da8e

OK. It’s the same file. Let’s flash it next. First, detect the SPI Flash:

StarFive # sf probe
SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB

Then, time to flash the file we transferred.

For u-boot-spl.bin.normal.out the offset at the flash is zero:

#WARNING: This is for u-boot-spl.bin.normal.out. Ensure that is the file we loaded!
StarFive # sf update $loadaddr 0x0 $filesize
device 0 offset 0x0, size 0x1fe80
130688 bytes written, 0 bytes skipped in 0.600s, speed 221563 B/s

Whereas for visionfive2_fw_payload.img the right offset is 0x100000:

#WARNING: This is for visionfive2_fw_payload.img.  Ensure that is the file we loaded!
StarFive # sf update $loadaddr 0x100000 $filesize
device 0 offset 0x100000, size 0x2aae85
867973 bytes written, 1929216 bytes skipped in 5.750s, speed 497796 B/s

Once done, reboot by either using the reset command or physically pressing the reset button.

7 Likes

Painfully, editing is no longer possible.

On Linux, the recommended terminal is minicom. Shows a nice menu on C-a s for sending files.

It is possible to do YMODEM with GNU screen, but it’s relatively painful as it doesn’t have an UI for that. In long command mode, exec !! sx --ymodem <filepath> .

1 Like

On Windows I would recommend TeraTerm Pro. I just flash my board using your method with it.

3 Likes

Thank you for this straight forward set of instructions. I was having some trouble getting TFTP on my PC talking to the board properly.

I’d like to echo what @cwt said about TeraTerm as well, has YMODEM support and worked perfectly.

1 Like

The open source Tera Term is what I have used on Windows, too.

Which I installed via chocolatey.

Note that Tera Term does also support Kermit, which is a better protocol overall. (use loadb instead of loady)

1 Like

I got my adafruit serial adapter just today, this worked wonderfully and I’m running image69 perfectly now! Thank you so much for making this guide!

4 Likes