Building and Self-Updating U-Boot on the K70 System-On-Module Print


As explained in the other application notes available from the Emcraft web site, each K70 System-On-Module is shipped by Emcraft with U-Boot installed to the on-chip Flash of theĀ K70. When you power-on the SOM, U-Boot is immediatelly available on the K70 module as a primary firmware monitor.

The default U-Boot configuration is a capable Linux bootloader so typically our customers do not require re-building and re-installing U-Boot. However, certain projects still do require customizations to the U-Boot firmware, which implies making changes to the U-Boot code, rebuilding the U-Boot binary and then updating it on the K70 module.

The full U-Boot source for the K70 SOM is included in the software distribution available from the Emcraft web site. Refer to the u-boot/ sub-directory in the software distribution tree.

The key board specific-configuration files for the K70 SOM are as follows:

  • u-boot/include/configs/k70-som.h - U-Boot configuration;
  • u-boot/board/emcraft/k70-som/board.c - board-specific initialization code.

Run the folowing step-wise procedure in order to build U-Boot for the K70 SOM:

  • On the Linux development host, activate the cross-build environment as described in Installing and activating cross development environment:
  • -bash-3.2$ . ./ACTIVATE.sh

  • Change to the U-Boot top directory:
  • -bash-3.2$ cd u-boot

  • Configure U-Boot for the K70 SOM:
  • -bash-3.2$ make distclean
    -bash-3.2$ make k70-som_config

  • Build the U-Boot binary:
  • -bash-3.2$ make -s

The resultant image will be u-boot.bin in the U-Boot top directory (i.e. the same directory where you have run the make command from).

The U-Boot command line interface provides a special command that can be used to self-upgrade the U-Boot image on the running target. Before you can run this command, you need to load an upgrade U-Boot binary to the target. Typically, you download images from a TFTP host (refer to Loading Linux images via Ethernet and TFTP).

The following session is an illustration of the U-Boot self-upgrade procedure:

  • From the U-Boot command line interface, download the upgrade U-Boot image to RAM:
  • K70-SOM> tftp psl/k70/u-boot.bin
    Using FEC0 device
    TFTP from server 172.17.0.1; our IP address is 172.17.6.46
    Filename 'psl/k70/u-boot.bin'.
    Load address: 0x8007fc0
    Loading: #########
    done
    Bytes transferred = 121244 (1d99c hex)
    K70-SOM>

  • Run the U-Boot self-upgrade command to install the loaded upgrade image to the on-chip Flash. Note that the command updates the U-Boot image in the on-chip Flash and then immediatelly performs the reboot sequence to boot the newly installed U-Boot image:
  • K70-SOM> cptf 0 ${loadaddr} ${filesize} 1
    cptf: Updating eNVM. Please wait ...

    U-Boot 2010.03-00085 (Aug 14 2015 - 18:39:53)

    CPU : Freescale Kinetis series (Cortex-M4)
    Freqs: SYSTICK=150MHz,CCLK=150MHz,PCLK=75MHz,MACCLK=50MHz
    Board: K70-SOM Rev 1.A, www.emcraft.com
    DRAM: 64 MB
    NAND: 128 MiB
    Bad block table found at page 65472, version 0x01
    Bad block table found at page 65408, version 0x01
    In: serial
    Out: serial
    Err: serial
    Net: FEC0
    Hit any key to stop autoboot: 0
    K70-SOM>

Note that the self-upgrade sequence is a dangerous operation. You must be sure that you load and install a functional U-Boot binary, which is always a tricky thing when you develop customisations to U-Boot. Make sure you have a JTAG programmer handy that you will be able to use in order to re-install the release U-Boot binary in case you have programmed a wrong U-Boot image to the on-chip Flash. The latest U-Boot binary is always available fromĀ K70 System-On-Module Release Materials.