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 & 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>
Links
- http://lists.denx.de/pipermail/u-boot/ - new web archiv
- http://sourceforge.net/mailarchive/forum.php?forum_name=u-boot-users - old web archive
What I would like to test?
- Add heartbeat function for U-BOOT
- Support for splash screen logo
Download
Microblaze
- recommended repository http://git.denx.de/?p=u-boot/u-boot-microblaze.git;a=summary - with latest changes
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
- Mainline repository. GITWEB http://git.denx.de/?p=u-boot.git;a=summary
# git clone git://www.denx.de/git/u-boot.git
- Microblaze mainline repository - this repository is used for custodian work - there could be a latest changes in Microblaze part. GITWEB http://git.denx.de/?p=u-boot/u-boot-microblaze.git;a=summary
# 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 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
- use first stage bootloader like FS-BOOT (http://developer.petalogix.com)
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/
Use FIT with U-BOOT
You need ITS file for specifying image structure
or booting second configuration by:
bootm <addr>#conf@2
Look at U-boot documentation doc/uImage.FIT
U-BOOT and ROMFS support
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
- mainline git clone git:www.denx.de/git/u-boot.git * testing branch - git clone git:www.denx.de/git/u-boot-microblaze.git
HW core | Driver | State |
---|---|---|
Emac | drivers/net/xilinx_emac.c | in mainline |
Emaclite | drivers/net/xilinx_emaclite.c | in mainline |
LL-TEMAC | drivers/net/xilinx_ll_temac.c | in internal repository |
SystemACE | drivers/systemace.c | in mainline |
Uartlite | drivers/serial/xuartlite.c | in mainline |
Uart16550 | drivers/…/ | in mainline |
FSL | common/cmd_mfsl.c | in mainline |
U-BOOT script image
$ mkimage -T script -C none -n 'Demo Script File' -d setenv-commands setenv.img
U-BOOT list and disclamers
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>