Running U-Boot Print

 

As explained in Installing U-Boot to the NXP i.MX RT1060 EVK board, you have to install U-Boot to the SD Card of the NXP i.MX RT1060 EVK board in order to run Linux (uClinux) on the NXP i.MX RT1060 EVK board. U-Boot runs as the primary firmware from the SD Card on each power-on / reset.

U-Boot is probably the most popular firmware monitor for Linux. It is developed and maintained by DENX Software Engineering (www.denx.de). If you need detailed information on any aspects of U‑Boot operation, DENX publishes extensive U‑Boot user documentation at their web site.

On the i.MX RT1060 microcontrollers, U-Boot is relocated to the internal i.MX OCRAM memory from SD Card with the built-in i.MX ROM bootloader. Boot mode is specified with the states of the SRC_BOOT_MODExx pins, which are configured with the SW7 switches on the NXP i.MX RT1060 EVK board.

When SRC_BOOT_MODExx pins select the SD Card as a source boot, then the i.MX RT1060 ROM bootloader searches for the *.imx image at 0x400 offset from the start of the SD Card device (see Expansion device structures layout in the i.MX RT1060 UM). The *.imx image must have the special format, and (beside the u- boot.bin itself) should contain information necessary for the ROM bootloader to relocate and pass control to U-Boot correctly. This information is called Firmware Configuration Block, FCB. The u-boot-dtb.imx file is generated automatically during U-Boot build process basing on the information from the board/freescale/mxrt106x-evk/imximage.cfg file. The CONFIG_SYS_TEXT_BASE option specifies the U-Boot entry point address.

Initially, U-Boot starts from OCRAM, initializes SDRAM, relocates itself to the end of SDRAM and continues to execute from there. Volatile data (stack, variables, dynamic pool) are maintained in the external SDRAM memory as well.

As soon as the NXP i.MX RT1060 EVK board is powered on or reset, the i.MX RT1060 proceeds to boot the U‑Boot firmware from the SD Card printing the following output to the serial console:

U-Boot 2017.09-imxrt-2.5.2 (Nov 22 2018 - 23:16:48 +0300)

CPU: i.MX RT106x at 600MHz
Model: NXP i.RT1060 EVK
DRAM: 32 MiB
MMC: FSL_SDHC: 0
reading uboot.env
Video: 480x272x24
In: serial@40184000
Out: serial@40184000
Err: serial@40184000
Net: eth0: ethernet@402D8000
reading splash-rt1060-series_24.bmp
reading mxrt106x-evk.ini
Hit any key to stop autoboot: 0
reading rootfs.uImage
=>

If you hit any key on the serial console before the number of seconds defined by the U-Boot bootdelay variable has elapsed, you will enter the U-Boot interactive command monitor. From the command monitor you can run U‑Boot commands to examine memory, load an image from Ethernet, boot Linux from a loaded image or perform any other action supported by U-Boot.

U-Boot makes use of the so-called environment variables to define various aspects of the target functionality. On the NXP i.MX RT1060 EVK board, the U-Boot environment is stored in the uboot.env file on the FAT partition of the SD Card, and is persistent across power or reset cycles. Parameters defined by the U-Boot environment variables include: target IP address, target MAC address, location in RAM where a Linux bootable image will be loaded, and many others.

To manipulate the U-Boot environment the following commands are used:

  • printenv <var> - print the value of the variable <var>. Without arguments, prints all environment variables:
  • =>printenv
    addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off
    baudrate=115200
    bootargs=console=ttyLP0,115200 consoleblank=0 ignore_loglevel
    bootcmd=run mmcboot
    bootdelay=0
    ethaddr=aa:bb:cc:dd:ee:f0
    ethprime=FEC
    fdtcontroladdr=81e7e7a0
    filesize=0
    gui=/crankdemo/gui.sh
    image=rootfs.uImage
    ini=mxrt106x-evk.ini
    ipaddr=192.168.1.101
    loadaddr=0x80007fc0
    mmc_update_kernel=tftp ${tftpdir}${image} && fatwrite mmc 0 ${loadaddr} ${image} ${filesize}
    mmc_update_splash=tftp ${tftpdir}${splash} && fatwrite mmc 0 ${loadaddr} ${splash} ${filesize}
    mmc_update_uboot=tftp ${tftpdir}${uboot} && setexpr tmp ${filesize} / 0x200 && setexpr tmp ${tmp} + 1 && mmc write ${loadaddr} 2 ${tmp}
    mmcboot=fatload mmc 0 ${loadaddr} ${image} && run addip && bootm ${loadaddr}
    netboot=tftp ${tftpdir}${image} && run addip; bootm ${loadaddr}
    netmask=255.255.0.0
    preboot=fatload mmc 0 ${loadaddr} ${splash} && bmp display ${loadaddr};fatexec mmc 0 ${ini}
    serverip=172.17.0.1
    splash=splash-rt1060-series_24.bmp
    ssh=yes
    stderr=serial@40184000
    stdin=serial@40184000
    stdout=serial@40184000
    tftpdir=imxrt106x/
    uboot=u-boot-dtb.imx

    videomode=video=ctfb:x:480,y:272,depth:24,pclk:9300000,le:4,ri:8,up:4,
    lo:8,hs:41,vs:10,sync:0,vmode:0

    Environment size: 1304/8188 bytes

  • setenv <var><val> - set the variable <var> to the value <val>:
  • => setenv image my.rootfs.uImage
    =>

  • saveenv - save the up-to-date U-Boot environment, possibly updated using setenv commands, into the SD Card. Running saveenv makes sure that any updates you have made to the U-Boot environment are persistent across power cycles and resets.
  • => saveenv
    Saving Environment to FAT...
    writing uboot.env
    done