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.

Links

What I would like to test?

  • Multiple serial interface for U-BOOT
  • Add heartbeat function for U-BOOT
  • LL-temac driver works with s3e or ml505 for sgdma and fifo mode - phylib is necessary for easy usage

Microblaze

Rules

  • FLASH base address must be higher than main memory - BSP takes care about

Step by Step manual

  • Download Toolchain - I personally use petalogix toolchain - latest petalinux distribution with microblaze-uclinux- toolchain
# cd /opt/petalogix/
# . setting.sh

* Download latest U-BOOT code

# git clone git://www.denx.de/git/u-boot.git
# git clone git://www.denx.de/git/u-boot-microblaze.git
  • Download latest U-BOOT edk generator
  • Use edk_project_repository folder and point there EDK project (check *.xmp - ModuleSearchPath)
    • or copy BSP to bsp folder in project (only folders with version name e.g.: top_v1_00_b)
  • You have two choices how to build U-BOOT bsp
    • Through TOP bsp (recommended because you don't have to do changes for others bsp and you don't have any problem with FS-BOOT building)
    • U-BOOT bsp directly

Part of MSS file for TOP bsp

Part of MSS file for U-BOOT bsp

  • Run in EDK Generate Libraries and BSPs
    • Every problems are reported in log
  • In microblaze_0/libsrc you can find generated folders with config files
  • Go to uboot_v$_$$_$ folder and there are two files
    • config.mk
    • xparameters.h
  • Copy those files to u-boot board folder in U-BOOT source tree (board/xilinx/ml401 or board/xilinx/xupv2p or later to board/mb_first/)
  • You can use prepared two folders for Microblaze boards
    • Xupv2p is configured without FLASH memory.
    • ML401 is configured with FLASH memory.

Building U-BOOT

  • setting Linux variables
# export ARCH=microblaze
# export CROSS_COMPILE=microblaze-uclinux-
  • choose specific board setting

# make ml401_config (or make xupv2p_config)

# make
  • Downloading u-boot to board
    • XMD: connect mb mdm; dow u-boot; run
    • generate ACE file from bitstream & u-boot: # xmd -tcl genace.tcl -jprog -hw implementation/download.bit -elf uboot.elf -ace uboot.ace (For custom board use following description)

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

  • copy board/xilinx/ml401 to board/mb_first
  • go to board/mb_first and rename ml401.c to mb_first.c (the name must be the same as is name of board)
  • copy include/configs/ml401.h to include/configs/mb_first.h
  • change include file (#include ”../board/xilinx/ml401/xparameters.h”) to #include ”../board/mb_first/xparameters.h”
    • you can change others parameters too. For example #define CONFIG_ML401 1 to #define CONFIG_MB_FIRST 1 and others
  • edit top level Makefile and add your new label for your board (tabs are important - look at ml401 board)
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
  • Then you can call: make mb_first_config; make
[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

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 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

Download U-BOOT version

Latest versions are on http://git.monstr.eu/git/gitweb.cgi

VersionDownloadDescription
edk_user_repositoryDownload (25.67 KiB)All BSP together - old device-tree bsp

 
uboot/uboot.txt · Last modified: 2010/07/06 09:43 by monstr
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki