Bring up i.MX6 via JTAG

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bring up i.MX6 via JTAG

Bring up i.MX6 via JTAG

This document explains how to bring-up u-boot & Linux via JTAG

This procedure has been tested on:

  • i.MX6 Solo X Sabre SD
  • i.MX6UL EVK

Prerequistes:

  • Get the latest BSP for your board. This procedure was tested with L4.1.15.
  • Build the 'core-image-minimal' image to bring-up your board (Detailed steps here)
  • Optional- Build a meta-toolchain for your device

1.- Set board to boot from Serial dowloader mode or set it to boot from the SD card and remove the sd card

We basically want the board to stall in boot ROM to attach to the target.

2.- Connect JTAG probe and turn on the board

The device should stall trying to establish a connection to download an image, this will allow us to attach to the target.

3.- Load Device Configuration Data

In 'normal' boot sequence the boot ROM takes care of reading the DCD and configuring the device accordingly, but in this case we are skipping this sequence and we need to configure the device manually.

The script used by Lauterbach to parse and configure the device is called dcd_interpreter.cmm and can be found here. Search for the package for your specific device.

The DCD configuration for your board should be on your u-boot directory:

yocto_build_dir/tmp/work/<your board>imx6ulevk/u-boot-imx/<u-boot_version>2016.03-r0/git

under

board/freescale/<name of your board>mx6ul_14x14_evk/imximage.cfg

This file (imximage.cfg) contains all the data to bring up DRAM among other early configuration options.

4.- Load U-boot

If an SREC file of U-boot is not present build it (meta-toolchain installed required) the SREC file contains all the information required by the probe to load it and makes this process easier.

To build the SREC simply type:

make <your board defconfig>mx6ul_14x14_evk_defconfig  (all supported boards are found under u-boot_dir/configs)

make

If you cannot build an SREC or do not want to, you can use the u-boot.imx (located under yocto_build_dir/tmp/deploy/images/<your board name>/) or u-boot.bin files but you will need to figure out the start address and load address for these files, this can be done by examining the IVT on u-boot.imx (here is a useful document explaining the structure of the IVT).

Let U-boot run and you should see its output on the console I will try to boot from several sources but it will fail and show you the prompt.

Selection_045.png

5.- Create RAMDisk

After building the core-image-minimal you will have all the required files under

yocto_build_dir/tmp/deploy/images/<your board name>/

You will need:

  • zImage.bin - zImage--<Linux Version>--<your board>.bin
  • Device tree blob - zImage--<Linux Version>--<your board>.dtb
  • Root file system - core-image-minimal-<your board>.rootfs.ext4

We need to create a RAMDisk out of the root file system we now have, these are the steps to do so:

Compress current Root file system using gzip:

gzip core-image-minimal-<your board>.rootfs.ext4

If you want to keep the original file use:

gzip -c core-image-minimal-<your board>.rootfs.ext4 > core-image-minimal-<your board>.rootfs.ext4.gz

Create RAMDisk using mkimage:

mkimage -A arm -O linux -T ramdisk -C gzip -n core-image-minimal -d core-image-minimal-<your board>.rootfs.ext4.gz core-image-minimal-RAMDISK.rootfs.ext4.gz.u-boot

Output:

Image Name: core-image-minimal
Created: Tue May 23 11:28:55 2017
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 3017939 Bytes = 2947.21 kB = 2.88 MB
Load Address: 00000000
Entry Point: 00000000

Here are some details on mkimage usage

Usage: mkimage -l image
-l ==> list image header information
mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image
-A ==> set architecture to 'arch'
-O ==> set operating system to 'os'
-T ==> set image type to 'type'
-C ==> set compression type 'comp'
-a ==> set load address to 'addr' (hex)
-e ==> set entry point to 'ep' (hex)
-n ==> set image name to 'name'
-d ==> use image data from 'datafile'
-x ==> set XIP (execute in place)
mkimage [-D dtc_options] [-f fit-image.its|-F] fit-image
-D => set options for device tree compiler
-f => input filename for FIT source
Signing / verified boot not supported (CONFIG_FIT_SIGNATURE undefined)
mkimage -V ==> print version information and exit

6.- Modify U-boot's environment variables

Now we need to modify U-boot's bootargs as follows:

setenv bootargs console=${console},${baudrate} root=/dev/ram rw

We need to find out the addresses where u-boot will expect the zImage, the device tree and the initial RAMDisk, we can do it as follows:

=> printenv fdt_addr
fdt_addr=0x83000000
=> printenv initrd_addr
initrd_addr=0x83800000
=> printenv loadaddr
loadaddr=0x80800000

Where:

fdt_addr -> Device tree blob load address

initrd_addr -> RAMDisk load address

loadaddr -> zImage load address

7.- Load zImage, DTB and RAMDisk

Now we know where to load our zImage, device tree blob and RAMDisk, on Lauterbach this can be achieved by running the following commands:

Stop the target and execute:

data.load.binary zImage.bin 0x80800000

data.load.binary Your_device.dtb 0x83000000

data.load.binary core-image-minimal-RAMDISK.rootfs.ext4.gz.u-boot 0x83800000

Let the device run again and deattach from the device in lauterbach this is achieved by:

go

SYStem.mode.NoDebug

start the boot process on u-boot as follows:

bootz ${loadaddr} ${initrd_addr} ${fdt_addr}

You should now see the Linux kernel boot process on your terminal:

Selection_047.png

After the kernel boots you should see its prompt on your terminal:

Selection_046.png

Since we are running out of RAM there is no way for us to save u-boot's environment variables, but you can modify the source and compile u-boot with the new bootargs, by doing so you can create a Load script that loads all the binaries hits go and the boot process will continue automatically.

One way to achieve this is to modify the configuration file under U-boot_dir/include/configs/<your board>.h find the mfgtool_args and modify accordingly.

The images attached to this thread have been modified as mentioned.

Tags (1)
Attachments
Comments

Can you also add the Trace32 command to load uboot?

It is in the scripts:

; --------------------------------------------------------------------------------
; load u-boot
data.load.s3record u-boot.srec

; --------------------------------------------------------------------------------
; load zImage device tree blob and ramdisk
data.load.binary zImage 0x80800000
data.load.binary imx6sx.dtb 0x83000000
data.load.binary RAMDisk.u-boot 0x83800000

No ratings
Version history
Last update:
‎09-10-2020 03:04 AM
Updated by: