RZ-G/RZ-G2L Flash Programming

From Renesas.info
Jump to navigation Jump to search

RZ/G2L cannot boot from USB, so at the end-of-line there are two/three real viable options:

  1. Boot from SCIF
  2. Use JTAG
  3. It is worth to mention that, in general, if a QSPI FLASH is present on the custom board, it can also be bought preprogrammed

In any of the cases above the goal is to have U-Boot up and running, then there are plenty of options to program the rootfs: ethernet, USB as host, USB with Mass Storage gadget, fastboot or even boot Linux kernel + initramfs.

With option 1, you can download the flash writer and program the bootloaders, Arm Trusted Firmware (ATF) and U-Boot, into QSPI / eMMC boot partition, then reset and run U-Boot.

With option 2, you can download ATF and U-Boot via JTAG and then run the boot loaders without having to initially program them. Once U-Boot runs, you can program both bootloaders and rootfs.

With option 3, QSPI has already bootloaders pre-programmed, so U-Boot is already available.

All the options above may not require any human intervention and can be to a certain extent automatized.

Boot from SCIF

The main tool that can assist in performing external non-volatile memory (QSPI and eMMC) is Flash Writer. Depending on the host PC used, you can either use a script (link to be added) or a TeraTerm macro. In both cases what you would need are two files:

  • bl2_bp-smarc-rzg2l.bin
  • fip-smarc-rzg2l.bin

These are either the output of Yocto or generated by combining ATF and U-Boot binaries. Actually the first one is generated by ATF directly whereas the second is the generated by the Firmware Image Package (FIP) utility by combining BL3x binaries.

Linux script

A Linux bash script is available here. Please refer to the README for help on the usage.

Windows TeraTerm macro

Usually dealing with this type of devices a Linux host PC is normally available. However sometimes it might be convenient to have a quick way to program the bootloaders using Windows.

Instead of using an ad-hoc tool developed only for the RZ/G2L the idea is to use a generic terminal utility. Tera Term is an open source tool that has some nice scripting capabilities embedded: a Tera Term script is called MACRO. The developed macro "replaces" the user and provides inputs to Flash Writer, whose binary is also downloaded automatically. However the macro alone cannot work, it needs the Flash Writer binary and the files to be programmed (ATF BL2 and FIP).

Since Windows users are typically lazy, a PowerShell script (press ALT and then click on this link to download it) was developed to:

  • Check if Tera Term is installed and retrieve the installation path;
  • Download in a temporary folder the needed files;
  • Retrieve the PC COM ports and ask the user to confirm the one used to communicate with the RZ/G2L board;
  • Create a Windows shortcut to call the Tera Term macro executer using the right parameters;
  • Launch the macro to program the RZ/G2L boot loaders.

Once executed the first time the user can simply double click on the shortcut created by the macro script to relaunch the programming. The macro programs automatically the files present in the "Binaries" folder and it can handle both SREC and BIN. Binary is normally faster to be programmed since files are smaller. The file names should start with bl2 and fip respectively but the rest can be arbitrary. Users can replace the default files with custom files and launch the programming. There can be many files in the folder, the first in alphabetical order are used. You can also mix SREC and BIN files, i.e. program a BL2 SREC and a FIP BIN or vice versa.

It is worth noticing that the macro and the PowerShell script can be easily modified to remove any user intervention, something that may be useful for an unattended flash programming.

Flash Writer binary chip / board dependency

Even though RZ/G2L and RZ/V2L are brother chips (the only functional difference is the DRP-AI), there are some subtle changes that lead to have a different DDR register configuration. Flash Writer does initialize the DDR so, the binaries to be used are different for RZ/G2L and RZ/V2L. On top of that there are several slightly different variant of the SMARC SOM due to the different DDR chips / topology. Below a summary:

  • SMARC RZ/G2L WS1 (only discrete) DDR config is 2x1GB;
  • SMARC RZ/G2L WS2 discrete DDR config is 2x1GB but there are some HW changes between WS2 and WS1 hence different DDR init code;
  • SMARC RZ/V2L discrete DDR config is 2x2GB;
  • SMARC RZ/G2L WS2 - RZ/V2L PMIC DDR config is 1x2GB.

For the last variant, the only difference is the chip but as said the DDR init code is different so different binaries are needed.

Use JTAG

TBD