Digilent Arty board and Linux - Part 4 - Synthesize, Load and Run

Well, at this point we have generated the FPGA system, we obtained the Linux kernel image using the the Device Tree of our hardware, it is time to synthesize the system on the FPGA, load Linux and run!

The whole process is going to be done from the SDK (Eclipse), so open the Xilinx Vivado Suite, and then open the Xilinx SDK.
The last thing we did here is to create the Device Tree but now we do not want to modify it so Close the device_tree_bsp_0 clicking right over it and closing the project.

Connect the Arty board to your computer and locate the virtual COM port that has been created. The JTAG commands go over the same USB physical connection but two devices are created, the JTAG Debug Port and the virtual COM, separately, so we can from now open the COM port from Putty or similar, at 115200 baud.

  • In the SDK, go to Xilinx Tools > Program FPGA. As we exported the SDK including bitstream, the hardware system wrapper is here configured. Click on Program and wait until the process finishes.

    At this time, the FPGA is configured and Microblaze is running nothing.

  • Copy your created Linux image to the .sdk project subfolder.
     
  • In the SDK now go to Xilinx Tools > XMD console. The XMD console allows us to connect with the microblaze and perform actions like stop the processor, restart it or copy data to Flash or RAM through JTAG. This is just what we will do, to copy our Linux image to RAM.
     
  • To connect with the target, into the XMD console window type
    connect mb mdm 

    the processor information should appear: 

    WARNING: Processor Version 0x23 - UnSupported Version, New Features May Not Work
     
     
    JTAG chain configuration
    --------------------------------------------------
    Device   ID Code        IR Length    Part Name
     1       0362d093           6        xc7a35t
     
    MicroBlaze Processor Configuration :
    -------------------------------------
    Version............................0x23 - UnSupported Version
    Optimization.......................Performance
    Interconnect.......................AXI-LE
    MMU Type...........................Full_MMU
    No of PC Breakpoints...............1
    No of Read Addr/Data Watchpoints...0
    No of Write Addr/Data Watchpoints..0
    Instruction Cache Support..........on
    Instruction Cache Base Address.....0x80000000
    Instruction Cache High Address.....0x8fffffff
    Data Cache Support.................on
    Data Cache Base Address............0x80000000
    Data Cache High Address............0x8fffffff
    Exceptions  Support................on
    FPU  Support.......................off
    Hard Divider Support...............on
    Hard Multiplier Support............on - (Mul64)
    Barrel Shifter Support.............on
    MSR clr/set Instruction Support....on
    Compare Instruction Support........on
    PVR Supported......................on
    PVR Configuration Type.............Full
    Data Cache Write-back Support......off
    Fault Tolerance Support............off
    Stack Protection Support...........off
     
    Connected to "mb" target. id = 0
    Starting GDB server for "mb" target (id = 0) at TCP port no 1234

  • Now find  your Linux image by typing "dir" and moving into directories using "cd directory" or "cd .."
     
  • Once located, type the following command, with your image name
    dow simpleImage.artylinux
  • After finishing the download, the processor keeps stopped. To run the uploaded image simply type
    con 0x80000000

Now you should see the linux booting on your previously opened terminal!!

As configured in our kernel compilation, the user is root and the password is password.

 

Setting up the Ethernet

Once logged in you can set up the ethernet port to be connected to the internet. Firstly we need to assign the device MAC address by typing the following sentence

ifconfig eth0 hw ether 00:11:22:33:44:55

And edit the /etc/network/interfaces file to include the eth0, keeping as follows

#interface file auto-generated by buildroot

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
# Comment avobe an uncomment below to set static IP
# iface eth0 inet static
#  address 192.168.1.125
#  netmask 255.255.255.0
#  gateway 192.168.1.1

 Finally it is time to turn on the ethernet link

ifup eth0

 Done!

 

Take into account that all this process has been done entirely on RAM, when you shutdown the board you loose all the image and any change you did. We will need to upload the image to the Flash memory

 

Digilent Arty board and Linux - Part 3 - Linux Kernel Image

 We created a basic FPGA system capable to run Linux in the Part 1 and generated the Device Tree file in the Part 2. At this time we will compile the Linux Kernel obtaining an image ready to be launched on our hardware synthesized into the Arty board.

 First thing we need is a computer running Linux, I always have some virtual machines to run with each OS depending on the task to perform. 

  • Install all needed dependencies for the compilation.
     
    sudo apt-get install build-essential bison flex gettext libncurses5-dev texinfo autoconf automake libtool
  • We need to include our device tree information so we create the board/arty folder and copy our artylinux.dts file into it.
     
    mkdir board/arty
    cp ../../artylinux.dts board/arty/
  • The next step is to define the kernel properties. This procedure can be done through different ways but the most graphical is to use the menuconfig option from the makefile. You can learn and play a lot searching on the internet. Here you can include packages, binaries or even package managers. Take into account that our Flash space is not too high (about 7MB), rememeber that we are into embedded world, not a general application computer ;)
    Here I present the selected properties to generate the _defconfig file. The _defconfig file is merely the text file with the output of the make menuconfig. 
     
            Target options
                    Target Architecture: Microblaze AXI (little endian)
                    Target Binary Format: ELF
            Build options
                    Commands
                            (wget --passive-ftp -nd -t 3) Wget command
                            (svn) Subversion (svn) command
                            (bzr) Bazaar (bzr) command
                            (git) Git command
                            (cvs) CVS command (NEW)
                            (tcp) Local files retrieval command (NEW)
                            (scp) Secure copy (scp) command (NEW)
                            (ssh) Secure shell (ssh) command (NEW)
                            (hg) Mercurial (hg) command (NEW)
                            (gzip -d -c) zcat command (NEW)
                            (bzcat) bzcat command (NEW)
                            (xzcat) xzcat command (NEW)
                            ()  Tar options (NEW)
                    ($(CONFIG_DIR)/defconfig) Location to save buildroot config
                    ($(TOPDIR)/dl) Download dir (NEW)
                    ($(BASE_DIR)/host) Host dir (NEW)
                    Mirrors and Download locations
                            (http://sources.buildroot.net) Backup download site (NEW)
                            (https://www.kernel.org/pub) Kernel.org mirror (NEW)
                            (http://ftp.gnu.org/pub/gnu) GNU Software mirror (NEW)
                            (http://rocks.moonscript.org) LuaRocks mirror (NEW)
                            (http://cpan.metacpan.org) CPAN mirror (Perl packages) (NEW)
                    (0) Number of jobs to run simultaneously (0 for auto) (NEW)
                    NO Enable compiler cache
                    NO Show options and packages that are deprecated
                    NO build packages with debugging symbols
                    strip command for binaries on target (strip)
                    () executables that should not be strupped
                    ()  directories that should be skipped when stripping (NEW)
                    gcc optimization level (optimize for size)
                    NO build code with Stack Smashing Protection (NEW)
                    libraries (shared only)
                    ($(CONFIG_DIR)/local.mk) location of a package override file (NEW)
                    ()  global patch directories
                    Advanced
                            None
            Toolchain[*] Linux Kernel
                            Kernel version (4.3)
                            () Custom kernel patches (NEW)
                            Kernel configuration /Using a custom (def) config file)
                            (board/arty/artyLinux_defconfig) Configuration file path
                            () Additional configuration fragment files (NEW)
                            Kernel binary format (simpleImage)
                            -*- Build a Device Tree Blob (DTB)
                                    Device tree source (Use a custom device tree file)
                            (board/arty/artylinux.dts) Device Tree Source file paths
                            Linux Kernel Extensions
                                    None
                            Linux Kernel Tools
                                    None
            Target Packages
                    -*- BusyBox
                    (package/busybox/busybox.config) BusyBox configuration file to use? (NE$
                    ()    Additional BusyBox configuration fragment files (NEW)
                    [ ]   Show packages that are also provided by busybox (NEW)
                    [ ]   Enable SELinux support (NEW)
                    [ ]   Install the watchdog daemon startup script (NEW)
                    Audio and video applications  --->
    
                    Compressors and decompressors  --->
                    Debugging, profiling and benchmark  --->
                    Development tools  --->
                    Filesystem and flash utilities  --->
                    Fonts, icons, sounds and themes  --->
                    Games  --->
                    Graphic libraries and applications (graphic/text)  --->
                    Hardware handling  --->
                    Interpreter languages and scripting  --->
                    Libraries  --->
                    Mail  --->
                    Miscellaneous  --->
                    Networking applications  --->
                    Package managers  --->
                    Real-Time  ----
                    Security  --->
                    ...
            Filesystem images
                    [ ] axfs root filesystem (NEW)
                    [ ] cloop root filesystem for the target device (NEW)
                    [ ] cpio the root filesystem (for use as an initial RAM filesystem) (NE$
                    [ ] cramfs root filesystem (NEW)
                    [ ] ext2/3/4 root filesystem (NEW)
                    *** initramfs needs a Linux kernel to be built ***
                    *** iso image needs a Linux kernel and one of grub, grub2 or isolinux t
                    [ ] jffs2 root filesystem (NEW)
                    [ ] romfs root filesystem (NEW)
                    [ ] squashfs root filesystem (NEW)
                    [*] tar the root filesystem (NEW)
                    Compression method (no compression)  --->
                    ()    other random options to pass to tar (NEW)
                    [ ] ubifs root filesystem (NEW)
                    [ ] yaffs2 root filesystem (NEW)
            Bootloaders
                    NO Bootloader
            Host Utilities
                    NO Host utilites
            Legacy config options
                    NO Legacy config options

 If you want to try my _defconfig file with my configuration, here are the generated files [first] [second].

  •  Locate each file in the following folders:
    • buildroot-2015.11/board/arty/artylinux_defconfig
    • buildroot-2015.11/configs/arty/artylinux_defconfig
       
  • From the buildroot-2015.11 root directory, type: 
     
    make arty_artylinux_defconfig
    make

At this moment buildroot will do its magic. To download all dependencies, binutils, patches, gcc, etc, compile the crosstool, libs and compile the linux kernel.

The output binary file can be found at buildroot-2015.11/output/images/simpleImage.artylinux

The next step will be to load the image into the Arty board and to launch it, see it in the Part 4

 

 

Syndicate content