Project

General

Profile

Deploying the Firmware

1. Prerequisites 2. Building the FPGA and Bootloader 3. Building the Filesystem 4. Deploying the Firmware

Overview

There are multiple pieces of FPGA firmware and ARM embedded software that are involved with deploying a new build onto a working system. These files are listed in the table below. Depending on your work-flow, you may be able to upgrade an existing (booting) system withing rebuilding an entire SD card and re-flashing it. For updated FPGA images, you must either perform the steps in Upgrading the SD Card or Building an SD Card below and finally reprogram the MitySOM-A5E SPI NOR FLASH using the the generated JIC file. Flashing the JIC should be performed after all other upgrades are completed. If you are unsure which process to perform, follow the "Building an SD Card instructions" below.

Build Artifact Build Location Reference SD Card Partition Path within Partition Notes
a5e.core.rbf FPGA Project Folder/output_files mmcblk0p2 /usr/lib/firmware/a5e.core.rbf
boot.scr FPGA Project Folder/scripts mmcblk0p1 /boot.scr
config_pll.scr FPGA Project Folder/scripts mmcblk0p1 /config_pll.scr
Image linux_socfpga/arch/arm64/boot/Image mmcblk0p2 /boot/Image Optional update needed if kernel or kernel configuration was modified
kernel modules linux_socfpga modules path mmcblk0p2 /usr/lig/modules/kernel modules path Optional update needed if kernel was modified
*mitysom*.dtb linux_socfpga/arch/arm64/boot/dts/intel/*mitysom*.dtb mmcblk0p2 /boot/*mitysom*.dtb Optional update needed if kernel devicetree was modified

Upgrading the SD card

If you have an booted MitySOM carrier board that is accessible via networking, either using an RJ-45 network connection or using the USB-C port as a network attached device, you can use a series of scp or rsync commands to move the build artifacts onto the microSD card by following Upgrading a target via network copy. Otherwise, you will need to power off the device cleanly (e.g., using "poweroff" command at the linux terminal), remove the SD card and insert it into a MicroSD card reader on a linux host and follow the Upgrading the SD Card using a microSD Card slot on a linux host commands.

Upgrading a target via network copy

On the target machine, mount the FAT partition using the following command:

mount /dev/mmcblk0p1 /mnt

If your target is booted to linux and has a network interface enabled, you can use the following commands to copy necessary files to the SD card on the target. You can determine you targets network address using the ipconfig -a command and verify it using the ping command from a host machine.

Once the network address of the target is known, you can update the following files from the host using the commands below. In the example commands the target is assumed to be at location 10.1.47.2.

# run this command to update the core RBF file.
scp fpga_project/output_files/a5e.hps.rbf root@10.1.47.2:/usr/lib/firmware

# run this command to copy an updated DTBs file over
scp path_to_kernel/arch/arm64/boot/dts/*mity*.dtb root@10.1.47.2:/boot

# run these commands to copy updated kernel file and modules file over
scp path_to_kernel/arch/arm64/Image root@10.1.47.2:/boot
scp -rap path_to_modules_install root@10.1.47.2:/usr/lib/modules

# run these commands to copy updated uboot script files
scp path_to_fpga_project/scripts/*.cmd root@10.1.47.2:/mnt

After copying the necessary files, then command the ARM / HPS to shutdown for Flashing the JIC

poweroff

Upgrading the SD card using a microSD card slot on a linux host

If you desire to update an existing SD card using a linux host you must ensure that the card has been properly mounted when installed into a microSD card reader / adapter.

On ubuntu, installed SD cards typically show up in /media/$USER/Partition_GUID_Name. If it does not, then you can manually mount the 2 partitions if you can identify the base driver letter, e.g. "/dev/sdd". Note you must ensure that you have the correct drive letter for the following commands:

# create mount points for the SD card
sudo mkdir -p /mnt/sd_fat
sudo mkdir -p /mnt/sd_root
# mount the FAT partition
sudo mount /dev/sdX1 /mnt/sd_fat
sudo mount /dev/sdX2 /mnt/sd_root

Once the partitions are mounted, you can copy the files to their proper locations. Note: you may need to use the "sudo" command depending on your mount permissions.

# run this command to update the core RBF file.
rsync fpga_project/output_files/a5e.hps.rbf /mnt/sd_root/usr/lib/firmware

# run this command to copy an updated DTBs file over
rsync path_to_kernel/arch/arm64/boot/dts/*mity*.dtb /mnt/sd_root/boot

# run these commands to copy updated kernel file and modules file over
rsync path_to_kernel/arch/arm64/Image /mnt/sd_root/boot
rsync -rap path_to_modules_install /mnt/sd_root/usr/lib/modules

# run these commands to copy updated uboot script files
rsync path_to_fpga_project/scripts/*.cmd /mnt/sd_fat

After copying the necessary files, then command the ARM / HPS to shutdown for Flashing the JIC

poweroff

Building an SD Card Image

These instructions will generate a complete microSD card image that you can use to flash a connected microSD card.

Prerequisites

  • Linux PC (Ubuntu 22.04)
  • libguestfs-tools
sudo apt-get install libguestfs-tools
  • vmlinux set a readable (note: this needs to be done every time the kernel is upgraded)
sudo chmod a+r /boot/vmlinuz*
  • Filesystem Tarball from Yocto (mitysom-image-base-mity-a5e.rootfs.tar.gz)
  • FPGA Design (a5e.core.rbf)
  • Bootloader from FPGA build (u-boot.itb)
  • Bootloader script from FPGA build (boot.scr)

Make SD script

The make_sd.sh script can be found in the FPGA project scripts/make_sd.sh

Prepare the contents of the root filesystem overlay. This area includes any updated files that will be installed on the mmcblk0p2 partition of the root filesystem.

Copy the FPGA core bitstream file:

# Make a rootfs overlay to install the RBF file
mkdir -p rootfs_overlay/usr/lib/firmware
cp output_files/a5e.core.rbf rootfs_overlay/usr/lib/firmware

If the kernel device tree block was changed, copy it into the /boot folder:

mkdir -p rootfs_overlay/boot
cp path_to_kernel/arch/arm64/boot/dts/*mity*.dtb rootfs_overlay/boot

If the kernel was updated, copy the kernel and kernel modules over:

mkdir -p rootfs_overlay/boot
cp path_to_kernel/arch/arm64/Image rootfs_overlay/boot
mkdir -p rootfs_overlay/usr/lib
cp -rap path_to_models rootfs_overlay/usr/lib

The following will generate an sd_card.img that can be flashed onto an SD card.

./make_sd.sh \
    -a \
    -o sd_card.img \
    -d Agilex5 \
    -f path/to/u-boot.itb \
    -f path/to/boot.scr \
    -f path/to/config_pll.scr \
    -r rootfs_overlay \
    path/to/mitysom-image-base-mity-a5e.rootfs.tar.gz

Flashing the SD Card Image

There are several ways to flash the SD Card image. The easiest / recommended way is to use the free Belena Etcher. Follow the instructions on the website link for installation on your hardware. This tool works on linux as well as on Windows.

Other techniques to flash the image include using the linux host "dd" command, e.g.:

dd of=/dev/sdX if=sd_card.img conv=fsync progress=stat

Flashing the JIC

The JIC can be programmed using the Altera USB-II Blaster with the following command.

quartus_pgm -m jtag -o "piv;output_files/a5e.hps.jic@2" 

Note: this command assumes that the previous FPGA image included an HPS configuration. If the previous FPGA image did not include support for an HPS, then the command should be changed to:

quartus_pgm -m jtag -o "piv;output_files/a5e.hps.jic@1" 

1. Prerequisites 2. Building the FPGA and Bootloader 3. Building the Filesystem 4. Building the SD Card

Go to top
Add picture from clipboard (Maximum size: 1 GB)