How to Flash U-boot to SPI flash for CompuLab SBC-FX6

Requirements

This process requires the following build output from your LinuxLink/Factory build:

  • SPL
  • u-boot.img

These binaries can be found in the sbc_fx6/bootloader/ directory of an SDK install.

In Desktop Factory, they are located at: factory/build_armv7l-timesys-linux-gnueabi/images/bootloader/.

They may also be accessed from the build output of LinuxLink.
Visit the build ouput page of your build, click on "View All Files", and then navigate to the "bootloader" directory.

1. Generate cm-fx6-firmware binary

This operation first creates the cm-fx6-firmware file, and then appends the SPL and u-boot.img file into the firmware binary.

$ sudo dd if=/dev/zero count=500 bs=1K | tr '\000' '\377' > cm-fx6-firmware
$ sudo dd if=SPL of=cm-fx6-firmware bs=1K seek=1 conv=notrunc && dd if=u-boot.img of=cm-fx6-firmware bs=1K seek=64 conv=notrunc

2. Transfer firmware image to prepare for flashing:

Boot the sbc_fx6, and interrupt the automated boot process.
Transfer the firmware image to memory — this can be done via SD card, USB device, or over the network (tftp).

Refer to the SBC-FX6 Getting Started guide for instructions on how to create an SD card:
https://linuxlink.timesys.com/node/3240#SECTION00042000000000000000

Load from SD card:

Set the MMC device:

# mmc dev 2
# mmc rescan

List contents of card to confirm file is accessible:

# ext2ls mmc 2

Load firmware into RAM:

# ext2load mmc 2 10800000 cm-fx6-firmware

Load from USB:

# usb start

List contents of USB to confirm file is accessible:

# ext2ls usb 0

Load image into RAM:

# ext2load usb 0 10800000 cm-fx6-firmware

Load over TFTP:

This assumes a tftp and dhcp server have previously been configured.

Obtain IP address via dhcp:

# dhcp

Alternatively, assign a static IP:

# setenv ipaddr <ip address>

Set the server (your host) IP:

# setenv serverip <server ip>

Transfer file into RAM:

# tftp 10800000 cm-fx6-firmware

Flash new U-boot firmware:

Probe SPI Flash:

# sf probe 0

Erase SPI Flash:

# sf erase 0 80000

Write firmware image to SPI Flash:

# sf write 10800000 0 80000

Reset the hardware to boot into the updated U-boot.