Running U-Boot Print

 

As explained in Installing U-Boot to the NXP i.MX RT1050 EVK board, you have to install U-Boot to the SD Card of the NXP i.MX RT1050 EVK board in order to run Linux (uClinux) on the NXP i.MX RT1050 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 RT1050 microcontrollers, U‑Boot is relocated to the internal i.MX ITCM 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 SW5, SW6, SW7 switches on the NXP i.MX RT1050 EVK board.

When SRC_BOOT_MODExx pins select the SD Card as a source boot, then the i.MX RT1050 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 RT1050 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 Device Configuration Data, DCD. The u-boot-dtb.imx file is generated automatically during U-Boot build process basing on the information from the board/freescale/mxrt105x-evk/imximage.cfg file, which includes command strings to be compiled into DTB (configuration which the ROM bootloader must apply before booting U-Boot binary). The CONFIG_SYS_TEXT_BASE option specifies the U-Boot entry point address.

Initially, U-Boot starts from ITCM, initializes SDRAM, relocates itself to the end of SDRAM and continues to execute from there.

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

U-Boot 2017.09-rc1-gdf312544d6 (Oct 13 2017 - 23:16:48 +0300)

CPU: i.MX RT105x at 600MHz
Model: NXP i.RT1050 EVK
DRAM: 32 MiB
MMC: FSL_SDHC: 0
reading uboot.env
Video: 480x272x24
In: [email protected]
Out: [email protected]
Err: [email protected]
Net: eth0: [email protected]
reading splash-rt1050-series_24.bmp
reading mxrt105x-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 RT1050 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=mxrt105x-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-rt1050-series_24.bmp
    ssh=yes
    [email protected]
    [email protected]
    [email protected]
    tftpdir=imxrt105x/
    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