Ralph Siemsen | a5b9f95 | 2023-05-12 21:36:58 -0400 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | Renesas RZ/N1 |
| 4 | ============= |
| 5 | |
| 6 | Building |
| 7 | -------- |
| 8 | |
| 9 | This document describes how to build and flash U-Boot for the RZ/N1. |
| 10 | |
| 11 | U-Boot |
| 12 | ^^^^^^ |
| 13 | |
| 14 | Clone the U-Boot repository and build it as follows: |
| 15 | |
| 16 | .. code-block:: bash |
| 17 | |
| 18 | git clone --depth 1 https://source.denx.de/u-boot/u-boot.git |
| 19 | cd u-boot |
| 20 | make rzn1_snarc_defconfig |
| 21 | make CROSS_COMPILE=arm-linux-gnu- |
| 22 | |
| 23 | This produces `u-boot` which is an ELF executable, suitable for use with `gdb` |
| 24 | and JTAG debugging tools. |
| 25 | |
| 26 | It also produceds `u-boot.bin` which is a raw binary. |
| 27 | |
| 28 | Binman |
| 29 | ^^^^^^ |
| 30 | |
| 31 | The BootROM in the RZ/N1 SoC expects to find the boot image in SPKG format. |
| 32 | This format is documented in Chapter 7.4 of the RZ/N1 User Manual. |
| 33 | |
| 34 | The `binman` tool may be used to generate the SPKG format for booting. |
| 35 | See tools/binman/binman.rst for details on this tool and its pre-requisites. |
| 36 | |
| 37 | .. code-block:: bash |
| 38 | |
| 39 | binman -d arch/arm/dts/r9a06g032-rzn1-snarc.dtb -o <OUT> |
| 40 | |
| 41 | This will produce `u-boot.bin.spkg` in the specified <OUT> directory. It can |
| 42 | then be flashed into QSPI, NAND, or loaded via USB-DFU mode. |
| 43 | |
| 44 | SPKG image |
| 45 | ^^^^^^^^^^ |
| 46 | |
| 47 | Alternatively, the same SPKG image can be built by calling `mkimage` as follows: |
| 48 | |
| 49 | .. code-block:: bash |
| 50 | |
| 51 | tools/mkimage -n board/schneider/rzn1-snarc/spkgimage.cfg \ |
| 52 | -T spkgimage -a 0x20040000 -e 0x20040000 \ |
| 53 | -d u-boot.bin u-boot.bin.spkg |
| 54 | |
| 55 | This produces `u-boot.bin.spkg` which can be flashed into QSPI, NAND, or loaded |
| 56 | via USB-DFU mode. |
| 57 | |
| 58 | Take note of the load and execution address, which are encoded into the SPKG |
| 59 | headers. For development convenience, mkimage computes the execution offset |
| 60 | (part of the SPKG header) by subtracting the supplied load address from the |
| 61 | supplied execution address. |
| 62 | |
| 63 | Also note there are other parameters, notably ECC configuration in the case of |
| 64 | boot from NAND, specified in the `spkgimage.cfg` configuration file. |
| 65 | |
| 66 | Flashing |
| 67 | -------- |
| 68 | |
| 69 | The RZ/N1 is able to boot from QSPI, NAND, or via USB (DFU). In all cases the |
| 70 | on-board BootROM expects for the binary to be wrapped with a "SPKG" header. |
| 71 | |
| 72 | It is possible to recover a bricked unit by using the USB (DFU) boot mode. This |
| 73 | allows uploading U-Boot into the internal RAM. Thereafter U-Boot can be used to |
| 74 | program the QSPI and/or NAND, making use of U-Boot dfu mode. |
| 75 | |
| 76 | Otherwise the only other option for recovery is via JTAG. |