Sei sulla pagina 1di 10

PortingLinuxtoaXilinxMicroblazeProcessorontheVirtex6 ML605FPGAEvaluationBoard

RobinCoxe CloseHaulCircuits,LLC(www.closehaul.com/circuits) 31August2011(revised7December2011)

Prerequisites:
XilinxISE/EDK/SDKversion13.2(eitherLinuxorWindows).IfinstallingtheXilinxtools onaLinuxmachine,pleaserefertotheAppendixforworkaroundstopotential installationissues. Linuxworkstation(IusedanetbookrunningUbuntu10.10)withgitinstalled XilinxML605Virtex6FPGAevaluationboardand12Vpoweradapter Two(2)USBAtoUSBminiBcables

Procedure:
1) DownloadtheAXI4interconnectbasedML605referencedesignforISEDesignSuite13.2 fromhttp://www.xilinx.com/products/boards/v6embd/reference_designs.htm(You'llneed aXilinxaccountandwillbeaskedtoagreetoalicensepriortodownloading.) 2) ExtracttheISEprojecttoadirectoryofyourchoice. 3)OpenuptheprojectinXilinxISEbydoubleclickingon:
<ise_project_dir>/ug668_13_2_AXI4_PRODN/ML605_Embedded_Kit/ML605_System/HW/ise_proj.xise

Page1of10

4)FireupXPSbydoubleclickingonsystem.xmp.

5)ClickontheProjecttab. 6)ClickontheBusInterfacestabanddoubleclickonmicroblaze_0. 7)IntheXPSCoreConfigmicroblaze_0window,selectLinuxwithMMU(clickonTuxthe Penguin)andthenclickNext. 8)MakesuretheBarrelShifterisenabled,enabletheExtendedFPU,selectaMUL64integer multiplier,enabletheIntegerDivider,theAdditionalMachineStatusRegisterInstructions,and thePatternComparator.ClickOK.

Page2of10

9)GobacktotheISEProjectNavigatorwindow.RightclickonExportHardwareDesigntoSDK withBitstreamandselectRunfromthepulldown.Gogetacupofcoffee.

10)Eventually,SDKwilllaunch.ThenextstepsinvolvethecreationoftheXilinxDeviceTree. 11)Followthedirectionsathttp://xilinx.wikidot.com/devicetreegenerator. Page3of10

12)SetthebootargsfieldinBoardSupportPackageSettingsto: console=ttyS0root=/dev/ramip=on (Inthisparticularconfiguration,theLinuxfilesystemwillbestoredinvolatileRAM). 13)EnterRS232_Uart_1astheconsoledevice.

14)InthemainSDKwindow,navigatetoProject>BuildAll. 15)Navigateto<SDK_workdir>/devicetree_bsp_0/microblaze_0/libsrc/devicetree_v0_00_x andlocatethefilexilinx.dts.

Page4of10

16)ThenextstepsinvolvecrosscompilationoftheLinuxkernelfortheMicroblazeonaLinux workstation.FollowthedirectionsatthebottomofthefollowingpagetoinstalltheLittle EndianToolsandRamdiskImage:http://xilinx.wikidot.com/mbgnutools 17)Notethat<dirwheretoolsareuntarred>MUSTbeginwithaforwardslashorthecross compilerwillgetconfused.(e.g.,/home/yourhomedir/microblaze,NOT home/yourhomedir/microblaze).OnUbuntu,youcanaddthePATHandCROSS_COMPILE settingstoyour.bashrcfile.Exityourterminalwindowandopenupanewoneforthesettings totake. 18)GettheLinuxkernelfromtheXilinxgitarchive: gitclonegit://git.xilinx.com/linux2.6xlnx.gitmaster 19)ReferringbacktoStep#15,copytheXilinxDeviceTreefilegeneratedbySDK(xilinx.dts)to <kernel_dir>/arch/microblaze/boot/dts/xilinx.dts. 20)CopytheLinuxfilesystemgziparchivedownloadedinStep#16 (initramfs_minimal_le.cpio.gz)to<kernel_dir>. 21)NowfortheconfigurationofthekernelMakesureyou'rein<kernel_dir>.Startwiththe defaultkernelconfigurationfileprovidedwiththekernelfortheSP605AXIreferencedesign. >makeARCH=microblazesp605_le_defconfig 22)TocustomizethekernelforusewiththeMicroblazecoredefinedinXPSontheVirtex6 FPGAontheML605board: >makeARCH=microblazemenuconfig 23)GotoPlatformOptions.MakesuretheDefinitionsforMICROBLAZE0looklikethispicture:

24)Buildthekernel: >makeARCH=microblazesimpleImage.xilinx 25)Getanothercupofcoffee. 26)Findthekernelimage<kernel_dir>/arch/microblaze/boot/simpleImage.xilinxandcopyitto someplaceconvenient. 27)FindtheFPGAbitstream <ise_project_dir>/ug668_13_2_AXI4_PRODN/ML605_Embedded_Kit/ML605_System/HW/ise_top.bitand copyitintothesamedirectoryasthekernelimage. 28)StartXilinxSDKandLaunchaXilinxshell:XilinxTools>LaunchShell.YoucanexitSDKif you'dlike. 29)IntheXilinxshell,navigatetothelocationwheretheFPGAbitstreamandtheLinuxKernel imagelive. Page5of10

30)Makesurethe2USBcablesareconnectedfromthehostPCtothefrontpaneloftheML605 boardandpowerontheML605board. 31)Openupaserialconsoleconnection.ForWindowsmachines,followthedirectionsonp.11 15ofhttp://www.xilinx.com/support/documentation/boards_and_kits/ug533.pdftoinstallthe USBtoUARTdriverandconfiguretheRS232serialconnection. 32)Startupaserialconsole(e.g.TeraTermorscreen/dev/ttyUSB09600fromaLinuxterminal). Serialconnectionsettings:9600baud,8bits,1stopbit,noparity,noflowcontrol.TheML605 willbydefaultbootuptoatestproject.Fearnot! 33)FromtheXilinxshell,startuptheXilinxMicroprocessorDebugger: >xmd 34)LoadtheFPGAandtheLinuxkernelimage: XMD%fpgafise_top.bit XMD%connectmbmdm XMD%dowsimpleImage.xilinx (Spewageonthescreen.Waitforaminuteortwo...) XMD%con 35)Linuxshouldnowbootintheserialconsolewindow.Waitforacommandprompt.Itcan't doallthatmuch,butyoucannavigatearoundthedirectorytreeandtopworks.Voila! CreationofaCompactFlashImage(New!) 1) IntheXilinxshell,navigatetothelocationwheretheFPGAbitstreamandtheLinuxKernel imagelive. 2) Copythefilegenace.tclfrom%XILINX%/ISE_DS/EDK/data/xmd 3) LaunchaXilinxshell(seestep#28above). 4) Createthefilelinuxmb.acefilebytyping:
xmdtclgenace.tclhwise_top.bitelfsimpleImage.xilinxacelinuxmb.aceboardml605targetmdm

5) IfyoudonthaveaCompactFlashcardformattedwithaFAT16filesystem,followthe directionshere:http://billauer.co.il/blog/2011/07/systemacebitstreammicroblazeprocessor compactflash/ 6) DeleteallofthefilesandfoldersfromtheCompactFlashcard. 7) Copylinuxmb.acetotheCompactFlashcardandinsertitintotheslotontheML605board. 8) PoweruptheML605boardandopenaserialconsoleasinstep#32above.Linuxwillboot. MountinganNFSFilesystem(New!) 1) CreateanewdirectorycallednfsbootinaconvenientlocationontheLinuxworkstationthat willactastheNFSserverandcdtoit. 2) UncompresstheLinuxfilesystemtothenfsbootdirectory:
>zcat<kernelpath>/initramfs_minimal_le.cpio.gz|sudocpioidHnewcnoabsolutefilenames

3) EnsurethatNFSserverisinstalledontheLinuxworkstation: >sudoaptgetinstallnfskernelserverportmapnfscommon 4) Createanexportfilesystem:sudomkdir/export/nfsroot 5) MounttheLinuxfilesystemextractedinstep1: >sudomountbind<pathtonfsroot>/nfsroot/export/nfsroot 6) Addanentryto/etc/fstabtoavoidhavingtoissuethemountcommandonsystemrestart (sudogedit/etc/fstab):<pathtonfsroot>/nfsroot/export/nfsrootnonebind00 7) Addthefollowinglinesto/etc/exports(sudogedit/etc/exports): Page6of10

/export/192.168.1.0/255.255.255.0(rw,fsid=0,insecure,no_subtree_check,sync) /export/nfsroot192.168.1.0/255.255.255.0(rw,nohide,insecure,no_subtree_check,sync) IfnotconnectedtoaLAN,replace192.168.1.0withtheIPaddressorIPaddressrange oftheML605client. 8) StarttheNFSserver:sudo/etc/init.d/nfskernelserverstart 9) SometweakstotheLinuxkernelconfiguredinSteps23and24arenecessaryforNFSto workproperly.Youcaneithermanuallyeditthe.configfilein<linuxkernelpath>orrepeat Step22andnavigatethroughthemenuconfig.


# # Boot options # CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="console=ttyS0 ip=dhcp rootfstype=nfs root=/dev/nfs rw nfsroot=192.168.1.2:/export/nfsroot,tcp,nolock,wsize=4096,rsize=4096" CONFIG_CMDLINE_FORCE=y CONFIG_SECCOMP=y

Replace192.168.1.2withtheNFSserverIPaddress. #
# Networking options # CONFIG_PACKET=y CONFIG_UNIX=y CONFIG_XFRM=y CONFIG_INET=y CONFIG_IP_FIB_HASH=y CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y CONFIG_IP_PNP_BOOTP=y CONFIG_INET_XFRM_MODE_TRANSPORT=y CONFIG_INET_XFRM_MODE_TUNNEL=y CONFIG_INET_XFRM_MODE_BEET=y CONFIG_INET_LRO=y CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y CONFIG_TCP_CONG_CUBIC=y CONFIG_DEFAULT_TCP_CONG="cubic" CONFIG_DNS_RESOLVER=y

MakesurethatCONFIG_IP_PNP_DHCP=y. 10) Rebuildthekernel:>makeARCH=microblazesimpleImage.xilinx 11) Getanothercupofcoffee. 12) Findthekernelimage<kernel_dir>/arch/microblaze/boot/simpleImage.xilinxandcopyitto someplaceconvenient. 13) DownloadthekerneltotheML605boardbyrepeatingSteps3035orcreateaSystemAce CompactFlashimage.Success! Page7of10

Nextsteps:
GetMicroblazeubootworking:http://xilinx.wikidot.com/ubootnew BuildaCapplicationprograminSDKandrunitontheMicroblaze. ConnectcustomIPtotheAXI4busintheVirtex6FPGA. Worlddomination.

Page8of10

TuxthePolyesterPenguinapprovesofthismessage. ThankyoutoAnalogDevicesLyricLabs(www.lyricsemi.com)forsponsoringthisexercise.

Appendix:UbuntuLinuxInstallationHiccups
ThankstoAndySchweitzerforuncoveringtheseissues. TogettheXilinxtoolstoruncorrectlyonaLinuxmachine,addthefollowinglinesto.bashrc: source/opt/Xilinx/13.2/ISE_DS/settings32.sh>/dev/null ToworkaroundotherISEandEDKpathissues,itmaybenecessarytocreatesomesoftlinksand movesomefilesaround: sudoln/usr/bin/make/usr/bin/gmake cd/opt/Xilinx/13.2/ISE_DS/ISE/lib/lin/ sudomkdirorig sudomvlibstdc++*orig cd/opt/Xilinx/13.2/ISE_DS/common/lib/lin/ sudomkdirorig sudomvlibstdc++*orig References: http://forums.xilinx.com/t5/EDKandPlatformStudio/SynthesisproblemofEDKprojectattachedin theISE124/tdp/135438 http://forums.xilinx.com/t5/InstallationandLicensing/ISE131onkubuntu1104/tdp/151626 USBcabledriverproblems: DownloadthisalternativeXilinxUSBcabledriver(requireslibusb): http://rmdir.de/~michael/xilinx/ Page9of10

Copythefollowingfiles(assudo)to/etc/udev/rules.d 50xilinxusbpav.rules: ACTION=="add",BUS=="usb",SYSFS{idVendor}=="03fd",MODE="666" xusbdfwu.rules: #version0003 ATTRS{idVendor}=="03fd",ATTRS{idProduct}=="0008",MODE="666" SUBSYSTEMS=="usb",ACTION=="add",ATTRS{idVendor}=="03fd",ATTRS{idProduct}=="0007", RUN+="/sbin/fxloadvtfx2I/usr/share/xusbdfwu.hexD$tempnode" SUBSYSTEMS=="usb",ACTION=="add",ATTRS{idVendor}=="03fd",ATTRS{idProduct}=="0009", RUN+="/sbin/fxloadvtfx2I/usr/share/xusb_xup.hexD$tempnode" SUBSYSTEMS=="usb",ACTION=="add",ATTRS{idVendor}=="03fd",ATTRS{idProduct}=="000d", RUN+="/sbin/fxloadvtfx2I/usr/share/xusb_emb.hexD$tempnode" SUBSYSTEMS=="usb",ACTION=="add",ATTRS{idVendor}=="03fd",ATTRS{idProduct}=="000f", RUN+="/sbin/fxloadvtfx2I/usr/share/xusb_xlp.hexD$tempnode" SUBSYSTEMS=="usb",ACTION=="add",ATTRS{idVendor}=="03fd",ATTRS{idProduct}=="0013", RUN+="/sbin/fxloadvtfx2I/usr/share/xusb_xp2.hexD$tempnode" SUBSYSTEMS=="usb",ACTION=="add",ATTRS{idVendor}=="03fd",ATTRS{idProduct}=="0015", RUN+="/sbin/fxloadvtfx2I/usr/share/xusb_xse.hexD$tempnode"

Page10of10

Potrebbero piacerti anche