Changes between Initial Version and Version 1 of venice/firmware


Ignore:
Timestamp:
10/09/2020 06:26:42 PM (4 years ago)
Author:
Tim Harvey
Comment:

initial page

Legend:

Unmodified
Added
Removed
Modified
  • venice/firmware

    v1 v1  
     1[[PageOutline]]
     2
     3= Updating Venice Firmware / Software
     4
     5This page is all about updating / flashing firmware / software onto a Venice SBC.
     6
     7The various components of the 'firmware' on a Venice board which you may want to update from time to time are (lowest level components listed first):
     8- GSC firmware
     9- SPL
     10- Linux device-tree
     11- U-Boot bootloader
     12- Linux kernel
     13- root filesystem
     14
     15Some components above you can update individually in Linux using {{{dd}}} or in U-Boot using {{{mmc write}}} taking care to place them at the right offset.
     16
     17= Pre-Built Firmware
     18[wiki:venice/bsp#images Venice Pre-Built Firmware / Software]
     19
     20[=#firmware-version]
     21= Firmware Versioning
     22
     23You can determine the firmware version of various portions of the firmware by looking for banners on the serial console. For example:
     24{{{#!bash
     25U-Boot SPL 2020.04-g0a0109fcfb (Oct 07 2020 - 19:30:09 +0000)
     26GSC     : v57 0x4d20 RST:VIN Thermal Protection Enabled
     27Model   : GW7301-00-B1B
     28...
     29U-Boot 2020.04-g0a0109fcfb (Oct 07 2020 - 19:30:09 +0000), Build: jenkins-venice-bsp-24
     30...
     31[    0.000000] Linux version 5.4.45-g43e409dc8906 (jenkins@bionic_builder) (gcc version 8.4.0 (Buildroot 2020.05.2-109-g32cec2af36)) #1 SMP Wed Oct 7 18:43:20 UTC 2020
     32...
     33Ubuntu 20.04.1 LTS focal-venice ttymxc1
     34
     35Gateworks-Ubuntu-gateworks-g65dac90 Tue Oct  6 23:54:49 UTC 2020
     36...
     37}}}
     38
     39
     40The above output shows you:
     41 * Secondary Program Loader (SPL) GIT revision and build date
     42 * GSC firmware version
     43 * U-Boot GIT revision and build date
     44 * Linux kernel version, GIT revision, build date and build source
     45 * Ubuntu root filesystem version and GIT revision of the Gateworks [https://github.com/gateworks/ubuntu-rootfs ubuntu-rootfs.sh] that created it (use {{{dpkg -l | grep "^ii"}}} to see what packages and versions are installed
     46
     47
     48[=#firmware-update]
     49= Updating Firmware
     50This section provides instructions for updating both GSC firmware as well as boot device firmware.
     51
     52There are two methods for updating firmware:
     53 * on a live board using Serial Console and Ethernet
     54 * using a GW16099 JTAG dongle (see [#jtag below])
     55
     56The various items that can be easily updated:
     57 * GSC Firmware - Can be updated via JTAG or at runtime - see [#gsc below])
     58 * Boot Firmware (Everything up to and including the Bootloader)
     59 * Root Filesystem (Operating System)
     60
     61[=#jtag]
     62== JTAG Programming
     63The Gateworks JTAG adapter (GW16099) is available in the Venice Dev Kit as well as on the Gateworks web store [http://shop.gateworks.com/index.php?route=product/category&path=70_80 here]
     64
     65All Venice boards have a 10-pin JTAG header which provides:
     66 * JTAG Programming for embedded emmc flash - see [wiki:jtag_instructions here] for instructions
     67 * Serial Console access via UART2 (/dev/ttymxc1)
     68
     69Please Note:
     70 * Linux software is supported for programming Venice (jtag_usbv4 required). Windows is not supported. (serial console through Windows does work).
     71 * JTAG Programming of eMMC is supported by [http://dev.gateworks.com/jtag/jtag_usbv4 jtag_usbv4] - see [wiki:jtag_instructions here]. Due to this being a slow process for large eMMC devices it is recommended to program boot firmware via JTAG if you brick your board and use the bootloader to install firmware when possible for speed (see [#serial-ethernet] below).
     72 * JTAG Programming of the GSC firmware is supported by [http://dev.gateworks.com/jtag/jtag_usbv4 jtag_usbv4] - see [#jtag-gsc below]
     73
     74
     75[=#serial-ethernet]
     76== Update Firmware via Serial Console and Ethernet from Bootloader
     77The quickest and easiest way to update your firmware is via Serial Console and Ethernet. You can do this either in the U-Boot bootloader (recommended) or within a Linux OS.
     78
     79If updating firmware via !Bootloader/Serial/Ethernet (recommended for speed) you need to setup a TFTP server to host the files for transfer. Alternatively you could load firmware files from removable storage (microSD, or USB Mass Storage for example) however you will need to deviate from the examples below. For details on setting up a TFTP server see [wiki:tftpserver here].
     80
     81The following instructions assume your board target IP address is 192.168.1.1 and you have a TFTP server at 192.168.1.146. Adjust environment according to your network via 'setenv ipaddr <ipaddr>' and 'setenv serverip <serverip>'.
     82
     83The methods you use to update the firmware depends on what specifically you are trying to update.
     84
     85
     86==== Update entire firmware (recommended)
     87Update the entire device from a Compressed Disk Image. This image includes the ('boot firmware as well as entire OS and kernel):
     88
     89Complete Compressed Disk Images are available for download here: [http://dev.gateworks.com/venice/images/]
     90
     91Examples:
     92 * Setup environment for networking
     93{{{#!bash
     94setenv ipaddr 192.168.1.1 # sets device IP
     95setenv serverip 192.168.1.146 # sets TFTP LAN server IP
     96}}}
     97 * Choose which device you are going to update:
     98{{{#!bash
     99setenv dev 2 # sets MMC device to be flashed - see mmc list
     100setenv image focal-venice.img.gz # or whatever filename is used, with any tftp server directories in front of the filename
     101run update_all # the update_all script expects a compressed image and will write to the beginning of flash
     102}}}
     103
     104This is what the update_all script does:
     105{{{#!bash
     106update_all=tftpboot ${loadaddr} ${image} && gzwrite mmc ${dev} ${loadaddr} ${filesize}
     107}}}
     108
     109
     110==== Updating just the boot firmware
     111Updating the [wiki:nvenice/boot 'Boot firmware'] via this method includes the SPL, U-Boot, the device-tree, and the ATF. The method here specifically does not update the disk partition table at the beginning of the boot device as that really has nothing to do with the boot firmware.
     112
     113Note that the IMX8 BOOT ROM fetches code starting at a 33K offset (in order to reserve everything below that for things like disk partition tables).
     114
     115We will use the {{{update_firmware}}} script in the Venice U-Boot default environment which looks like this:
     116{{{#!bash
     117=> print update_firmware
     118update_firmware=tftpboot $loadaddr $image && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt $blkcnt / 0x200 && mmc dev $dev && mmc write $loadaddr 0x42 $blkcnt
     119}}}
     120 * Note the flash offset is 0x42 blocks which is 33KiB
     121 * Note the {{{dev}}} and {{{image}}} env variables are used by this script
     122
     123On a Venice booted to the bootloader:
     124{{{#!bash
     125=> mmc list
     126FSL_SDHC: 0
     127FSL_SDHC: 1 (SD)
     128FSL_SDHC: 2 (eMMC)
     129=> setenv dev 2 # eMMC
     130=> setenv image flash.bin
     131=> run update_firmware
     132}}}
     133
     134
     135==== Updating just the root filesystem
     136Updating the root filesystem from a 'compressed filesystem image' can easily be done by help of the {{{update_rootfs}}} script in the Venice U-Boot default environment which looks like this:
     137{{{#!bash
     138=> print update_rootfs
     139update_rootfs=tftpboot $loadaddr $image && gzwrite mmc $dev $loadaddr $filesize 100000 1000000
     140}}}
     141 * Note gzwrite is used so the filesystem image must be compressed with 'gzip' (otherwise you could use mmc write manually). The data (ie type of filesystem or content ) does not matter here
     142 * Note the flash offset is 0x1000000 blocks which is 16MiB
     143 * Note the {{{dev}}} and {{{image}}} env variables are used by this script
     144
     145On a Venice booted to the bootloader:
     146{{{#!bash
     147=> mmc list
     148FSL_SDHC: 0
     149FSL_SDHC: 1 (SD)
     150FSL_SDHC: 2 (eMMC)
     151=> setenv dev 2 # eMMC
     152=> setenv image rootfs.ext4.gz
     153=> run update_rootfs
     154}}}
     155
     156
     157=== TFTP Error Troubleshooting
     158There are many reasons why TFTP may fail including:
     159 * firewall issue keeping your TFTP server for being accessible (make sure you can ping it!)
     160 * invalid network configuration (netmask, gatewayip, ipaddr, serverip) - again make sure you can ping it!
     161 * 'TFTP error: trying to overwrite reserved memory...' - indicates you are trying to transfer a file that is larger than system memory. You will need to split the file into chunks and flash them individually at the right offsets
     162
     163
     164= Updating GSC firmware
     165The GSC firmware is updated via the {{{gsc_update}}} application running under Linux as described at on the [wiki:gsc#firmware gsc wiki]. While it takes only a few seconds to update there is no recovery for a failed update. Gateworks has ensured that this update is robust but can not survive a power-cut or kernel crash in the middle of the update. Updates to the GSC firmware are expected to be rare.
     166
     167
     168[=#jtag-gsc]
     169=== Update GSC Firmware via JTAG ===
     170To update the GSC firmware via JTAG download the {{{jtag_usbv4}}} application on a Linux x86 host from [http://dev.gateworks.com/jtag/jtag_usbv4 here] and execute as follows:
     171{{{#!bash
     172./jtag_usbv4 -m gsc_7000_v57.txt
     173}}}
     174
     175Note that the {{{ftdi_sio}}} kernel module must not be loaded (sudo rmmod ftdi_sio) and you may need to run this command as root by pre-pending a sudo depending on the configuration of your linux host.
     176
     177For more details please see:
     178 * [wiki:jtag Gateworks JTAG wiki page]