DE1-SoC Control Panel
DE1-SoC Control Panel
com
14-Apr-23
CONTENTS
Overview
The Altera Cyclone V SoC Development Kit (DE1-SoC), a robust platform that is built around
Altera System-on-Chip (SoC) FPGA which combines the dual-core Cortex-A9 embedded cores
with industry leading programmable logic for ultimate design flexibility. Altera’s SoC FPGA
integrates Hard Processor System (HPS) consisting of processor, peripherals and memory interfaces
tied seamlessly with the FPGA fabric using a high-bandwidth interconnect backbone. Other than
having the Altera SoC FPGA, DE1-SoC FPGA development board is equipped with hardware, such
as DDR3 memory, video and audio capabilities, Ethernet networking, and much more that promise
many exciting applications.
To demonstrate the power of the SoC FPGA on the DE1-SoC FPGA development board, we have
created a “Control Panel” program, a board utility software that uses ARM to access various
peripherals that belong both to the Hard Processor System (HPS) and the FPGA. This demo is
particularly useful for anyone who is interested in the SoC FPGA structure and development of
future SoC applications.
This scope of this tutorial is to help users understand and learn how to build the board utility
“Control Panel” on the DE1-SoC FPGA development board in a step-by-step fashion. To boost user
confidence while following the instructions, we provide screenshots of steps needed to be followed.
This helps users debug if they encounter any problems during the learning process. Users should
have basic concepts toward building their own applications once they have finished working with
the whole tutorial. Also, users should find this tutorial self-explanatory and self-contained as we
hope that lots of creative projects can be inspired as a result of this.
Figure 1-1 shows the block diagram of the Control Panel where user can see the Control Panel
program is running on Linux on the left-hand side. The program GUI is built based on QT library
and it can access the FPGA resources through the AXI bus. The Linux Frame Buffer Display
To give users an outline what they will learn in this manual, here we provide a list of topics that will
be covered and explained:
Before starting this tutorial, please note that the following items are required to complete the
Control Panel project:
A x86 PC
Altera DE1-SoC FPGA board
Linux Ubuntu 12.04 x32 Installer
Options if Windows Host is preferred
MS Windows Installer
VMware Player Installer
QT 5.2.0 Designer Installer
QT 4.8.5 open source
Quartus 13.0 or later installer
Our Control Panel program GUI is built using the QT library. Considering that most users might not
be familiar with the QT library, we believe it would be most helpful to first list all the steps required
to complete the control panel project in the following:
This section describes how to set up the Control Panel program on the Altera DE1-SoC
Development Kit. There are five steps involved. Please carefully follow the instructions below:
To write the microSD card image into a microSD card, a writing tool is required. In this tutorial,
Win32 Disk Imager utility is used. This utility is a shareware, users can download it from the web:
(http://sourceforge.net/projects/win32diskimager/)
On the download page as shown in Figure 1-2, click “Download” to start the download process.
The downloaded filename is “win32diskimager-v0.9-binary.zip”.
Decompress the file and execute Win32DiskImage.exe to launch the tool as shown in Figure 1-3.
The “Control Panel” microSD card image is available from the website:
http://cd-de1-soc.terasic.com
Please download the microSD card image “Linux Console with framebuffer” under the Linux BSP
section. The filename is DE1_SoC_FB.zip. The archive needs to be decompressed to extract the
image named DE1_SoC_FB.img.
Then, insert a 4GB microSD card into the host Windows. Launch Win32 Disk Imager, select the
inserted microSD card in the Device list box and click on the Folder icon to select the image file
DE1_SoC_FB.img. Click “Write” to start writing the image file into the microSD card as shown in
Figure 1-4.
Before writing, a “Confirm overwrite” dialog appears as shown in Figure 1-5. Make sure the
When the writing process is complete, a “Complete” dialog appears as shown in Figure 1-6. Click
“OK” to close the window.
Connect the following items to the Altera DE1-SoC FPGA development board as shown in Figure
1-7.
USB mouse and keyboard
LCD monitor
Control Panel microSD Card
DC Power
Please also make sure that MSEL[4:0]=00000 located on the back of the Altera DE1-SoC FPGA
development board as shown in Figure 1-8.
When the Linux boot process is complete, a login prompt will appear as shown in Figure 1-10.
Type in “root” and press ENTER to login Linux.
After successful login as root, the current directory is now set at “/home/root”. The Control Panel
execution file “ControlPanel” is pre-built in this directory. Please type in “./ControlPanel –qws” to
launch the Control Panel as shown in Figure 1-11. Note that QT library has been preinstalled in the
microSD card image therefore users can simply launch the Control Panel without installing the QT
library.
The Control Panel window will appear on the LCD monitor as shown Figure 1-11. Now, you can
use the USB mouse to operate the Control Panel.
Linux Installation
The Control Panel program runs on Linux in the Altera SOC ARM as shown in the block diagram
in Chapter 1. In Chapter 2, we begin by installing Linux as a first step toward completing the
Control Panel project. The Linux system can be installed on a x86 PC directly or on a virtual
machine running on Microsoft Windows. This chapter also describes how to install an Ubuntu OS, a
Linux system, on a virtual machine VMware Player running on Microsoft Windows. The VMware
Player is first installed on a Windows host, and subsequently Ubuntu Linux is installed on the
VMware Player with an Easy Install mode.
The Control Panel is a GUI-based program and QT Creator is a convenient tool to help create such
GUI-based programs. Regarding the Linux installation, users might ask if it is possible to install
Cygwin Linux in Microsoft Windows instead of installing Ubuntu on VMware Player running on
Microsoft Windows. Note that QT Creator, a software meant for GUI-based programs, can’t be
successfully installed on Cygwin Linux in Microsoft Windows.
Running Ubuntu on VMware Player in Microsoft Windows is an easier way when users wish to
create a GUI application, such as oscilloscopes or logic analyzers, without the need to have a
Desktop Linux. Users can simply follow our GUI application development method explained in this
tutorial for more user-based GUI applications.
Before starting the Linux installation on a virtual machine, please make sure and check if these
following items are in place:
Now, we proceed to install the virtual machine under Microsoft Windows. This section shows (1)
where to download VMware player and (2) how to install it under Microsoft Windows.
Install VMware
In the Destination Folder dialog as shown in Figure 2-5, keep the default destination or specify
desired installation folder, then click “Next >” button to go to the next step.
Next, you should see a “User Experience Improvement Program” dialog as shown in Figure 2-7.
Check on “Help improved VMware Player” and click “Next” to continue.
Figure 2-7
In the Ready to Perform the Requested Operations dialog as shown in Figure 2-9, click “Next
>” button to go to the next step
When the installation is complete, Setup Wizard Complete dialog appears as shown in Figure
2-10. Click “Finished” button to finish the setup process.
Once VMware Player is completely installed, a program shortcut icon will appear on the desktop in
Windows, as shown in Figure 2-11. Double-click the shortcut icon will launch the VMware Player.
Figure 2-12 shows the main window of VMware Player.
Now we have downloaded and installed the VMware player, we are ready to download Ubuntu
image file and install it on the VMware Player. Note that the “Easy Install” mode is automatically
applied when VMware Player detects if the installed OS is Ubuntu 12.04.
The Ubuntu Desktop can be downloaded from the weblink provided below, as shown in Figure
2-13
http://www.ubuntu.com/download/desktop
On the download page, select “32-bit (for machines with less than 2GB)” and click "Ubuntu 12.04
LTS" button to start the download process.
A Contribution page appears as shown in Figure 2-14. If you do not wish to contribute now, click
“Not now, take me to the download >” to start the download process. The downloaded image
filename is “ubuntu-12.04.3-desktop-i386.iso”.
Launch the VMware Player as shown in Figure 2-15. Click the "Create a New Virtual Machine"
Icon to create a virtual machine accordingly.
When the Welcome to the New Virtual Machine Wizard dialog appears as shown in Figure 2-16,
select the “installer disk image file (iso):” radio button, and click “Browse” button to specify the
location of the Ubuntu Linux image file “ubuntu-12.04.3-desktop-i386.iso” which has been
downloaded in the previous step. Note that the “Easy Install” mode is enabled for Ubuntu 12.04.
Click “Next >” to go to the next step.
When the Easy Install Information dialog appears as shown in Figure 2-17, please specify your
username and password. In this tutorial, the user name “terasic” and the password “123” are used.
Click "Next >" button to go to the next step. Please remember your username and password, as
they will be frequently used throughout the tutorial.
When the Name the Virtual Machine dialog appears as shown in Figure 2-18, you can change the
virtual machine name as you wish. In this example, a machine name “Ubuntu 12.04 x32” is used.
Figure 2-18 Name the Virtual Machine Dialog of New Virtual Machine Wizard
When the Specify Disk Capacity dialog appears as shown in Figure 2-19, please specify the
maximum disk size and click "Next >" button to go to the next step.
Now, the Ready to Create Virtual Machine dialog appears as shown in Figure 2-20. Keep the
default setting and click "Finish >" button to go to the next step.
When the installation is completed, a Ubuntu login dialog appears as shown in Figure 2-23. In the
Password edit box, key in the password specified in the previous step (in this tutorial, password is
“123”), and press “ENTER” on the keyboard.
Click the Power icon and select the “Shut Down…”, as shown in Figure 2-25 to turn off the Linux
Restart Ubuntu
To restart Ubuntu after it has been shut down, here is the step-by-step instruction:
After Linux has been completely installed, we also need to upgrade the system to make sure the
system is the most up-to-date.
Please follow carefully with the installation procedures in this section. First, press “CTRL+ALT+T”
on keyboard to launch a terminal as show in Figure 2-27.
The system will prompt users to input a password. Please input your password (in this tutorial, the
password is “123”) and press ENTER as shown in Figure 2-28.
After finishing typing in “sudo apt-get update’ and the password, now type in the following
command and press ENTER, as shown in Figure 2-29.
$sudo apt-get upgrade
Figure 2-31 shows the screenshot after the upgrade process has been complete.
QT Creator Installation
The Control Panel is a GUI-based program and QT Creator is a convenient tool to help create
GUI-based programs. Users can simply follow our GUI application development explained in this
tutorial to develop needed GUI applications.
Chapter 3 illustrates how to install QT Creator on the Desktop Ubuntu which has been installed in
previous chapter. Also, we will show how to create, compile, and build a hello program running on
Ubuntu. In order for QT Creator to be able to build a project correctly, we also provide steps of
installing necessary x86 GCC tool-chain needed for the QT Creator.
In order for the QT Creator to be able to build a project correctly, a proper tool-chain is required.
Use the following command to install the required tool-chain:
Now system also prompts users to confirm to continue the installation process, as shown in Figure
3-2. Please type “y” and press ENTER to continue.
Figure 3-3 shows the screenshot after the installation has been completed. Type “exit” to close the
terminal.
Download QT Installer
As shown in Figure 3-4, click the Firefox web browser to open the web page
http://download.qt-project.org/official_releases/qt/5.2/5.2.0/,
then click “qt-linux-opensource-5.2.0-x86offline.run” to download the QT installer.
When an Opening dialog appears as shown in Figure 3-5, select “Save File” radio button, and click
“OK”.
Type in the following commands to locate and launch the QT Installer, as shown in Figure 3-8.
$cd ~/Downloads/
$ls
$chmod +x qt-linux-opensource-5.2.0-x86-offline.run
$./qt-linux-opensource-5.2.0-x86-offline.run
In the Installation Folder dialog, please specify the folder where you wish to install Qt 5.2.0 and
click “Next>” to go to the next step, as shown in Figure 3-10.
In the Ready to Install dialog, as shown in Figure 3-13, click “Install” to go to the next step.
After installation has been completed, QT Creator is automatically launched as shown in Figure
3-15.
This section describes how to launch QT Creator in Linux and where to check its Build & Run
configuration settings.
Launch QT Creator
When QT Creator is launched, browse the menu and click “ToolsOptions...”, as shown in Figure
3-18, to open the Option dialog.
In the Options dialog, first click “Build & Run” on the left and select the “Compilers” tab on the
right to check if the “GCC” is detected as shown in Figure 3-19.
Now we are ready to create, build, and run our first program “Hello” in QT Creator. Please follow
carefully with the following instructions.
After launching the QT Creator, browse the menu and select item “FileNew File or Project…” as
shown in Figure 3-23 to open a new dialog.
In the New dialog, select “Applications” under Projects, and choose “Qt Gui Application” as shown
in Figure 3-24. Click “Choose…” to go to the next step.
In the Qt Gui Applicaton Dialog, specify the project name and project location, then click “Next
>” as shown in Figure 3-25.
Click on the “Run” icon to build and run the Hello program. The GUI program should appear as
shown in Figure 3-30.
Launch Linux terminal (CTRL+ALT+T) and execute the following commands to download and
extract the Altera SoC tool-chain,
$cd ~
$wget https://launchpad.net/linaro-toolchain-binaries/trunk/2012.11/\
+download/gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux.tar.bz2
$tar xjf gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux.tar.bz2
Figure 4-1 shows the screenshot of tool-chain download progress after typing in the wget command.
It will take about 5 minutes to download the file.
The downloaded file is in the compressed format, so we need to decompress it before we can use it.
Figure 4-2 shows the screenshot after tool-chain download has been finished and has been
extracted by the tar command. After extraction, the tool-chain is located in the folder
“~/gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux”
Figure 4-2 Altera SoC Tool-Chain Download Finished and Extracted by the Tar Command
Now, the tool-chain path needs to be defined and added into the system variable $PATH. We use
Launch terminal (CTRL+ALT+T) and type in the following command to open the batch file
“~./profile”
$gedit ~/.profile
Figure 4-3 shows the screenshot that the “~/.proifle” opened by gedit. Please add the following
line,
export PATH=/home/terasic/gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux/bin:$PATH
to the end of the batch file. Note, in the path string, you should replace “teraisc” with your linux
user name. Click “save” icon to save the file followed by clicking “close” icon (red circle with a x
on the upper left corner) to terminate gedit tool.
In order for the path setting to take effect immediately, please type in “source ~/.profile” in the
terminal or restart the OS.
When an Opening dialog appears as shown in Figure 5-2, please select “Save File” radio button
and click “OK”. The file is saved as “~/Downloads/qt-everywhere-opensource-src-4.8.5.tar.gz”.
$cd ~/Downloads
$ls
$tar -zxvf qt-everywhere-opensource-src-4.8.5.tar.gz
Note the 2nd command line ‘ls” checks if the source file exists and the 3 rd command line is used to
extract the source file, as shown in Figure 5-3. The source will be extracted to the folder
“~\Download\ qt-everywhere-opensource-src-4.8.5”.
In order to perform cross-compile for the QT library, a new make configuration file should be
defined first. What we will do is to first to copy existing make configuration file and then to modify
the file accordingly.
Copy the entire make configuration folder “linux-arm-gnueabi-g++” and rename it (simply add “hf”
at the end of “gnueabi”) as “linux-arm-gnueabihf-g++” with the following command:
$cd ~/Downloads/qt-everywhere-opensource-src-4.8.5/mkspecs/qws
$cp -r linux-arm-gnueabi-g++ linux-arm-gnueabihf-g++
Where the 2 nd command line is to browse the folder where the folder “linux-arm-gnueabi-g++”
exists and the 3rd command line is to duplicate the “linux-arm-gnueabi-g++” folder and rename it as
“linux-arm-gnueabihf-g++” s shown in Figure 5-3
Simply follow the below procedures to modify the configuration file in the terminal:
After we have modified the make configuration files, now we are ready to configure, build, and
install the QT library. Here is a list of the commands that will be used toward building and installing
the QT library.
$source ~/.profile
$cd ~/Downloads/qt-everywhere-opensource-src-4.8.5
$ ./configure -prefix /usr/local/qt-4.8.5-altera-soc -release -shared \
-nomake examples -nomake tools -nomake docs -make demos \
-xplatform qws/linux-arm-gnueabihf-g++ -embedded arm -little-endian \
-no-pch -v
$make
$sudo make install
Configure
Before executing the configure batch, system will prompt to ask license type as shown in Figure
5-5, type in “o” and press ENTER.
After selecting the license type, system prompts to ask whether to accept the license term or not as
When configuration is completed successfully, your will see the message “Qt is now configured for
building. Just run ‘make’” as shown in Figure 5-7.
Make
Compiler Setup
First launch the QT Creator, and select the menu item “ToolsOptions…” as shown in Figure 6-1
to open the Option dialog.
Next, you need to specify the GCC compiler details. First, please type in “GCC (Altera SoC)” in the
Name option box and click “Browse…” to select the location of the compiler of Altera SoC ARM.
The compiler is located at
“/home/terasic/gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux/
/bin/arm-linux-gnueabihf-g++”. Note that in the path string, you should replace “terasic” with your
linux user name. Then click “Apply” to finish the Compiler setup as shown in Figure 6-3.
Qt Verisons Setup
To add Qt Versions, first click on the “Qt Versions” tab and click “Add” as shown in Figure 6-4.
When an Open File dialog appears to ask the location of qmake executable, please specify the
location as: “/usr/local/qt-4.8.5-altera-soc/bin/qmake”.
Kits Setup
To add Kits, first click on the “Kits” tab and click on “Add” as shown in Figure 6-6. Specify the kit
detail as below:
Name: Altera SoC FPGA Kit
Device Type: Select “Generic Linux Device”
Compiler: Select “GCC (Altera SoC)”
Qt Version: Select “(Qt 4.8.5 (qt-4.8.5-atera-soc)”
Then, click “Apply” to finish Kits setup and click “OK” to finish Options setup.
Now, after properly setting up “Build & Run” settings, we are ready to cross-compile the Hello
project. First, please launch the QT Creator, and select the menu item “FileRecent Projects” to
open the hello project as shown in Figure 6-7.
To add “Altera SoC FPGA Kit” into the Hello project, click on the “Projects” icon and select
“Altera SoC FPGA Kit” from the “Add Kit” pull-down menu, as shown in Figure 6-8.
Figure 6-8 Add Altera SoC FPGA Kit into the Hello Project
To compile the hello project, click on “Compile Output” item on the bottom toolbar of the QT
Creator and select the menu item “BuildRebuild All” as shown in Figure 6-10. While compiling,
the system message will be simulaneously displayed on the “Compile Output” Windows.
When the build process has been complete, the output execution file can be found under the folder
“/home/terasic/my_hello/build-hello-Altera_SoC_FPGA_Kit-Release/hello”. Note that in the path
string, you should replace “terasic” with your linux user name as shown in Figure 6-11.
To execute the Hello program on the Altera DE1-SoC FPGA board, we need to copy the hello
execution file and QT library for Altera SoC to the Altera SoC FPGA Board which runs on Linux.
In this demonstration, we use Linux “scp” command to remote copy these files from host PC to the
Altera DE1-SoC FPGA development board.
First, use a RJ45 cable to connect the Altera SoC FPGA development board to an Ethernet network
with a DHCP server, like Figure 6-12.
Figure 6-12 Connect Altera SoC FPGA Board To the Ethernet Network
Then, use the microSD card which Control Panel is written to, described in chapter one, to boot the
Altera SoC FPGA development board. After logging into Linux, type in “udhcpc” command to
request an Ethernet IP Address from the DHCP server as shown in Figure 6-13.
To get a IP address from the UDHC server, type Linux “ifconfig” command to find the assigned IP
address, as shown in Figure 6-14. In this case, the assigned IP address is “192.168.1.114”.
Figure 6-14 Use Linux ifconfig Command to Check Assigned Ethernet IP Address
Now, back to the host PC part. Please make sure the host PC is connected to the Ethernet which
Altera DE1-SoC FPGA development board also is connected to. Launch a terminal, and type in:
$cd /home/terasic/my_hello/build-hello-Altera_SoC_FPGA_Kit-Release
to go to the directory where the hello execution file is located, as shown in Figure 6-15. Note, in the
path string, you should replace “terasic” with your linux user name.
Then, type:
$ scp hello [email protected]:/home/root
to remote copy the hello program to the /home/root directory of the file system of Altera DE1-SoC
FPGA development board , as shown in Figure 6-16. Note that the IP address 192.168.1.114 should
be changed to the actual IP address assigned.
During the first time of the connection, system will ask “Are you sure you want to continue
connecting (yes/no)?”. Please type in “yes” and press ENTER. After confirming, the system will
ask you to input password for the remote machine, please type “terasic” (the default setting with
the microSD image) and press ENTER.
Once the copying process is done, we work in the Linux terminal on Altera SoC FPGA
development board. Since the file sent earlier from host PC is in the compressed format, we need to
decompress the QT Library before we can use it.
By typing the following command in the Linux terminal on Altera SoC FPGA development board
$ cd /usr/local
to go to the /usr/local directory, as shown in Figure 6-21.
After renaming, we can now decompress the QT Library by typing the following command:
$ tar -jxv -f qt-4.8.5-altera-soc.tar.bz2
as shown in Figure 6-23.
If the Hello program is launched successfully, you should see the Hello windows as shown in
Quartus 13.0 or later which supports Cyclone V Device on Windows is required in the Control
Panel Quartus Project can be downloaded from https://www.altera.com/download/sw/dnl-sw-index.jsp or as
shown in Figure 7-1.
The Quartus project of Control Panel is located on the system CD: “Demonstration\
ControlPanel\Quartus”. Please copy the folder to the Windows host and open it with Quartus, as
shown in Figure 7-2. Click “Start Compilation” icon to start to compile.
When finished compiling, DE1_SOC_golden_top.sof is generated under the Quartus project folder.
When Altera SoC FPGA boots from the microSD Card, it also reads soc_system.rbf in the microSD
Card to configure the FPGA. Therefore, we now show how to translate the .sof to .rbf.
Generate soc_system.rbf
First, we need to translate the .sof to .rbf with the following command
$ quartus_cpf -c DE1_SOC_golden_top.sof soc_system.rbf
Next, we need copy the soc_system.rbf to the microSD Card with the following procedures:
1. Insert the microSD Card in the Windows Host
2. Delete soc_system.rbf in the microSD Card if there is one
3. Copy your soc_system.rbf into the microSD Card
Test
Finally, boot the Altera DE1-SoC FPGA development board with the updated microSD Card, login
to Linux, and launch control panel with the command “./ControlPanel ./qws” to test if everything
works well.
Panel
The Control Panel circuit is built by QSyS. The HPS Linux program accesses Avalon Memory
Mapped Bus through the HPS component. Also, FPGA controller can use HPS resource, like
DDR3 SDRAM, through the HPS component. The HPS configuration is board-peripheral-
dependent, so users don’t need to modify the HPS setting if the board has not been changed.
The HPS Linux program accesses Avalon Memory Mapped Slave ports through HPS AXI Master
port as shown Figure 7-3. If you wish that Linux program can access a Qsys instance, just connect
its Avalon Memory Mapped Slave port of the controller to HPS AXI Master port.
Linux program access specific Avalon Memory Mapped Slave port based on its port address, so
please make sure the port addresses are not overlapped with each other. We strongly recommend
In this tutorial, the slave port of LED, Button, Switch, IR, 7-segment, VIP frame reader, VIP
clocked video input, and VIP alpha blending mixer controllers are connected to the HPS
h2f_lw_axi_master AXI Master port. Use Qsys “Address Map” tab can view the connection
summary and associated address, as shown in Figure 7-4.
VIP Frame Reader is used to implement the Frame Buffer Display of Linux. The Frame Reader uses
HPS’s DDR3 SDRAM as frame buffer, so we need to connect the Avalon Memory Mapped
Master port of Frame Reader instance to the AXI Slave port of HPS instance, as shown in Figure
7-5.
Control Panel QT project uses Altera hwlib library source code which is included in the Altera SoC
EDS (Embedded Development Suite). Therefore make sure to install Altera SoC EDS before
compiling the QT Project.
When the installer is launched, a Welcome dialog appears as shown in Figure 8-4. Click “Next >”
to go to the next step.
When the Installation Directory dialog appears as shown in Figure 8-6, we strongly recommend
you keep the default directory and click “Next >” to proceed.
When the Ready to Install dialog appears as shown in Figure 8-8, please click “Next >” to go to
The source code of hwlib library can be found at the below location as shown in Figure 8-10.
Launch the VMware Player, select the “Ubuntu 12.04 x32”, and click “Edit virtual machine
settings”, as shown in Figure 8-11.
When the Virtual Machine Settings dialog appears as shown in Figure 8-12, please select
“Options” tab, click “Shared Folders” icons, check “Always enabled” radio button, and then click
“Add…”.
Add Shared Folder Wizard is launched for shared folder settings. A Welcome dialog appears as
shown in Figure 8-13, please click “Next >” to go to the next step.
When the Specify Shared Folder Attributes dialog appears as shown in Figure 8-15, check
“Enable this share” checkbox and click “Finish”.
When going back to the Virtual Machine Settings dialog as shown in Figure 8-16, check “OK” to
complete the settings. Now the Shared Folder feature is applied.
Copy the Control Panel QT project folder “ControlPanel_QT” from the System CD to the shared
folder on Windows host. Then, launch the “Ubuntu 12.04 x32” virtual machine. After logging in
Ubuntu, launch a terminal (CTRL+ALT+T) and type the following command to go to the shared
folder on Linux:
$cd /mnt/hgfs/shared
to go to the shared directory on Linux.
Now type in
$ls
To see the “ControlPanel_QT” directory of Control Panel QT Project, as shown in Figure 8-17.
Now, we can launch the QT Creator, and select the menu item “FilesOpen File or Project…” as
shown in Figure 8-18.
Now, to check if the include path is correct, please follow the instructions below:
First click on “Edit” icon on the left and double click “ControlPanel.pro” as shown in Figure 8-22,
please make sure the INCLUDEPATH includes the correct path:
Then, select menu item “BuildRebuild All”, as shown in Figure 8-25, to build the Control Panel
Project.
To run the “ControlPanel” execution file on the Altera DE1-SoC FPGA development board, we
need to copy it to the Linux on Altera SoC FPGA Board. This is similar to what we have done in
Section 6.3 “Execute Hello Program” where we use Linux “scp” command to remote copy.
After “ControlPanel” execution file has been remotely copied to the “/home/root” directory of
Linux running on Altera SoC FPGA Board, type “./ControlPanel –qws” to launch the Control Panel
in the terminal of Altera SoC FPGA board. If you can see the ControlPanel windows as shown in
Figure 8-27, it means you had successfully built the Control Panel QT Project.
Panel
Control Panel controls the FPGA Qsys components through the memory-mapped method. The
device driver “/dev/mem” is used to access the physical address space which is mapped to Qsys
address space.
Below shows how to turn on 10 LEDs which is controlled by Qsys PIO Controller whose address is
0x10000 in the Qsys system. Based on “/dev/mem” device driver and “mmap” function, we can
calculate the LED address led_base. With the address, we can directly write the value of the address
to control the PIO Controller. Const ALT_LWFPGASLVS_OFST is defined “socal/hsp.h”
#include “socal/hps.h”
int file
void *virtual_base;
uint8_t *led_base;
The way to control HPS LEDs is similar to the way to control FPGA LED. The register files of both
PIO controllers are different. Macro alt_setbits_word is used to set value to the specific address.
The HPS LED is controlled by GPIO1 GPIO Controller. ConstALT_GPIO1_SWPORTA_DDR_A
DDR is used to define the direction register address of GPIO1 Controller, and const USER_IO_DIR
is used to define the direction pin bits-mask associated to the HPS LED. Const
ALT_GPIO1_SWPORTA_DR_ADDR defines the data register address of GPIO1 Controller, and
const BIT_LED is used to define the pin bits-mask associated to the HPS LED. Both
ALT_GPIO1_SWPORTA_DDR_ADDR and ALT_GPIO1_SWPORTA_DR_ADDR are defined in
“socal\hps.h”. Macro alt_setbits_word is defined in “socal/socal.h”
#include "socal/socal.h"
#include “socal/hps.h”
int file
void *virtual_base;
uint8_t *led_base;
FPGA Class
All of FPGA control functions are encapsulated in the FPGA class and it is implemented in fpga.c
and fpga.h. Below shows the public functions of this class:
HPS Class