Microblaze


You may like to try run the Linux on Microblaze soft-CPU. It's possible to do even on low-cost FPGA-board - Xilinx Spartan3e Starter Kit (< $200).

Here some notes on how I did it.

1. You need project files for Xilinx XPS tool. These files are for ISE 11.5 (don't use newer versions - Xilinx discontinued support for Spartan3e in XPS, and automatic components upgrade did not work correctly when I tried it; Versions older that 11.5 don't have exact versions of components which I used, so you will need change project files + some of older versions of components are known to contain bugs);
Project contains microblaze core, DDR memory controller, Ethernet controller and some other not so interesting components :)
So, open system.xmp in XPS and create bitstream.

2. Get U-Boot from git.denx.de (http://git.denx.de/u-boot.git/), apply a patch (it changes microblaze_generic board definitions, config, and fixes minor problem with image crc calculation), and build it - make microblaze-generic_config; make dep; make.

U-Boot is not strictly necessary - linux kernel can be booted without it, but it adds some flexibility, e.g. it can load kernel and other files from network, serial line or do some other interesting things.

3. Get a kernel from git.xilinx.com (http://git.xilinx.com/?p=linux-xlnx.git;a=summary), apply a patch (it fixes some issues with xps_timer component), and build with this config (rename it to .config and place it in the root of kernel tree) - make ARCH=microblaze CROSS_COMPILE=mb-; Kernel is configured with initramfs support, so you may like to put some files to rootfs directory - e.g. build a busybox for microblaze;

4. Place U-Boot (u-boot.srec), kernel (linux.bin.ub) and compiled
dts (device tree - hardware config for kernel, compile it with dtc tool to - system.dtb) to flash with XPS tool to following flash offsets:
0x000000 - U-Boot
0x200000 - kernel
0xe00000 - dts

When flashing, put a check on "Create Flash Bootloader Application" checkbox once - XPS will create first stage bootloader app. And select "Mark to Initialize BRAMs" item in context menu for boot loader app in "Applications" tab - so it will be combined with FPGA configuration bitstream and immediately available when CPU goes out of reset.

5. Customize bootloader app - comment out #define VERBOSE in bootloader.c, and set address FLASH_IMAGE_BASEADDR to 0x85000000 in blconfig.h;

6. Connect devboard to PC by USB (JTAG) and serial cable, open serial terminal app.

7. Now just click "Download Bitstream" item in "Device Configuration" menu in XPS - all necessary operation will be performed for building and downloading configuration bitstream to Spartan chip (later you may like to place bitstream to plaform flash chip with Xilinx Impact tool).

8. And here you go - you should see in terminal window - U-Boot starting and linux kernel booting; Congratulations! :)

This page was last modified on 19 Feb 2014