Figure 5-20: Soft IP Registers
Getting Started with Linux Application Debugging
5-21
11. You can resume the code several times by pressing F8, and you will see how the DATA register changes and the HPS LEDs on the board are lighted accordingly.
12. You can also change the DATA register, manually and see the LEDs being lighted accordingly.
13. Collapse the soft IP register group to avoid the debugger accessing them on the next debugging session before they are accessible.
14. Click Disconnect from Target button to close the debugging session.
Note:
Do not try to access the soft IP registers before the FPGA is programmed or before the bridges are open. Otherwise, the debugger will generate a memory access abort and the debugging session will fail. This includes having any soft IP registers groups expanded in the Registers dialog box. The debugger will try to access them in order to refresh the view and it will generate a memory access abort if they are not accessible. Always collapse the soft IP register view after usage if there is any chance they will not be available to the debugger.
Related Information
•
Getting Started with the Hardware Library
on page 5-11
For more information, refer to the Getting Started with the Hardware Library section.
•
ARM DS-5 Documentation
The ARM DS-5 Altera Edition reference material can be accessed online on the documentation page of the ARM website (www.arm.com); and from Eclipse by navigating to Help > Help Contents > ARM DS-
5 Documentation.
Getting Started with Linux Application Debugging
The ARM DS-5 Altera Edition provides very powerful Linux application debugging capabilities.
This section presents running the ARM DS-5 Altera Edition for the first time, importing, compiling and running the Hello World Linux example application provided as part of SoC EDS.
Getting Started Guides
Send Feedback
Altera Corporation
5-22
Configuring Linux
Note:
This section uses a Linux host computer, as can be seen from the screen shots and the issued commands. However, the scenario can also be run on a Windows machine, although it is not usual for Linux development to be done on Windows.
Related Information
•
ARM DS-5 Altera Edition
on page 6-1
For more information, refer to the ARM DS-5 Altera Edition section.
•
ARM DS-5 Documentation
The ARM DS-5 Altera Edition reference material can be accessed online on the documentation page of the ARM website (www.arm.com); and from Eclipse by navigating to Help > Help Contents > ARM DS-
5 Documentation.
•
Rocket Boards
For more information about Linux, refer to the Rocketboards website.
Configuring Linux
For this getting started scenario we need Linux to be running on the target board and be connected to the local network. The local network has to have a DHCP server that will allocate an IP address to the board.
Eclipse needs an account with a password to be able to connect to the target board. The root account does not have a password by default, so one needs to be set up.
The required steps are:
1. Setup the board as described in the Getting Started with Board Setup section; and connect the HPS Ethernet
Connector J2 to the local network.
2. Start Linux on the target board, as described in the Getting Started with Running Linux section.
3. On the Linux console, run the command ifconfig to determine the IP address of the board.
4. On the Linux console, change the root password by running the passwd command. Ignore the warnings about a weak password.
Related Information
•
Getting Started with Board Setup
on page 5-1
For more information, refer to the Getting Started with Board Setup section.
•
Getting Started with Running Linux
on page 5-2
For more information, refer to the Getting Started with Running Linux section.
Starting Eclipse via the Embedded Command Shell
1. Start an Embedded Command Shell by running <SoC EDS installation directory>
/embedded_command_ shell.sh
.
2. Start Eclipse by running the eclipse command from the Embedded Command Shell.
3. The Eclipse tool, part of the ARM DS-5 AE, prompts for the workspace folder to be used. Accept the suggested folder and click OK.
4. The ARM DS-5 AE "Welcome" screen appears. It can be used to access documentation, tutorials, and videos.
Altera Corporation
Getting Started Guides
Send Feedback
Importing the Sample Application
5-23
Importing the Sample Application
1. In Eclipse, select File > Import. The Import dialog box displays.
2. In the Import dialog box, select
General > Existing Projects into Workspace
and click Next. This will open the Import Projects dialog box.
Figure 5-21: Import Existing Project
3. In the Import Projects dialog box, select the Select Archive File option.
4. Click Browse, then navigate to <SoC EDS installation directory>
\embedded\examples\software\
, select the file Altera-SoCFPGA-HelloWorld-Baremetal-GNU.tar.gz and click OK.
Getting Started Guides
Send Feedback
Altera Corporation
5-24
Compiling the Sample Application
Figure 5-22: Select Imported File
5. Click Finish. The project is imported. The project files are displayed in the Project Explorer panel. The following files are part of the project:
Table 5-3: Project Files
hello.c
Makefile
File Name Description
Sample application source code
Makefile used to compile the sample application
Compiling the Sample Application
1. To compile the application, select the project in Project Explorer.
2. Select Project > Build Project.
3. The project compiles and the Project Explorer shows the newly created helloexecutable file as shown in the figure below. The Console dialog box shows the commands that were executed.
Altera Corporation
Getting Started Guides
Send Feedback
Figure 5-23: Project Compiled
Setting up Remote System Explorer
5-25
Setting up Remote System Explorer
The ARM DS-5 AE can run and debug programs directly on the target with the help of the Remote System
Explorer (RSE). Before this feature can be used, the RSE needs to be configured to connect to the target board running Linux.
1. In your Eclipse workspace, select Window > Open Perspective > Other. This will open the Open
Perspective dialog box.
2. In the Open Perspective dialog box, click the Remote System Explorer and click OK.
3. In the Remote System Explorer view, right click Local and select New > Connection ….This will open the New Connection wizard.
Note:
Clicking the + sign achieves the same result.
Altera Corporation
Getting Started Guides
Send Feedback
5-26
Setting up Remote System Explorer
Figure 5-24: Create New Connection
4. In the first page of the New Connection wizard, named Remote System Type view, select SSH only and click Next.
Figure 5-25: New Connection window
5. Enter the IP address of the board in the Host Name field. Click Finish to create the connection.
Altera Corporation
Getting Started Guides
Send Feedback
Figure 5-26: Enter Target IP Address
Setting up Remote System Explorer
5-27
6. In the Remote Systems panel, click the Target IP > Sftp Files > Root. This opens a dialog box to enter the username and password.
Figure 5-27: Browse Target
7. Enter root as the username and the password you have selected in the Configuring Linux section. Check the Save User ID and Save password check boxes. Click OK.
Getting Started Guides
Send Feedback
Altera Corporation
5-28
Running Sample Application
Figure 5-28: Target Username and Password
8. Eclipse asks for confirmation of authenticity of the board. Click Yes.
9. Remote System Explorer shows the files on the DevKit board on the left panel.
Figure 5-29: Target Files
Running Sample Application
At this stage, we have a compiled Linux application and a properly configured Remote Systems Connection.
This section shows how to create a Debugger Configuration and use it to run and debug the application.
1. Select Run > Debug Configurations… to open the Debug Configurations dialog box.
2. Right click the DS-5 Debugger and click New to create a new debug configuration.
3. Name the newly created debugger configuration, LinuxAppDebug_DevKit, by editing its name in the
Connection tab.
4. In the Connection tab, select:
Altera Corporation
Getting Started Guides
Send Feedback
Running Sample Application
5-29 a.
For the Free Web Edition license, select Generic > gdb server > Linux Application Debug > Download
and Debug Application.
b. For the Subscription Edition or 30-day Evaluation Edition, select Altera > Cyclone 5 SoC > Linux
Application Debug > Download and Debug Application.
5. In the Connection tab, select the newly created RSE connection and keep the default values.
Figure 5-30: Connection Settings
6. Go to Files tab, and set the Target Configuration parameters:
a. Select the Application on host to download to be the hello executable file. Use the Workspace… browse button.
b. Edit the Target download directory to be
"/home/root"
(the root folder).
c. Edit the Target working directory to be
"/home/root"
(the root folder).
Altera Corporation
Getting Started Guides
Send Feedback
5-30
Running Sample Application
Figure 5-31: Target Configuration
7. Click the Debug button. A dialog window appears asking to switch to Debug perspective. Click Yes.
8. Eclipse downloads the application to the board and stops at main function entry.
Figure 5-32: Program Downloaded
Note:
At this stage, all the usual debugging features of DS-5 can be used, such as breakpoints, view variables, registers, tracing, and threads.
9. Click the Continue green button or press F8 to run the application. The hello message is printed on the
Application Console.
Altera Corporation
Getting Started Guides
Send Feedback