RZ-A/Boards/GR-PEACH



=GR-PEACH Board= The GR-PEACH is an mbed platform with an RZ/A1H and a single QSPI Flash device. While it was intended to be used with the mbed cloud development environment, the board itself can be loaded with Linux, and particularly XIP Linux (since you only have the 10MB of RAM inside the RZ/A1H).

Below are the instructions on how to build and load a XIP Linux image on a GR-PEACH board along with a AXFS (XIP) file image. After kernel boot, you should only be using about 3MB of your 10MB internal RAM.

The kernel version will be Linux-3.14

Board Modifications
SPI Flash
 * The GR-PEACH only comes with a 8MB QSPI flash. That is pretty small for Linux, especially XIP Linux. It is recommended that you replace it with a the 16MB version of the same Macronix chip. Because the package footprint is a 8-SOP, your choices on drop in SPI flash replacements are pretty small. This is the recomended device to use:
 * Macronix Part Number: MX25L12835FM2I-10G
 * Digi-Key Part Number: 1092-1197-ND (http://www.digikey.com/products/en?keywords=1092-1197-ND)

There is a 32MB version QSPI flash version (Macronix MX25L25645G), but it is hard to get unless you order 4,000 at a time.

JTAG
 * Since the GR-PEACH was intended to be used for mbed, the SPI flash was meant to be loaded using the 'mbed file drag and drop' method. It is much easier to just use the JTAG interface with a Segger Jlink (or the JLINK-LITE that comes with the Renesas RSK kit). To do this, you need to solder on the 9-pin JTAG connector (yes, it's called a mini Cortex M connector...but it's the same signals)
 * Samtec FTSH-105-01-L-D-K
 * http://www.digikey.com/product-detail/en/samtec-inc/FTSH-105-01-L-D-K/SAM8798-ND/2649979


 * Note that you must remove one of the pins on the 10-pin connector by either cutting it or pulling it out with pliers before you solder it down. The reason is that the Cortex-M adapter expects there NOT to be a pin there (and they block it on the plug). If a pin is there, the connector will not plug in.
 * See image: Grpeach_jtag_header.jpg


 * You will also need an adapter to convert the full 20-pin JTAG interface to the mini connector.
 * J-LINK 9-PIN CORTEX-M ADAPTER
 * http://www.digikey.com/product-detail/en/segger-microcontroller-systems/8.06.02-J-LINK-9-PIN-CORTEX-M-ADAPTER/899-1012-ND/2421158


 * Note that we will still use the mbed USB connection (the one closest to the corner) for board power and serial console.

Update mbed Firmware
It is recommended that you update your GR-PEACH firmware to whatever the last version is (just to fix any USB-Serial bugs)
 * https://developer.mbed.org/users/RyoheiHagimoto/notebook/how-to-update-firmware-for-gr-peach/

mbed USB-to-Serial Driver

 * If you will be using Windows for your serial terminal, you will need to download the mbed drivers from here
 * https://developer.mbed.org/handbook/Windows-serial-configuration


 * If you will be using Linux for your serial terminal, they should already be included as part of your distribution.
 * Note that we will be using a baud rate of 115200bps(8 bits, 1 stop bit, no parity)

Install the RZ/A1 RSK BSP
$ git clone https://github.com/renesas-rz/rskrza1_bsp.git $ cd rskrza1_bsp
 * We will us the RSK BSP build environment even though we we will be using a GR-PEACH. The reason is that the u-boot and Linux repositories on github also support GR-PEACH.
 * 1) Clone the BSP from github

Get Latest code from github
$ cd output/u-boot-2015.01 ; git checkout 2015.01-rskrza1 ; git pull ; cd ../.. $ cd output/linux-3.14 ; git checkout master ; git pull ; cd ../..
 * (which will include GR-PEACH updates)
 * 1) Update the u-boot and kernel source inside the BSP by pulling updates from github
 * 2) Start in the base of the BSP (where the build.sh file is)

Install Segger Jlink Drivers for Linux

 * Install the "J-Link Software and Documentation Pack" from Segger's website
 * https://www.segger.com/downloads/jlink
 * Hint: You need to click the "Click for downloads" to actually find the download links.

Building

 * The tested build environment was Ubuntu. If using another distribution, some changes might be needed (but I'm not sure what exactly).
 * Lines that start with the symbol '$' are to be copy/pasted into the Linux PC terminal (without the $)
 * Lines that start wit the symbol '=>' are u-boot commands
 * Lines that start wit the symbol '#' are just comments

Build the File System
$ ./build.sh buildroot $ ./build.sh axfs
 * We do this first because we need Buildroot to download the toolchain that we will use to build u-boot and the kernel.
 * NOTE that you will only have 10MB of Flash for your root file system, so you should probably select the 'minimum' file system option when prompted.
 * NOTE that we are in luck because the GR-PEACH uses the same serial port (SCIF2) as the RSK board, so we do not have to modify /etc/inittab from the default value.
 * Also build the AXFS XIP file image

Build u-boot
$ ./build.sh u-boot grpeach_defconfig $ ./build.sh u-boot

Build the Kernel and Device Tree
$ ./build.sh kernel grpeach_xip_defconfig $ ./build.sh kernel xipImage $ ./build.sh kernel dtbs

Programming

 * These instructions assume you have replaced the 8MB SPI Flash with the 16MB SPI flash.
 * Note that the RSK board has dual SPI flash where as the GR-PEACH only has a single SPI flash, so the programming commands are a little different.
 * Note we can program u-boot and Device Tree directly to SPI flash using the Segger JLink. However, to program the kernel and file system, we first need to download the images to RAM and then let u-boot do the actual SPI flash programming.
 * The memory map of the SPI flash will be as follows:

Program u-boot into QSPI Flash
$ ./build.sh jlink output/u-boot-2015.01/u-boot.bin 0x18000000
 * Requires Jlink to be connected to Linux (if running a Virtual Machine)
 * This will program the u-boot binary directly into the QSPI flash

- use mbed USB serial port - baud rate is 115,200 bps - click the reset button - type "saveenv" in u-boot to save the "environment settings" to SPI flash (gets rid of BAD CRC warning message after reset)
 * Test that u-boot comes up
 * Note that you will need to have u-boot working in order to program the kernel and file system

Program Device Tree for into QSPI Flash
$ ./build.sh jlink output/linux-3.14/arch/arm/boot/dts/r7s72100-grpeach.dtb 0x180C0000
 * This will program the device tree binary directly into the QSPI flash

Program Kernel into QSPI Flash
$ ./build.sh jlink output/linux-3.14/arch/arm/boot/xipImage 0x20000000 => sf probe 0 ; sf erase 100000 500000 ; sf write 20000000 100000 500000
 * Make sure u-boot is programmed and u-boot is running
 * Download the kernel binary to on-chip RAM using Jlink:
 * After download, enter these u-boot commands to copy from RAM to SPI flash

$ ./build.sh jlink output/linux-3.14/arch/arm/boot/xipImage 0x18100000
 * Alternatively, you could use Jlink to program the SPI flash directly (easier...but takes twice as long as u-boot)

Program File System
$ ./build.sh jlink output/axfs/rootfs.axfs.bin 0x20000000 => sf probe 0 ; sf erase 600000 900000 ; sf write 20000000 600000 900000
 * If your file system is smaller than 9MB, use this method because it's faster:
 * After download, enter these u-boot commands to copy from RAM to SPI flash

$ ./build.sh jlink output/axfs/rootfs.axfs.bin 0x18600000
 * If your file system is larger than 9MB, use this method because it will program the SPI Flash directly...but it's going to take a while...
 * The reason is that the RZ/A1H only has 10MB of on chip RAM, and u-boot is using the upper portion of RAM, so we can only download 9MB.

Booting the Board
=> run xa_boot
 * In u-boot, type:


 * Linux login
 * USER: root
 * PASS: {no password}