Fall 2009: EE 382N-4   Unique: 17190

Advanced Embedded Systems Architecture

Tutorial

NOTICE: This is a tutorial related to lab2.


 

1.0 Overview: 

The goal of this tutorial is to:

·            Give an introduction to the development board, and the design and usage of a device driver.

 

This tutorial includes the following

·            The interaction of the software with the FPGA, through the device driver.

·            The software reads the inputs, calls the hardware function with these inputs, gets the output from the FPGA and prints it.

·            The development board (TLL6219) is used to run and co-verify (hardware + software) the system.

 


 

2.0 Resources

 

a)     The development board (TLL2020) has a Xilinx SPARTAN 3 FPGA and an ARM9 processor.

b)     Collateral

·         Xilinx ISE: http://direct.xilinx.com/direct/ise9_tutorials/ise9tut.pdf

·         Overview of the board: /scratch/Documentation/TLL6219_Getting_Started_Manual_ver2.2_28Dec2007.pdf

·         Writing applications on the ARM platform: /scratch/Documentation/MC9328MX21RM.pdf (page 87 for memory map)

 


 

3.0 Example: This example takes two integers as inputs and gives their sum as the output. The addition is implemented in the FPGA which is called from the software.

 

a)    Software part (user application and device driver). Relate the code to lecture-10 for a better understanding.

·         Download the device_driver_demo tarball into your directory.

·         Do the following steps to unzip and compile the code.

o        tar -zvxf device_driver_demo.tar.gz

o        cd device_driver_demo

o        source /scratch/arm_linux_setup.sh

o        make

·         The Makefile uses Codesourcery tools to compile the code for the ARM processor.

·         When compiled with `make`, will produce the `user_application.exe` executable which can be run on Linux running on the ARM board.

·         User application

o        In user_application.c, we have the call to the device driver.

o        The device driver is opened as a file with a specific major number.

o        The ioctl calls direct the read-write commands and the corresponding values to the device driver.

·         Device driver

o        adder.c implements the device driver.

o        In the adder device driver, we receive the calls from the user application and redirect them to specific addresses.

o        These addresses refer to those in the FPGA which are memory mapped.

o        0xD3000000,4,8 are the memory locations accessed by this device driver example.

 

a)    Hardware part (this needs to be performed in ENS 114 or through remote connection)

·         The hardware will read the values in addr1 (0xD3000004) and addr2 (0xD3000008), perform the addition and return the result, whenever addr0 (0xD3000000) is read by the software.

·         top.v performs this functionality.

o        STATE 6 performs the addition.

o        Discuss the state machine implemented here, as part of your report.

·         We use Xilinx ISE for the synthesis and the generation of bit file which can then be downloaded to the FPGA. Here are the steps to working with the ISE.

o        Create a new project with following properties

·         Family: Spartan3

·         Device: XC3S1500

·         Package: FG676

·         Speed: -4

o        After clicking next twice, in the `Add existing Sources` tab, add both top.v and top.ucf files from your directory.

·         Once you `finish` creating the project, you will see several small windows. In the `Processes` window, under `Generate Programming File`, double-click on `Programming File Generation Report`. This will synthesize, implement and finally generate the bit file.

·         The bit file (top.bit) will be generated in your project directory.

 

 

b)    Combining both the software and the hardware (this needs to be performed in ENS 114 or through remote connection)

1.            Open the LL5000_PC_app.exe application (icon on the desktop). This is the TLL5000 Monitor/Controller application through which we can control the settings of the development board

                                                                                           i.      Choose the LL5000 development board

                                                                                         ii.      Click on the --Power[ON]— button

 

2.            Open Xilinx iMPACT (icon on the desktop) to download the bit file onto the board

                                                                                           i.      In the Impact ISE, right-click on the xc3s1500 device (the last one on the right)

                                                                                         ii.      Choose assign new configuration file, select the bit file that was generated in 3.0.b

                                                                                        iii.      Right-click the xc3s1500 device and choose the `Program` option

1.      Click on `Ok` in the dialog box that appears, retaining the default options. You should now see a `Program Succeeded` message displayed

                                                                                       iv.      Now we have successfully setup the environment (hardware for running the software)

 

3.            Open the hyper terminal (115200_TLL_Hyperterminal.ht icon on the desktop)

                                                                                           i.      Type `linuxd` in the HyperTerminal

1.      This will bootup linux (busybox) on the ARM processor

                                                                                         ii.      Use the `wget` command to download the software part (3.0.a) which is the `user_application.exe` executable into the filesystem from some public space. Also download adder.ko device driver.

1.      wget http://www.cerc.utexas.edu/~sambamur/user_application.exe

                                                                                        iii.      Create the file in /dev/ if there isn’t one for the device driver with the corresponding major number

1.      mknod /dev/adder c 246 1, creates the file for the adder device driver with major number 246 and minor number 1

                                                                                       iv.      Install the device driver

1.      insmod adder.ko

2.      Do a lsmod to see the list of installed device drivers

 

                                                                                        v.      In the HyperTerminal, go to the directory where you downloaded the executable

                                                                                       vi.      Change permissions by doing a `chmod +x user_application.exe`

                                                                                     vii.      Do a `./user_application.exe arg1 arg2` to execute the program. You should see the sum of arg1 and arg2 displayed on the console if the setup is correct.