MicroBlaze U-boot

The purpose of this page is to document the u-boot for Xilinx project for MicroBlaze. Xilinx provides a Git tree which includes u-boot to run on the Xilinx boards.

U-boot for MicroBlaze is now in the public Git tree from Xilinx at git://git.xilinx.com. The project repository is u-boot-xlnx and MicroBlaze is in the microblaze branch.

Project Goals

The goal for Xilinx with u-boot is to provide a minimal boot loader with which a Linux kernel can be loaded into ram over a network, written into flash and then booted assuming it's copied from flash into RAM. This means that there are a limited number of devices that are tested with u-boot.

The devices that are tested include UART Lite, UART 16550, NOR (linear) flash, EMAC Lite, LL TEMAC, and AXI EMAC with Axi DMA. The timer counter and interrupt controller also get used in these tests.

Other devices and features beyond these basic abilities are considered out of the project scope.

The State of the Project

U-boot for MicroBlaze has been tested on the SP605 board with the reference design available from xilinx.com at the following page:

http://www.xilinx.com/products/boards/s6embd/reference_designs.htm.

It should also run on other Xilinx boards easily using the xparameters.h from the EDK project. The default xparamters.h file provided is now up to date for the new 12.4 AXI system (Little Endian).

Little Endian Support

Little Endian support is now also in the microblaze branch.

Testing

Light testing has been done to TFTP kernels into memory using Emac Lite and AXI Emac. The Linux kernel has also been saved to flash, restored to RAM and booted successfully.

GNU Tools

As with Linux, a new set of tools are required to support u-boot with Little Endian. See the following page, MicroBlaze GNU Tools, for information about getting the GNU Tools for Microblaze to build the Little Endian Linux kernel and applications.

Known Issues

The data cache has to be off for Flash to work correctly on the SP605 system. This is because the h/w system has placed the flash memory in the cached region of the processor. The data cache is turned off in the microblaze-generic_config.h due to this fact, but it could be turned on for other systems without this issue or if not using flash.

The PHY management of the Ethernet drivers seems to not work real consistently with 10 Mbit. 100 Mbit and 1000 MBit seem to work better.

Timing seems to be off when not using a timer counter in the h/w system. Since Linux requires the timer counter this it not something that's a concern. This has been seen to cause early timeouts in an EMAC Lite system during a TFTP download.

Emac Lite systems at 50 MHz don't seem to work well when using TFTP. They can be made to work reasonably by setting the environment variable tftpblocksize to 128 such that transfers on the network are smaller. It appears the Emac Lite is dropping frames.

Resolved Issues

When Flash is configured into u-boot, the timer counter is not working correctly. Users might see lockups if operations which are incorrect are performed as they require the timer to time out (ping the wrong address). This problem was fixed on 12/21/10 and a commit was pushed out. The interrupt_disable() function was not returning the correct value and the CFI Flash functions called it.

Unknowns

There are many permutations of the h/w for MicroBlaze, such as barrel shifter, the multiplier, etc…. that have not been tested yet. The safest approach at this point is to stick to the settings that the SP605 reference uses.

Write back caching has not been tested.

AXI EMAC has only been tested with AXI DMA, not with any FIFO type configuration. There are no plans to support FIFO configuration. It has only been tested with Data Cache off at this point due to the issue with Flash and caching in the reference system.

Cloning The U-boot Tree

The following command will clone the u-boot-xlnx repository.

bash> git clone git://git.xilinx.com/u-boot-xlnx.git
bash> cd u-boot-xlnx

The following command will switch to the Microblaze branch.

bash> git checkout -b microblaze origin/microblaze

Details About Xilinx U-boot

  • The Xilinx boards are under board/xilinx directory in the u-boot-xlnx tree.
  • The xparameters.h file in the microblaze-generic directory controls the addresses of the devices for the drivers in u-boot and the devices that are available to u-boot. This file can be taken from a Xilinx EDK project.

Building and Loading U-boot On A Xilinx Board

Building Linux For U-boot

Specific details about building the kernel for MicroBlaze are contained at MicroBlaze Linux. The kernel build automatically creates an addional image, with the "ub" suffix that is a u-boot image.

Note: The executable, mkimage, is not part of the MicroBlaze GNU tools and is required for the kernel build to make a u-boot (ub) image. The mkimage executable is part of u-boot. Building u-boot as specified on this page will build the mkimage executable in the tools directory of u-boot. Add the path to mkimage to the path before building the Linux kernel.

This is a special image with a header that is u-boot specific. A simple image that is built for the kernel also has a device tree in the kernel image. An image that is not a simple image does not have any device tree blob in it such that the device tree must be downloaded with u-boot and then passed to the kernel.

Building U-boot

Assuming the tools are setup correctly with CROSS_COMPILE as specified at MicroBlaze GNU Tools.

In the u-boot directory, the following commands will build it for the SP605 board. The xparameters.h in the microblaze-generic board are setup for the SP605 board with the Xilinx reference design.

bash> make microblaze-generic_config
bash> make

The Ramdisk For Linux

Since the MicroBlaze Linux kernel uses an initramfs image, as described on the MicroBlaze Linux page, it is built into the kernel such that only a single image, the kernel, needs to be downloaded with u-boot.

Loading It With XMD

XMD% connect mb mdm
XMD% dow u-boot
XMD% run

You should get output on a terminal connected to the board at 9600 baud, 8 data bits, no parity.

Loading and Executing a Linux Kernel on Microblaze

Assuming u-boot is running on the Xilinx board, you have a TFTP server running, access to a kernel image that is ready for uboot loading (not a normal kernel image as u-boot requires a special header).

Setup the environment in u-boot to access your FTP server.

=> setenv ipaddr 172.16.40.227  (or your favorite IP address for testing)
=> setenv serverip 172.17.40.98 (or your favorite TFTP server for testing)

FTP the Linux kernel uImage from the FTP server into memory of the ML507.

=> tftp 0x50200000 <path to kernel image>/simpleImage.<device tree name>

Boot the Linux kernel, that has a ramdisk and device tree built into it's image, with the following command.

=> bootm 0x50200000

Ways To Make U-Boot Not Boot

Bad Kernel Configuration Without All CPU Features

U-boot's stock "microblaze-generic" board adds the following compiler flags: (see board/xilinx/microblaze-generic/config.mk)

PLATFORM_CPPFLAGS += -mno-xl-soft-mul
PLATFORM_CPPFLAGS += -mno-xl-soft-div
PLATFORM_CPPFLAGS += -mxl-barrel-shift

These need an appropriately configured MicroBlaze; the default settings are not sufficient. (Also, without C_ILL_OPCODE_EXCEPTION=1, it'll be tough to figure out what happened; illegal opcodes do not cause an exception otherwise.)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License