User Tools

Site Tools


lab_1

Lab 1: Hello World on the 330 Board

Overview

This lab will show you how to import the hardware/software setup from the class web page and to compile a couple of simple programs.

Objectives

  1. Start to learn how to use the Xilinx SDK and to download and run programs on the 330 board.
  2. Learn to use the SDK by exploring it. Learn how to:
    1. edit and save programs,
    2. practice running programs,
    3. explore the graphics library,
    4. experiment with the SDK to learn what it can do.
  3. Become familiar with the graphics routines that are available for use with the LCD display.
  4. Learn some of the issues with printf().

Resources

  1. You need to download the latest version of the environment files from ECEN330_Student_SW_Env Updates. It contains several directories and many files that you will use to write your programs throughout this semester. Once you have downloaded the file, save it somewhere and expand it.
  2. Subscribe to the BYU ECEN 330 channel. Follow the first four videos (V1 - V4, in order) as they explain how to get up and running with the zip file and the Xilinx SDK.

Other Resources

  1. ZYBO Board Documentation The ZYBO board is commercially available from digilentinc.com.
    • This is a description of the graphics software that is available for use with the 330 board. I ported over this software from Adafruit (they sell the LCD panel that is mounted on the 330 board).
    • If you add the prefix “display_” to the function names described in this document, most (not quite all) of the functions are available for use with the ZYBO board, e.g., drawLine() becomes display_drawLine();
    • Take a look at display.h, contained in the supportFiles directory. Also, note that DISPLAY_WIDTH and DISPLAY_HEIGHT are defined in display.h to be the correct values for height and width of the display. display.h is also listed in the source-code section for your convenience.

Requirements

Watch the first four videos on the BYU ECEN 330 channel (V1 - V4) and run helloWorld as instructed.

V1: Setting Up Directories

V2: Import the Extracted Files into the Xilinx SDK

V3: Download the Bit-Stream to the ECEN Development Board

V4: Build the Configuration and Execute the Program


Note: when importing projects (V2), please make sure to navigate through the J Drive as shown below or your project will generate errors during compilation:


Also watch the videos below and and do as instructed.

V13: Modify a compiler setting to overcome Xilinx SDK Bug

V11: Setting the Heap and Stack Size



Exercises

1. Modify the first “hello world” program and remove the \n\r from the string used in the printf function and recompile and execute the program. What happens? Does “hello world!” still appear in the console?

The LCD Screen for helloWorld.c

2. Read the graphics documentation and then modify the “helloWorld.c” program so that it shows the following when executed (both triangles are yellow):

The LCD Screen for the Graphics Program


Notes and Hints

  1. Carefully read every word of the lab description. These lab descriptions have been refined over the past three years based upon student feedback. In most cases, the answers to your questions are usually present in the lab description. It is good practice to become very skilled at reading documentation as you will find that there are no TAs in industry. In general, students who read the lab description very carefully before coding anything complete the lab much more quickly than those who tend to scan the description and jump directly to coding. That said, if something is still unclear after you carefully read the lab description, let me know and I will try to fix it. I value student feedback.
  2. If you removed or renamed files/directories in your project area via Windows after you have performed the steps described in video V2 (see above), the only solution is to start completely over, beginning with the first step of Lab 1.
  3. Make sure that you properly added the compiler flag as described in the “Modify a compiler setting to overcome Xilinx SDK Bug” video. The flag that you add is -MT“$@”. Make sure that you include the space between the previous flag: -c -fmessage-length=0. When you are done, the flag settings should look exactly like this: -c -fmessage-length=0 -MT“$@”.
  4. I strongly advise against a “trial and error” approach when writing the code to draw the lines, circles and triangles. It takes up to a minute each time you build your code and download to the board and this adds up quickly, time-wise. A better approach is to draw a picture of the display and to determine the actual coordinates before writing any code.
  5. The sizes of the triangles and circles don't need to match my picture exactly but they should be reasonably close.
  6. If you are having problems programming the board, ensure that the programming jumper is set correctly. I went through all of the boards in the shop and I think that I set all of them but double-check this if you are having problems programming the board. The jumper needs to placed over the rightmost two pins as shown in the picture below.
  7. The main.c file contains a function called isr_function(). You will not use this function for this lab but it must be defined or you will get a linker error. You will do more with this function in later labs.

Programming Jumper Set to JTAG Mode (programming over the cable


Questions

Consider the following questions as you work on this lab.

  1. What actions occur when you save your program? Do you ever have to manually compile your program?

Pass Off

Execute your program and show the LCD display to the TAs for credit. You don't need to show your source code for this lab.

Note to TAs: Ask the student what happened when they removed the \n\r from the printf() in the exercises. Don't pass the student off unless you are sure that the completed this exercise.


Help: Read display.h to see what display_ functions are available

You can view the contents of display.h here (found in the supportFiles directory in the Xilinx SDK). This source code is provided so you can easily see what display functions are provided for your use. Don't add this file to your system as it is already installed for you once you have completed Lab 1. This is for convenience only.

Source Code for display_ Functions

lab_1.txt · Last modified: 2019/05/07 12:56 by hutch