Version 5 (modified by Chris Johns, on 02/08/17 at 10:35:26) (diff) |
---|
Zedboard
Table of Contents
The page details how to run RTEMS on a Zedboard and Microzed board.
Boot Mode
RTEMS can be run on the Zedboard and the Microzed board a number of ways. You select the boot mode you need based on what you are wanting to do. For example, if you are developer writing an RTEMS application you may use JTAG, while production may boot from QSPI flash.
JTAG Debugging
JTAG can used to reset and initialise the hardware, load software and debug applications. There are a range of JTAG debugging solutions with varying prices available that integrate with RTEMS.
JTAG lets you debug low level software such as boot loaders, exception handlers as well as support hardware watch points to help find difficult run time bugs.
Lauterbach
The Lauterbach debugger with trace support works with the Zedboard and Microzed. The Lauterbach support a range of real-time trace options.
Flyswatter2
The Flyswatter2 pod from Tincan Tools combines with OpenOCD to provide an effective JTAG debugging solutions. Trace is not supported.
PS7 Initialisation
The Xilinx tools generate a set of files based on the System Z configuration call ps7_init
. The Xilinx SDK embeds the ps7_init.c
file in the First Stage Boot Loader (FSBL) to configure the Zynq hardware. Xilinx also creates a TCL version called ps7_init.tcl
and it is used by Xilinx's XDM software to initialise the hardware before loading code.
The PS7 Initialisation page details how to do this.
Zedboard Jumpers
TDB
Microzed Jumpers
The jumpers to boot in JTAG mode are:
JP3 | JP2 | JP1 |
---|---|---|
X | X | X |
X | X | X |
QSPI Flash
TDB
SD Card
The SD card mode boots from a DOSFS MBR partition. The Zynq's ROM code searches for the file BOOT.BIN
in the root directory of a DOSFS partition and loads it. The BOOT.BIN
file conforms the FSBL format documented in the Zynq TRM.
Be-careful updating the SD card on a host operating system that supports Long File Names (LNF). If you happen to rename a file that is a LFN format name to BOOT.BIN
the directory entry in the root directory on the DOSFS may still be in the LFN format and the Zynq'c ROM code will not see it.
Microzed Jumpers
The jumpers to boot in QSPI flash mode are:
JP3 | JP2 | JP1 |
---|---|---|
X | ||
X | X | X |
X | X |
U-Boot
The U-Boot boot loader supports the Zed and Microzed boards.
I do not used the Xilinx version of U-Boot they provide on Github. I also do not use any binary builds available for download.
Building U-Boot
To build U-Boot for an ARM processor you need an ARM cross-compiler. The following list what you need to install for your host.
Host OS | Commands |
---|---|
FreeBSD | $ pkg install arm-none-eabi-binutils arm-none-eabi-gcc
|
Please add your host if not present.
Get the source code from the project's git repository:
$ git clone git://git.denx.de/u-boot.git
My last working build is b615267633996a9410a88b54a55965d8b021f6f8
.
Change into the u-boot
directory and run the following script mk-zed
:
$ cat ../mk-zed #! /bin/sh gmake CROSS_COMPILE=arm-none-eabi- distclean gmake CROSS_COMPILE=arm-none-eabi- zynq_zed_config gmake CROSS_COMPILE=arm-none-eabi- HOSTCC=cc
I use gmake
because make
on FreeBSD is a BSD make
. The HOSTCC
is added to the U-Boot build command line because the FreeBSD's default compiler which is clang
and U-Boot default to gcc
.
The files created you need to use are:
File | Description |
---|---|
spl/boot.bin | U-Boot's FSBL |
arch/arm/dts/zynq-zed.dtb | Zed board device tree blob |
arch/arm/dts/zynq-microzed.dtb | Microzed board device tree blob |
u-boot.img | U-Boot executable loaded by the U-Boot FSBL |
U-Boot Environment
TDB
SD Card Set Up
Create a MBR DOSFS partition on an SD card with enough space to hold the files needed. The card I have:
# df -h /dev/da0s1 Filesystem Size Used Avail Capacity Mounted on /dev/da0s1 64M 1.3M 63M 2% /mnt/sd
Copy the files:
# cp spl/boot.bin /mnt/sd/boot.bin # cp arch/arm/dts/zynq-microzed.dtb /mnt/sd/system.dtb # cp u-boot.img /mnt/sd/u-boot.img
RTEMS Application
TDB
$ cat rtems-zynq-mkimg #! /bin/sh OBJCOPY_FOR_TARGET=arm-rtems4.12-objcopy OBJCOPY="$OBJCOPY_FOR_TARGET" EXE_NAME=$1 START_ADDR=0x00104000 ENTRY_ADDR=0x00104000 ${OBJCOPY} -R -S --strip-debug -O binary "$EXE_NAME" "$EXE_NAME.bin" || exit 1 cat "$EXE_NAME.bin" | gzip -9 >"$EXE_NAME.gz" mkimage \ -A arm -O rtems -T kernel -a $START_ADDR -e $ENTRY_ADDR -n "RTEMS" \ -d "$EXE_NAME.gz" "$EXE_NAME.img"