Table of Contents

U-BOOT for Xilinx FPGA

DONATE Donations are appreciated and gratefully received! They assist in the running cost and future developments of U-BOOT and Linux for Microblaze CPU.

<html>

<form action=“https://www.paypal.com/cgi-bin/webscr” method=“post”> <input type=“hidden” name=“cmd” value=“_donations”> <input type=“hidden” name=“business” value=“monstr@monstr.eu”> <input type=“hidden” name=“item_name” value=“Linux &amp; U-BOOT Microblaze maintaining”> <input type=“hidden” name=“page_style” value=“PayPal”> <input type=“hidden” name=“no_shipping” value=“0”> <input type=“hidden” name=“return” value=“http://www.monstr.eu/wiki/doku.php?id=paypal:thanks”> <input type=“hidden” name=“logo_custom” value=“https://www.paypal.com/en_US/i/btn/x-click-but04.gif”> <input type=“hidden” name=“no_note” value=“1”> <input type=“hidden” name=“currency_code” value=“EUR”> <input type=“hidden” name=“tax” value=“0”> <input type=“hidden” name=“bn” value=“PP-DonationsBF”> <input type=“image” src=“https://www.paypal.com/en_US/i/btn/x-click-but04.gif” border=“0” name=“submit” alt=“PayPal - The safer, easier way to pay online!”> <img alt=“” border=“0” src=“https://www.paypal.com/en_US/i/scr/pixel.gif” width=“1” height=“1”> </form>

</html>

What I would like to test?

Download

Latest u-boot BSP

Microblaze

Rules

Step by Step manual

# cd /opt/petalogix/
# . setting.sh
# git clone git://www.denx.de/git/u-boot.git
# git clone git://www.denx.de/git/u-boot-microblaze.git

Part of MSS file for TOP bsp

Part of MSS file for U-BOOT bsp

Building U-BOOT

# export ARCH=microblaze
# export CROSS_COMPILE=microblaze-uclinux-

# make ml401_config (or make xupv2p_config)

# make

board user

 configdevice devicenr 1 idcode 0x5026093 irlength 8 partname XC18V04
 configdevice devicenr 2 idcode 0x123e093 irlength 10 partname XC2VP4
 debugdevice devicenr 2 cpunr 1

Creating own board (called mb_first) in U-BOOT

mb_first_config:	unconfig
	@mkdir -p $(obj)include
	@echo "#define CONFIG_MB_FISRT 1" > $(obj)include/config.h
	@$(MKCONFIG) -a $(@:_config=) microblaze microblaze mb_first
[monstr@monstr.eu u-boot-denx-de]$ make mb_first_config
Configuring for mb_first board...
[monstr@monstr.eu u-boot-denx-de]$ make

...
                      -Map u-boot.map -o u-boot
microblaze-uclinux-objcopy -O srec u-boot u-boot.srec
microblaze-uclinux-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin

Bad flash sector size

If you can't see U-BOOT prompt and just see this line, you should check your board config file and sector size.

Warning - bad CRC, using default environment

U-BOOT failed

Here is the example where you can't use u-boot. It doesn't matter which U-BOOT version is it. In this case run simple Xilinx test memory because this mean that you have problem with some access to main memory. In some cases you should look at size of cache.

SDRAM :
      Enabling caches :
              Icache:OK
                              aacc::OO                UUooooSStttt::8dfc0000
              MMllooSStttt::ffff0000

              BBrrddnnffSStttt::ffffdddd

              BBtt  rraattee  SSrrttxxff66dd0
FLASH: 

-- Entering main() --
Starting MemoryTest for DDR_SDRAM:
  Running 32-bit test...PASSED!
  Running 16-bit test...FAILED!
  Running 8-bit test...FAILED!
-- Exiting main() --

Smart U-BOOT building

Use output dir for storing temporary files

 make O=/tmp/build distclean
 make O=/tmp/build xupv2p_config
 make O=/tmp/build all
 Note that if the 'O=output/dir' option is used then it must be used for all invocations of make.

You can specify shell variable

 export BUILD_DIR=/tmp/build
 make distclean
 make xupv2p_config
 make all

U-BOOT with FS-BOOT

Create stub with PetaLinux tools for interaction with FS-BOOT

# petalinux-reloc-blob -l 0x90000000 -i u-boot -o /tftpboot/u-boot-s
Payload load address:0x8c000000
Payload size: 165352
#cp u-boot-s.bin /tftpboot/

Loading u-boot-s.bin with tftp and copy to flash memory

Use FIT with U-BOOT

You need ITS file for specifying image structure

Creating multi FIS image

Booting kernel with FIS

or booting second configuration by:

bootm <addr>#conf@2

Look at U-boot documentation doc/uImage.FIT

U-BOOT and ROMFS support

This is the old approach which you can find in oldest U-BOOT repo. Currently romfs use special commands.

Creating ACE file from Command line

You should have sourced Xilinx ISE and EDK tools. Copy generated u-boot file from u-boot folder. Run this command from HW project folder for correct pointing to system.bit.

xmd -tcl genace.tcl -board ml505 -jprog -hw implementation/system.bit -elf u-boot -target mdm -ace ml505.ace

Supported peripherals

HW coreDriverState
Emacdrivers/net/xilinx_emac.cin mainline
Emaclitedrivers/net/xilinx_emaclite.cin mainline
LL-TEMACdrivers/net/xilinx_ll_temac.cin internal repository
SystemACEdrivers/systemace.cin mainline
Uartlitedrivers/serial/xuartlite.cin mainline
Uart16550drivers/…/in mainline
FSLcommon/cmd_mfsl.cin mainline

U-BOOT script image

$ mkimage -T script -C none -n 'Demo Script File' -d setenv-commands setenv.img

U-BOOT list and disclamers

Comment from u-boot mailing list

PreBOOT

A smart way how to show log on first boot with cleaning

The part of config file

#define CONFIG_PREBOOT \
"echo ======================NOTICE============================;"    \
"echo This is the first time that you boot up this board. You are;"  \
"echo required to set a valid MAC address for your Ethernet interface.;"\
"echo MAKE SURE YOUR MAC ADDRESS IS CORRECTLY ENTERED!;"      \
"echo You can always change it by using setenv ethaddr {MAC address};" \
"echo to change it again.;"                                         \
"askenv ethaddr 'Please enter your MAC address:' 17;"               \
"setenv preboot;"                                                   \
"printenv ethaddr;" \
"saveenv;"

Logbuffer

U-BOOT support logbuffer as is used in linux kernel - CONFIG_LOGBUFFER

EDK toolchain problem

There could be an issue if you use EDK toolchain.

make[1]: Leaving directory `/tmp/7/board/xilinx/microblaze-generic'
UNDEF_SYM=`mb-objdump -x board/xilinx/microblaze-generic/libmicroblaze-generic.a lib_generic/libgeneric.a lib_generic/lzma/liblzma.a lib_generic/lzo/liblzo.a cpu/microblaze/libmicroblaze.a lib_microblaze/libmicroblaze.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/usb/phy/libusb_phy.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a libfdt/libfdt.a api/libapi.a post/libpost.a | sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`; cd /tmp/7 && mb-ld -Bstatic -T u-boot.lds  -Ttext 0x29000000 $UNDEF_SYM cpu/microblaze/start.o --start-group lib_generic/libgeneric.a lib_generic/lzma/liblzma.a lib_generic/lzo/liblzo.a cpu/microblaze/libmicroblaze.a lib_microblaze/libmicroblaze.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/usb/phy/libusb_phy.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a libfdt/libfdt.a api/libapi.a post/libpost.a board/xilinx/microblaze-generic/libmicroblaze-generic.a --end-group -L /mnt/projects/Xilinx/11.4/EDK/gnu/microblaze/lin/bin/../lib/gcc/microblaze-xilinx-elf/4.1.1/bs/m -lgcc -Map u-boot.map -o u-boot
mb-ld:u-boot.lds:1: syntax error
make: *** [u-boot] Error 1

Apply this patch to fix the problem.

 
diff --git a/board/xilinx/microblaze-generic/u-boot.lds b/board/xilinx/microblaze-generic/u-boot.lds
index c20c6dd..afdea55 100644
--- a/board/xilinx/microblaze-generic/u-boot.lds
+++ b/board/xilinx/microblaze-generic/u-boot.lds
@@ -22,6 +22,8 @@
  * MA 02111-1307 USA
  */
 
+#undef microblaze
+
 OUTPUT_ARCH(microblaze)
 ENTRY(_start)

Netconsole

http://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:netconsole

set ncip 192.168.0.101; set stdin nc; set stdout nc; set stderr nc

#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1

setenv nc 'setenv stdin nc;setenv stdout nc'
setenv serial 'setenv stdout serial;setenv stdin serial'
setenv ncip 192.168.0.101
run nc
run nc

fpga-load

http://forums.xilinx.com/t5/Embedded-Linux/zynq-u-boot-fpga-command/td-p/262414

zynq-uboot> fatload mmc 0 0 fpga.bin                                            
reading fpga.bin                                                                
                                                                                
4045564 bytes read                                                              
zynq-uboot> fpga load 0 0 0x3dbafc                                              
Wrong parameters for FPGA request                                               
fpga - loadable FPGA image support                                              
                                                                                
zynq-uboot> fatload mmc 0 0x1000000 fpga.bin                                    
reading fpga.bin                                                                
                                                                                
4045564 bytes read                                                              
zynq-uboot> fpga info 0                                                         
Xilinx Device                                                                   
Descriptor @ 0x3ffb89c4                                                         
Family:         Zynq PL                                                         
Interface type: Device configuration interface (Zynq)                           
Device Size:    4045564 bytes                                                   
Cookie:         0x0 (0)                                                         
No Device Function Table.                                                       
zynq-uboot> fpga load 0 0x1000000 0x3dbafc                                      
zynq-uboot>