Linux Kit Quickstart

Linux Kit Quickstart
PHYTEC Messtechnik GmbH
Quick Start Instructions
Linux-Kit
phyCARD-L
Using Eclipse and the GNU Cross Development Tool Chain
Note: The PHYTEC Linux-phyCARD-L-Disc includes the electronic
version of the English phyCARD-L Hardware Manual.
A product of a PHYTEC Technology Holding company
phyCARD-L
Quick Start Instructions
In this manual copyrighted products are not explicitly indicated. The absence of the
trademark () and copyright () symbols does not imply that a product is not
protected. Additionally, registered patents and trademarks are similarly not expressly
indicated in this manual.
The information in this document has been carefully checked and is believed to be
entirely reliable. However, PHYTEC Messtechnik GmbH assumes no responsibility for
any inaccuracies. PHYTEC Messtechnik GmbH neither gives any guarantee nor accepts
any liability whatsoever for consequential damages resulting from the use of this
manual or its associated product. PHYTEC Messtechnik GmbH reserves the right to
alter the information contained herein without prior notification and accepts no
responsibility for any damages that might result.
Additionally, PHYTEC Messtechnik GmbH offers no guarantee nor accepts any
liability for damages arising from the improper usage or improper installation of the
hardware or software. PHYTEC Messtechnik GmbH further reserves the right to alter
the layout and/or design of the hardware without prior notification and accepts no
liability for doing so.
 Copyright 2010 PHYTEC Messtechnik GmbH, D-55129 Mainz.
Rights - including those of translation, reprint, broadcast, photomechanical or similar
reproduction and storage or processing in computer systems, in whole or in part - are
reserved. No reproduction may be made without the explicit written consent from
PHYTEC Messtechnik GmbH.
Address:
EUROPE
NORTH AMERICA
PHYTEC Technologie Holding AG
Robert-Koch-Str. 39
55129 Mainz
GERMANY
PHYTEC America LLC
203 Parfitt Way SW, Suite G100
Bainbridge Island, WA 98110
USA
Ordering
+49 (800) 0749832
Information: [email protected]
1 (800) 278-9913
[email protected]
Technical
Support:
+49 (6131) 9221-31
[email protected]
1 (800) 278-9913
[email protected]
Fax:
+49 (6131) 9221-33
1 (206) 780-9135
Web Site:
http://www.phytec.de
http://www.phytec.com
1st Edition: December 2010
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Chapter 1
Table of Contents
Introduction......................................................... 1
1.1
Rapid Development Kit Documentation ....................................1
1.2
Professional Support Packages Available ..................................2
1.3
Overview of this Quick Start Manual.........................................2
1.4
Conventions Used in this Quick Start Manual ...........................3
1.5
System Requirements .................................................................4
1.6
Software Development Tool Chains ..........................................5
1.6.1 Eclipse.............................................................................5
1.6.2 The GNU Cross Development Tool Chain.....................6
Chapter 2
Getting Started.................................................... 7
2.1
Requirements of the Host Platform ............................................7
2.2
Configuring the Host Platform ...................................................8
2.2.1 Installing Software Packages ..........................................8
2.2.2 Set Up Network Card Configuration ............................16
2.2.3 Disabling the Firewall...................................................19
2.2.4 Set Up TFTP Server......................................................22
2.3
Linux-phyCARD-L-Kit Setup..................................................25
2.3.1 Starting the Setup..........................................................26
2.4
Advanced Configuration Information ......................................37
2.5
Connecting the Host with the Target........................................38
2.6
Copying an Example to the Target...........................................44
2.6.1 Copying a Program to the Target..................................44
2.6.2 Using Telnet to execute a Program on the Target ........48
2.6.3 Using SSH to Execute a Program on the Target...........49
2.7
Advanced Information..............................................................52
2.7.1 Copying a Program to the Target with the Command
Line ...............................................................................52
2.7.2 Executing a Program on the Target ..............................52
2.7.3 Executing a Program directly on the Target using SSH52
Chapter 3
3.1
5 min
35 min
Getting More Involved .....................................53
Configuring and Compiling the Kernel....................................53
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
70 min
phyCARD-L
Quick Start Instructions
3.1.1 Writing the Images into the Target’s Flash .................. 59
3.2
Opening an Existing Project..................................................... 64
3.2.1 Copying the HelloWorld Project .................................. 65
3.2.2 Starting Eclipse and Importing the Example Project ... 65
3.3
Creating a New Project............................................................. 71
3.4
Changing the Demo Application.............................................. 81
3.4.1 Executing the Program on the Target using Microcom 83
3.5
Starting a Program out of Eclipse on the Target ...................... 84
3.6
Automatically starting the Program when booting the Target . 87
Chapter 4
Debugging an Example Project .......................93
4.1
Starting the GDB Server on the Target .................................... 94
4.2
Configuring and Starting the Debugger in Eclipse .................. 95
4.3
Setting a Breakpoint ............................................................... 101
4.4
Stepping and Watching Variable Contents ............................ 102
4.5
Changing Variable Values ..................................................... 104
4.6
Using the Memory Monitor.................................................... 106
Chapter 5
Summary..........................................................109
Chapter 6
Installing Linux on the phyCARD-L ............110
6.1
Installing the X-Loader and the Boot Loader ........................ 110
6.2
Configure Barebox Environment Variables........................... 114
6.3
Restoring the Barebox Default Configuration ....................... 116
6.4
Writing the Kernel / Root File System into Flash.................. 117
© 2010 PHYTEC Messtechnik GmbH
35 min
L-743e_0
phyCARD-L
Chapter 1
Introduction
Introduction
5 min
In this Quick Start you can find general information on the PHYTEC
phyCARD-L, and an overview of the Eclipse software development tool and
the GCC C/C++ cross development tool chain. You will also find
instructions on how to run example programs on the phyCARD-L, mounted
on the PHYTEC Development Board, in conjunction with the Eclipse
development tool.
Please refer to the phyCARD-L Hardware Manual for specific information
on board-level features, such as jumper configuration, memory mapping,
and pin layout.
1.1 Rapid Development Kit Documentation
This “Rapid Development Kit” (RDK) includes the following electronic
documentation on the enclosed “PHYTEC Linux-phyCARD-L-Disc:”
 The PHYTEC phyCARD-L Hardware Manual.
 phyCARD-L Controller User's Manuals and Data Sheets.
 This Quick Start Instructions with general “Rapid Development Kit”
description, software installation advice, and an example program
enabling quick out-of-the-box start-up of the phyCARD-L in
conjunction with the Eclipse and GCC C/C++ software development
tool chain.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
1
phyCARD-L
Quick Start Instructions
1.2 Professional Support Packages Available
This kit comes with free installation support. If you have any questions
concerning installation and setup, you are welcome to contact our support
department.
For more in-depth questions, we offer a variety of custom-tailored
packages with different support options (e-mail, phone, direct contact to the
developer) and different reaction times.
Please contact our sales team to discuss the appropriate support option if
professional support beyond installation and setup is important to you.
1.3 Overview of this Quick Start Manual
This Quick Start manual gives you a general “Rapid Development Kit”
description, as well as software installation advice and an example program
enabling
quick
out-of-the-box
start-up
of
the
phyCARD-L in conjunction with the Eclipse IDE and GCC C/C++
software tools. It is structured as follows:
 The “Getting Started” chapter describes the configuration of the host
platform and how to setup all the tools used in this manual.
 The “Getting More Involved” chapter provides step-by-step instructions
on how to configure and build a new kernel, modify an example
application, create and build new projects, and copy programs to the
phyCARD-L using Eclipse.
 The “Debugging” chapter provides information on how to debug an
application with the Eclipse debugging interface.
In addition to the dedicated data for this Rapid Development Kit, the
PHYTEC Linux-phyCARD-L-Disc contains supplemental information on
embedded microcontroller design and development in general.
2
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Introduction
1.4 Conventions Used in this Quick Start Manual
The following is a list of the typographical conventions used in this Quick
Start manual:
Italic
Used for file and directory names, program and command
names, command-line options, menu items, URLs, and other
terms that correspond the terms on your desktop.
Bold
Used in examples to show commands or other text that should
be typed literally by the user.
Pay attention to notes set apart from the text with the following icons:
At this part you might leave the path of this Quick Start.
This is a warning. It helps you to avoid annoying problems.
Provides useful supplementary information about the topic.
At the beginning of each chapter you can find information of
the time needed to pass that chapter.
You have successfully passed an important part of this Quick
Start manual.
Provides information to solve common problems.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
3
phyCARD-L
Quick Start Instructions
1.5 System Requirements
Use of this “Rapid Development Kit” requires:
 The PHYTEC phyCARD-L. (OMAP 3)
 The PHYTEC Development Board with the included DB-9 serial cable,
Ethernet cross-over cable and AC adapter supplying 12 VDC (min. 2
A).
 PHYTEC Linux distribution based on OSELAS from Pengutronix.
 An IBM-compatible host PC (586 or higher CPU).
 openSUSE 11.1 (x86) and the KDE 4.1 desktop.
 Recommended free disk space: at least 2 GB.
For more information and updates, please refer to the following sources:
http://www.phytec.de
[email protected]
4
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
1.6
Introduction
Software Development Tool Chains
1.6.1 Eclipse
The Eclipse platform provides support for C/C++ development. Because
the Eclipse platform is only a framework for developer tools, it doesn't
support C/C++ directly; instead it uses external plug-ins. This Quick Start
shows you how to make use of the CDT, a set of plug-ins for C/C++
development in conjunction with the GCC C/C++ tool chain.
The CDT is an open source project (licensed under the Common Public
License) implemented purely in Java as a set of plug-ins for the Eclipse
SDK platform. These plug-ins add a C/C++ perspective to the Eclipse
Workbench that can now support C/C++ development with a number of
views and wizards, along with advanced editing and debugging support.
Due to its complexity, the CDT is broken down into several components,
which take the form of separate plug-ins. Each component operates as an
autonomous project, with its own set of committers, bug categories, and
mailing lists. However, all plug-ins are required for the CDT to work
properly. Here is a list of the plug-ins/components:
 Primary CDT plug-in is the “framework” for the CDT plug-ins.
 CDT Feature Eclipse is the CDT Feature Component.
 CDT Core provides Core Model, CDOM, and Core Components.
 CDT UI is the Core UI, views, editors, and wizards.
 CDT Launch provides the launch mechanism for external tools such as
the compiler and debugger.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
5
phyCARD-L
Quick Start Instructions
 CDT Debug Core provides debugging functions.
 CDT Debug UI provides the user interface for the CDT debugging
editors, views, and wizards.
 CDT Debug MI is the application connector for MI-compatible
debuggers.
1.6.2 The GNU Cross Development Tool Chain
Cross development in general refers to the overall software development
process that produces a single application or a complete system running on
a platform that is different from the development platform. This is an
important concept when the target system doesn’t have a native set of
compilation tools, or when the host system is faster and has greater
resources.
The platform where the actual development takes place is called the host
platform. The platform where the final application is tested and run is
called the target platform. In this Quick Start we are using an x86-based
Linux as the host platform. As the target platform we are using the ARM
architecture with a phyCARD-L CPU.
Building a program for a CPU architecture different from the one used on
the machine where the compilation is done is accomplished using a cross
compiler tool chain and cross-compiled libraries. In this Quick Start we are
using the GNU C/C++ cross development tool chain.
6
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Chapter 2
Getting Started
Getting Started
35 min
In this chapter you will establish the basis to pass the steps in this Quick
Start. First you will learn how to configure the host platform. You will
install additional software packages and setup the network configuration
for connecting your host to the target. After connecting the host to the
target, you will copy an application to the target. At the end of this chapter
you will be able to start a first demo application on the target.
2.1 Requirements of the Host Platform
To pass the following steps in this Quick Start, you will need a host PC
with an installation of openSUSE 11.1 (x86) and the KDE 4.1 desktop.
When you are installing openSUSE 11.1, you can select KDE 4.1 as
Desktop selection. The default packages to use openSUSE 11.1 with your
host PC will be selected automatically. This default selection will suffice to
pass the steps in these Quick Start Instructions. The installation of
additional packages and configurations will be described on the following
pages.
In the following configuration steps we assume that the host PC is not
connected to any other network. The target and host will be connected with
a cross-over cable via a peer-to-peer connection. If your host is part of a
company’s network, we recommend disconnecting your host from such a
network.
In these Quick Start Instructions you will have to shutdown the firewall and
configure the network card of your host PC. If your host PC is connected to
another network, changing the IP address can cause conflicts with existing
hosts.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
7
phyCARD-L
Quick Start Instructions
2.2 Configuring the Host Platform
In this passage you will learn how to configure the host platform. You will
execute the following steps:
 Install additional software packages. These packages are necessary to
accomplish the steps in the Quick Start Instructions.
 Set up the network configuration to use the host PC with your target.
 Disable the firewall. If the firewall is enabled, you will have problems
with connecting to the target.
 Set up a TFTP server. You can use a TFTP server to download files
(e.g. kernel and root file system images) to the target from within the
target’s boot loader.
2.2.1 Installing Software Packages
To accomplish the steps in the Quick Start Instructions, you will have to
install additional packages.
If you don’t install all of these packages, the setup may fail or
some configuration steps won’t work correctly.
8
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 Open the K menu from the lower-left corner of the desktop and click on
the tab Computer.
 Open the Administrator Settings / YaST.
 Enter your root password and click OK.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
9
phyCARD-L
Quick Start Instructions
 Open Software Management in Software.
 Select the filter Search.
 Type libxml2-devel and click the Search button.
 Check libxml2-devel.
10
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 Type python-devel and click the Search button.
 Check python-devel.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
11
phyCARD-L
Quick Start Instructions
 Type tftp and click the Search button.
 Check the packages tftp and yast2-tftp-server
12
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 Type qt3-devel and click the Search button.
 Check qt3-devel.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
13
phyCARD-L
Quick Start Instructions
 Select the filter Patterns.
 Under Development select Base Development, C/C++ Development,
and Tcl/Tk Development.
 Click Accept.
14
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
Some additional packages will be selected automatically to resolve any
dependencies.
If problems occur while resolving dependencies, we recommend going back to a default configuration.
 Click Continue to install the packages.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
15
phyCARD-L
Quick Start Instructions
2.2.2 Set Up Network Card Configuration
In the following steps you will have to configure the IP
address of your host. We recommend disconnecting your host
from any other network. If you change the host’s IP, chances
are that problems may occur with other hosts in the network.
 Open the YaST Control Center if it is not already opened.
 Choose Network Settings in Network Devices.
16
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 Click OK.
 Choose Traditional Method with ifup in Global Options.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
17
phyCARD-L
Quick Start Instructions
 Select the right network card (if more than one network card is installed
on your host) in Overview.
 Click Edit to enter the Network Card Setup.
18
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 Choose Statically assigned IP address.
 Enter IP address 192.168.3.10 and subnet mask 255.255.255.0
2.2.3 Disabling the Firewall
To ensure that there are no problems with connections to the target, the
host’s firewall should be disabled.
 Select the General tab in the upper-left corner.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
19
phyCARD-L
Quick Start Instructions
 Use the drop-down box in the Firewall Zone settings to set the current
interface to Internal Zone (Unprotected).
 Then press Next, and in the following window click OK to complete the
settings.
20
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
Insert the openSUSE 11.1 disc and click Install. In the following window
click Skip automatically.
The firewall is now disabled and the IP address is set for this network card.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
21
phyCARD-L
Quick Start Instructions
2.2.4 Set Up TFTP Server
Later in this Quick Start you will learn how to write a new kernel image
into the flash memory of the target. To download the kernel image from the
target, you need have to have a TFTP server running. In this passage we
show you how to configure a TFTP server.
 Open the YaST Control Center if it is not already opened.
 Choose TFTP Server in Network Services.
If the TFTP Server icon does not exist, restart the YaST
Control Center.
22
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 Switch the selection to Enable.
 The path of the boot image directory should be /tftpboot. If there is a
different path, change it to /tftpboot.
 Click OK.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
23
phyCARD-L
Quick Start Instructions
 Click Yes to create the /tftpboot directory.
The TFTP server will be started.
 Close the YaST Control Center.
You have successfully finished the configuration of the host
platform.
24
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
2.3 Linux-phyCARD-L-Kit Setup
In this section you will find a description of the Linux-phyCARD-L-Kit
setup. The whole setup will be done by a graphical interface. At the end of
the setup you will find all programs to develop applications for the target
on your host PC.
The setup will install the following programs:
 GNU C/C++ cross development tool chain – you can use this tool chain
to develop programs for the target on your host PC.
 Eclipse SDK with CDT – the Eclipse SDK is a platform and application
framework for building software which can use the GNU C/C++ cross
development tool chain.
 Microcom – a program for serial communication with the target.
 Linux Kernel archive – this kernel archive contains the Linux kernel
source code as well as all patches needed to compile the kernel for the
phyCARD-L.
 HelloWorld – this example program can be used to test how to
download and execute a program on the target.
There will be some additional configuration steps performed on your PC:
 The setup program will create desktop links to the installed programs.
 The setup will also create desktop links to access the target via FTP,
SSH, and Telnet.
 The path of the cross development tool chain will be added to the
$PATH environment variable.
 Read and write access to the serial interface will be added to your user
account so you use the serial communication program Microcom.
 The setup will configure Microcom.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
25
phyCARD-L
Quick Start Instructions
2.3.1 Starting the Setup
 To start with the Linux-PowerPC-Kit Setup enter your PHYTEC LinuxPowerPC-Disc into your CD-ROM drive.
The following dialog may appear:
 Click Cancel.
26
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 From the K menu, select the Applications tab.
 Select System ► Terminal ► Terminal Konsole.
 Type: cd /media/SO-480
 Enter ./install.sh to launch the setup program.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
27
phyCARD-L
Quick Start Instructions
The media may be mounted on a different mount point in the
directory /media. The mount points can be shown with the
command ls /media. Change to the accordant directory if no
directory SO-480 should exist.
 Enter the root password.
 Click Yes to proceed.
The welcome screen appears.
28
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 Click Next to continue.
 Click Next.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
29
phyCARD-L
Quick Start Instructions
 Click Next to copy all files to your hard disk.
The default destination location is /usr/local/share/phyCARDL-Kit. All path and file statements within this Quick Start
manual are based on the assumption that you accept the default
installation paths. If you decide to individually choose different
paths, you must consider this for all further file and path
statements when working with this Quick Start.
We strongly recommend accepting the default destination
location.
30
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
The GCC C/C++ tool chain will be installed to the default directory
/opt/OSELAS.Toolchain-1.99.3/arm-cortexa8-linux-gnueabi. The program
mkimage will be installed to /usr/local/bin. All other programs and
examples will be installed to the selected destination directory.
After the files have been copied, a dialog box for the Eclipse installation
will appear.
 Click Yes to install Eclipse. If you want to skip the installation of
Eclipse, choose No.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
31
phyCARD-L
Quick Start Instructions
We recommend installing Eclipse even if you already have
installed Eclipse on your system. The version of Eclipse
provided on the setup CD-ROM includes additional plug-ins.
 Click Next.
32
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 Click Finish to exit the setup.
 Close the terminal window.
Now you will have to restart the KDE desktop.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
33
phyCARD-L
Quick Start Instructions
 Open the K Menu from the lower-left corner of the desktop.
 Select the Leave tab and choose Logout.
 When the display manager appears, enter your login name and password
to restart the KDE desktop.
It should display a couple of new icons now. Otherwise do a right-click on
the desktop and choose Desktop Settings.
34
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
Within the settings choose Folder View as Desktop Type.
Leave all other settings unchanged if you don’t want to change them.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
35
phyCARD-L
Quick Start Instructions
You have successfully installed the software for the LinuxphyCARD-L-Kit. You can now use the programs you need to
develop your own applications for the target on your host
system. The setup program did all necessary configurations.
In the following passage you can find some advanced
configuration information.
36
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
2.4 Advanced Configuration Information
In this part you can find some information on how to change the
configuration steps of the setup program by your own. The setup program
performed all the following configuration steps. The information in this
part is for users who want to use the phyCARD-L-Kit with a Linux
distribution other than openSUSE. This is also interesting for users who
want to see what configurations the setup program did.
During the setup program, the GCC C/C++ cross compiler was installed in
the
directory
/opt/OSELAS.Toolchain-1.99.3/arm-cortexa8-linuxgnueabi/gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27-sanitized/bin. To
start the cross compiler directly from every location of the system, the
directory of the cross compiler was added to the $PATH environment
variable. You can manually add the directory of the cross compiler to the
$PATH by adding the following line in the file /etc/profile:
export PATH=/opt/OSELAS.Toolchain-1.99.3/arm-cortexa8-linuxgnueabi/gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27sanitized/bin:“$PATH”
You can open a terminal program and use the cross compiler directly from
the command line. For example, you can compile a C program with the
following command:
arm-cortexa8-linux-gnueabi-gcc –o HelloWorld HelloWorld.c
In the standard configuration only the root user has write access to the
serial interface. To use a serial communication tool like Microcom with
normal user rights, you have to be a member of the group uucp. A user can
be added to this group with the following command:
groupmod -A username uucp
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
37
phyCARD-L
Quick Start Instructions
The serial communication program was configured during the setup with
the following configuration:
115200 baud, 1 start bit, 8 data bits, 1 stop bit, no parity, no flow control.
2.5 Connecting the Host with the Target
In this section you will learn how to connect your host PC with the target.
The connection will be done using a cross-over Ethernet cable and a serial
one-to-one cable. You will start Linux from flash on the target, and you
will be able to login with the serial communication program Microcom as
well as via a Telnet session using a peer-to-peer network connection.
 Connect the serial cable with the UART1 (connector P1) port on the
target and the first serial interface on your host.
Ensure to use the one-to-one serial cable included in this
Rapid Development Kit.
 Connect the cross-over Ethernet cable with the connector Ethernet on
the target and the appropriate network card of your host.
 Click the Microcom icon on your desktop.
 Connect the AC adapter with the power supply connector PWR (12V)
on your board.
After connecting the board with the power supply, the target starts booting.
When the target has finished loading the system, you should see a screen
similar to the following:
38
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 Type root to login.
 After you have successfully logged in, you can close Microcom.
If you don’t see the Barebox and Linux starting and don’t get a login
prompt, you probably have a kit with Windows CE preinstalled. Please
refer to the chapter “Installing Linux on the phyCARD-L” for instructions
on how to install Linux in such a case.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
39
phyCARD-L
Quick Start Instructions
When the target is connected with the power supply, first the
X-Loader and then the boot loader Barebox are loaded from
the flash memory. Then the boot loader is uncompressing and
booting the Linux kernel from the flash. The kernel will then
mount the root file system, which is also located in the
target’s flash. The root file system uses the Journaling Flash
File System, Version 2.
JFFS2 is the successor, and a complete rewrite, of the original
JFFS by Red Hat. As its name implies, the JFFS2 implements
a journaling file system on the memory technology device
(MTD) it manages. JFFS2 does not attempt to provide a
translation layer that enables the use of a traditional file
system with the device. Instead, it implements a logstructured file system directly on the MTD. The file system
structure itself is recreated in RAM at mount time by JFFS2
through a scan of the MTD’s log content.
In addition to its log-structured file system, JFFS2
implements wear levelling and data compression on the MTD
it manages, while providing power-down reliability. JFFS2
can gracefully restart, and is capable of restoring a file
system’s content, without requiring outside intervention
regardless of power failures.
If some hints like JFFS2 notice: (428) check_node_data:
wrong data CRC in data node at 0x02358e90: read
0x1c538142, calculated 0xa0531284 arise, you can ignore
them. This happens if the JFFS2 file system in the NAND has
not been shutdown properly before, what is mostly the case
because the power supply simply has been switched off. The
meaning of the message is, that some inconsistencies have
been found and have been corrected automatically.
40
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
Troubleshooting:
If you don’t see any output in the Microcom window, check
the serial connection between the target and your host.
At the end of the setup, you had to restart the KDE desktop.
If you haven’t done yet, restart the KDE desktop now and try
again.
It is also possible that your user account is missing read and
write access to the serial interface:
 Open the YaST Control Center.
 Choose Security and Users.
 Choose User and Group Management.
In the line of your user name should be the group uucp.
 If the group is missing, select your user name and click
the Edit button.
 Select the tab Details.
 In Additional Groups, check the group uucp.
 Click OK.
 Click OK and close YaST.
 You need to log out and log in again for the new group
membership to take effect.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
41
phyCARD-L
Quick Start Instructions
Now you can test the network connection to the target.
 Click the Telnet for Target icon on your desktop.
A new window with a connection to the target opens.
If you can see the user login in the opened window, the network
configurations were configured correctly.
 Close the window.
42
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
Troubleshooting:
If you don’t see the user login, check the connection between
the target and the host. If you have installed more than one
network card on your host, be sure to connect the cable with
the network card you have configured with the IP address
192.168.3.10.
If you do not see the login, you may not have set up the right
IP address of your host. You can check the settings of your
network card by opening YaST. In the YaST Control Center
you can select Network Settings in Network Devices. There
should be the following configuration:
Information on how to configure your network device can be
found in the section Configuring the Host Platform.
You have successfully set up all configurations to access your
phyCARD-L from your host.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
43
phyCARD-L
Quick Start Instructions
2.6 Copying an Example to the Target
In this section you will learn how to copy an example program to the target
using the FTP protocol with the Dolphin browser. After that you will
execute the example on the target. At the end of this passage you can find
some information on how to copy and execute a file on the target using the
command line.
2.6.1 Copying a Program to the Target
 First click the phyCARD-L-Kit icon on your KDE desktop.
A new window with the contents of the installation directory opens.
44
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 Enter the directory HelloWorld.
 Click the FTP for Target icon on your desktop.
A window with an FTP session to the target opens. User is root and
password is empty. Now you have two windows opened, one for the target
and one for the host. You can use these two windows to copy files per
“drag and drop” from the host to the target (and vice versa).
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
45
phyCARD-L
46
Quick Start Instructions
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
 Select the window that lists HelloWorld program on your hard disk.
 Click the HelloWorld program and hold the left mouse button pressed.
 Drag the program into the window with the FTP session to the target
and release the mouse button.
 Choose Copy here in the appearing context menu.
 Close the two windows.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
47
phyCARD-L
Quick Start Instructions
2.6.2 Using Telnet to execute a Program on the Target
 Click the Telnet for Target icon on your KDE desktop.
 Enter root as login and press Enter.
 Enter ./HelloWorld and press Enter.
The program starts and you should see the following output:
Welcome to the World of the phyCARD-L!
48
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
2.6.3 Using SSH to Execute a Program on the Target
SSH can be used if you want to execute a program directly from the host on
the target. Later, this will be used to execute programs out of Eclipse on the
target. Before you can start programs out of Eclipse, you have to log into
the target via SSH from the command line for one time. This is necessary to
add the RSA public key of the target to the list of known hosts.
There are several authentication methods when using SSH.
The method used on the phyCARD-L is the hosts.equiv
method combined with RSA-based host authentication.
If the machine the user logs in from is listed in
/etc/hosts.equiv on the remote machine, and the user name is
the same on both sides, the user is allowed to log in.
On the target, the file /etc/hosts.equiv has the following entry:
# file: /etc/hosts.equiv
#
# Allow access from everywhere.
#
+ +
The “+ +” means that every user can log in from every host.
When the host connects to the target, the file
~/.ssh/known_hosts (on the host) is consulted when using
hosts.equiv with RSA host authentication to check the public
key of the target. The key must be listed in this file to be
accepted. When the host connects to the target for the first
time, you will be asked to store the target’s RSA public key to
your ~/.ssh/known_hosts. If you agree to do this, then the host
will be able to connect to the target without entering a
password.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
49
phyCARD-L
Quick Start Instructions
This authentication method closes security holes due to IP
spoofing, DNS spoofing, and routing spoofing. But note that
/etc/hosts.equiv is, in general, inherently insecure and should
be disabled if security is a concern.
 Click the SSH for Target icon on the desktop.
A new window opens.
In this window you can see that the authenticity of the phyCARD-L can’t
be established. This is normal if you want to create an SSH connection for
the first time.
 Enter yes and press Enter to continue. The RSA public key of the target
will be permanently added to the list of the known hosts.
50
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting Started
Troubleshooting:
If an error occurs and you can’t see the [email protected]:~>
prompt, open a terminal window and enter the following
command:
 rm ~/.ssh/known_hosts
Try to log in again by entering:
 ssh [email protected]
 Enter yes to add the target to the list of known hosts.
Now you should see the target’s prompt.
We expect that you haven’t changed the SSH configuration
file on your host. If you change this file, the authentication
may not work.
Now you are logged in, you can execute programs on the target.
 Type ./HelloWorld to start the program you had copied to the
phyCARD-L before.
The program starts and you should see the following output:
Welcome to the World of the phyCARD-L!
 Close the SSH window.
You have successfully copied and executed an example
application on the target.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
51
phyCARD-L
Quick Start Instructions
2.7 Advanced Information
2.7.1 Copying a Program to the Target with the Command Line
 Open a new terminal window.
 Change to /usr/local/share/phyCARD-L-Kit/HelloWorld:
cd /usr/local/share/phyCARD-L-Kit/HelloWorld
 Copy the application to the target by typing:
ftp -u ftp://root:[email protected]/ HelloWorld
Be sure to enter a slash followed by a space after the IP address.
2.7.2 Executing a Program on the Target
 Open a Telnet session to the target:
telnet 192.168.3.11
 Type root and press Enter.
 Type ./HelloWorld to start the application.
 Type exit.
2.7.3 Executing a Program directly on the Target using SSH
 To start the program, type:
ssh [email protected] ./HelloWorld
After the program has finished, SSH will logout automatically.
52
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Chapter 3
Getting More Involved
Getting More Involved
70 min
In this chapter you will pass some continuative topics. First you will
configure and compile your own kernel. With the kernel configuration tool
you can add additional features, or disable them if they are not needed.
After compiling the kernel, you will learn how to write the newly created
kernel into target’s flash memory and how to start the new kernel.
Then you will start working with the Eclipse platform using the C/C++
Development Tools (CDT) in conjunction with the GCC C/C++ tool chain.
You will learn how to configure the Eclipse platform and how to open an
existing project. After that you will create your first own project and modify
the example’s source code.
At the end of this chapter you will execute the program as an external
application out of Eclipse. Additionally, you will add your application to
the startup configuration of the target so it is automatically started when
the phyCARD-L boots.
3.1 Configuring and Compiling the Kernel
In this part you will learn how to configure and build a new Linux kernel
and a root filesystem. First you will copy the kernel archive to your home
directory and extract the kernel source. Then you will configure the kernel
and the root filesystem with the help of PTXdist, a tool to build the Board
Support Package and to create your own image. After the configuration you
will create your own image.
The kernel used by PHYTEC is based on a standard kernel available from
www.kernel.org. Additionally, the kernel archive in your setup installation
directory already includes all necessary patches for the phyCARD-L.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
53
phyCARD-L
Quick Start Instructions
In the end, you need the following files:
 ptxdist-XXXX.XX.X.tgz (Tool from our partner Pengutronix, that
configures and compiles BSPs)
 OSELAS.BSP-Phytec-phyCARD-PDXX.X.X.tar.gz
phyCARD-L)
 arm-cortexa8-linux-gnueabi.OSELAS-X.XX.X.X.tgz
toolchain)
(BSP
for
(ready-to-use
All files are downloadable from our ftp-server. Please create a temporary
directory within your home directory, for example local/, and copy the files
into it.
Now, open a new terminal if not already open and install PTXdist:
 Click the Konsole icon on your desktop.
 Type the following commands to extract the PTXdist-archieves:
cd local
tar zxvf ptxdist-XXXX.XX.X.tgz
 Now you should check if all necessary tools are installed on your host.
Therefor call the configure script:
cd ptxdist-XXXX.XX.X
./configure
54
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
After a long list of checking … it should return with:
configure: creating ./config.status
config.status: creating Makefile
config.status: creating scripts/ptxdist_version.sh
config.status: creating rules/ptxdist-version.in
ptxdist version XXXX.XX.X configured.
Using '/usr/local' for installation prefix.
Report bugs to [email protected]
If any tool that is necessary for PTXdist is missing, script will abort
with an error. In this case you need to install the missing tool from
your linux distribution. After that, please restart the configure script.
In any case, tool quilt needs to be installed additionally, in order to
avoid errors while compiling patches!
 After successful completion of configure script, please type:
make
 Now you can install PTXdist. Because target directory is /usr/local, this
must be done as user root:
sudo make install
[enter root password]
[...]
 Finally you can delete the temporary directory:
cd
rm –rf local
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
55
phyCARD-L
Quick Start Instructions
When using PTXdist for the first time, setting some configurations is
needed. The most important are:
 Where to put the source packages to.
 Proxy settings for accesses to the internet.
Please start PTXdist setup:
ptxdist setup
PTXdist will download all necessary sources from the internet. For every
source package, that cannot be found on your host, PTXdist will do this by
executing command wget. If a proxy server should be used for doing
internet accesses, please select Proxies, then FTP Proxy and then enter
address and port of the proxy in the following form:
<protocol>://<address>:<port>
PTXdist will store downloaded source packages locally. Thus, if you work
with more than one project, every project would download its own sources,
even if they are the same that have already been downloaded. In order to
avoid this, we suggest to use one single directory for all source packages of
all projects. Some source packages are already included within this BSP, so
we suggest to use its src-directory as source directory for all projects.
Please select Source Directories and enter:
${PTXDIST_WORKSPACE}/src
In order to be able to build an BSP for the OMAP3, you need a toolchain
with a suitable crosscompiler for this processor. So please decompress the
corresponding archive with root rights. It will be stored in directory /opt
automatically.
tar xPvf arm-cortexa8-linux-gnueabi.OSELAS-X.XX.X.X.tgz
56
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
Now you’re ready to build the BSP. Please decompress archieve
OSELAS.BSP-Phytec-phyCARD-PDXX.X.X.tar.gz into a directory and
then move into it. Select the platform for which the BSP should be build:
ptxdist platform \
configs/phyCARD-L-XXXX.XX.X/platformconfig
You should get the messages:
info:
selected platformconfig:
'configs/phyCARD-L-XXXX.XX.X/platformconfig'
Furthermore PTXdist should have recognized the necessary toolchain and
confirm this by giving you the messages:
found and using toolchain:
'/opt/OSELAS.Toolchain-1.99.3/arm-cortexa8-linux-gnueabi/gcc-4.3.2-glibc-2.8-binutils2.18-kernel-2.6.27-sanitized/bin'
Otherwise you need to choose the toolchain manually:
ptxdist toolchain /opt/OSELAS.Toolchain-1.99.3/arm-cortexa8-linuxgnueabi/gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27-sanitized/bin
For building the BSP you could call ptxdist go now, but then you would get
so much stuff for the root-filesystem of your target, that it won’t fit into the
flash-memory any more. This rootfs could only be used when mounting it
via NFS. Thus, PHYTEC provides the BSP together with a file called a
'collection', that excludes not necessary stuff for you. Please tell ptxdist to
use this collection by calling
ptxdist collection configs/collectionconfig-kit
Now, for building the BSP call
ptxdist go
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
57
phyCARD-L
Quick Start Instructions
Now it will take some hours. Sometimes it can happen that an attempt to
download a source package failes due to dead links. PHYTEC cannot
guarantee the accessibility of all the webpages that are needed to build a
BSP. You can check our ftp-server via
ftp://ftp.phytec.de/pub/BSP_PACKAGES/EXTERNALS
if you find a missing source package there. Otherwise you need to search
the web for missing packages. If you have found them, you need to
download them into your src-directory manually. After that, please restart
build process by calling ptxdist go again. If you cannot find a needed
source package, please tell us via [email protected]
Sometimes it even might happen, that ptxdist can download a file that is
claimed to be an archive, but then cannot decompress it. Reason is, that the
link didn’t deliver the requested archive, but an HTML containing a
message like: “Error - This file has been moved to …”. Please treat this
case in the same way as if nothing had been delivered by the link.
Finally you can create the rootfs by calling
ptxdist images
You will find the kernel-image linuximage and the flashfilesystem-image
root.jffs2 in directory platform-phyCARD-L/images. The NFS-mountable rootfs
will be located in platform-phyCARD-L/root.
 Close the terminal window.
In this section you learned how to configure and compile a new kernel.
Now you can add new features to your kernel, or remove features you do
not need.
58
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
3.1.1 Writing the Images into the Target’s Flash
In this passage you will find a description on how to write the newly
created images into the phyCARD-L’s flash memory. Before the
images can be written into the flash, the target will have to download
them from a TFTP server. This will be done from the command line of
the boot loader. The images will be copied into target’s RAM. Then you
will have to erase the part of the flash where you want to copy the images
to. Finally the images are written from the RAM to the flash.
In the default configuration you will find five partitions on the target: The
first partition contains the x-loader, the second is used to store the boot
loader and the third its settings, the fourth partition stores the Linux kernel,
and the fivth contains the root file system.
The five partitions have the following address ranges:
0x00000000 - 0x0007ffff (X-Loader)
0x00080000 - 0x0025ffff (Barebox)
0x00260000 - 0x0027ffff (Barebox Environment)
0x00280000 - 0x0067ffff (Linux Kernel)
0x00680000 - 0x01ffffff (Linux Root File System)
You should never erase the X-Loader or the Barebox
partition. If one of this both partitions is erased, you won’t be
able to start your target anymore. Refer to the chapter
“Installing Linux on the phyCARD-L” for detailed
information on how to restore your X-Loader and Barebox
partition in such a case.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
59
phyCARD-L
Quick Start Instructions
 First open a new terminal window if it is not opened yet.
 Copy the new images to the /tftpboot directory and exit:
cd platform-phyCARD-L/images
cp linuximage /tftpboot
cp root.jffs2 /tftpboot
exit
60
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
 Open Microcom and press the RESET button on the target.
You will see the output “Hit any key to stop autoboot.”
 Press any key to stop autoboot.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
61
phyCARD-L
Quick Start Instructions
 Type the following command to check your Barebox settings:
edit /env/config
You will see the configuration file which holds Barebox’s
environment variables.
 Make sure that the following values are set in the configuration file:
eth0.ipaddr=192.168.3.11
eth0.netmask=255.255.255.0
eth0.serverip=192.168.3.10
 Type CTRL-D to save the settings to the file.
 If you made any changes to the Barebox environment, type save to write
these changes to the Barebox environment partition, and then press the
target’s RESET button. The phyCARD-L reboots with the new settings
applied. Again, press any key to stop autoboot.
62
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
You can download the images from the TFTP server to the target’s
RAM, erase the required flash area, and write the images from the RAM
into the flash with just two simple commands: update_kernel and
update_rootfs.
 Type update_kernel nand linuximage to download the kernel using
TFTP and write it into the target’s flash. The copy process can take up
to a minute.
 Type update_rootfs nor root.jffs2 to download the rootFS using TFTP
and write it into the target’s flash. The copy process can take up to
several minutes.
 Press the RESET button on the target to restart the phyCARD-L with the
new kernel. The target will boot the newly created kernel.
 Close Microcom when the target has successfully finished with booting
the kernel and mounting the root file system.
Troubleshooting:
If any problem occurs after writing the kernel into flash, you
can restore the original kernel and root file system from your
setup CD-ROM.
You will find the kernel and root file system in the directory
PHYTEC/PCA-A-L1 phyCARD-L/Linux-Kit/BSP/Images.
 To restore the kernel, copy the file uImage-pca102 to your
host’s /tftpboot directory.
 Type update_kernel nand uImage-pca102 to download
and write the kernel into the target’s flash.
If you ever happen to damage your target’s root file system,
you can also find the original root file system in the
PHYTEC/PCA-A-L1
phyCARD-L/Linux-Kit/BSP/Images
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
63
phyCARD-L
Quick Start Instructions
directory on your setup CD-ROM.
 To restore the root file system, copy the file rootpca102.jffs2 to your host’s /tftpboot directory.
 Type update_rootfs nand root-pca102.jffs2 to download
and write the file system into the target’s flash.
In this section you learned how to download images from a tftp
server into the RAM of the target. The images have been
written from RAM to flash, and finally the target was started
with the new images.
3.2 Opening an Existing Project
In this section you will import an existing Eclipse project into your
workspace. The imported example project will be compiled with the cross
compiler. After compiling the project, you will copy and execute the newly
created program on the target.
64
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
3.2.1 Copying the HelloWorld Project
 Click the phyCARD-L-Kit icon on your KDE desktop.
 Right-click the HelloWorld directory and select Copy.
 Browse to your home directory.
 If the workspace directory doesn’t exist, create a directory workspace in
your home directory.
 Enter the workspace directory.
 Right-click in the workspace directory and select Paste One File.
 Close the Dolphin file browser.
3.2.2 Starting Eclipse and Importing the Example Project
 Click the Eclipse icon to start the application. You can find this icon on
your desktop.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
65
phyCARD-L
Quick Start Instructions
 Confirm the Workspace directory with OK.
The welcome screen appears.
 Select File ► Import… from the menu bar.
66
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
 Select Existing Projects into Workspace.
 Click Next.
 Select Browse.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
67
phyCARD-L
Quick Start Instructions
 Double-click the HelloWorld directory in your home/workspace
directory.
 Click OK.
 Select Finish to import the project.
68
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
 Close the Welcome screen.
 Select the Console tab.
The HelloWorld program will be compiled and the HelloWorld executable
is built for the target. Then the HelloWorld file is copied to the target using
FTP. After the file has been copied to the target, the program is executed on
the target using SSH. You should now see the “Welcome to the World of
the phyCARD-L!” message in the Console window.
You will see the following content in the Console window:
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
69
phyCARD-L
Quick Start Instructions
If the project is not built automatically, you will have to
check Project ► Build automatically from the menu bar.
You have successfully passed the first steps with the Eclipse
IDE. You are now able to import existing projects into the
Eclipse Workspace. You can compile an existing project and
execute the program on the target.
70
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
3.3 Creating a New Project
In this section you will learn how to create a new project with Eclipse and
how to configure the project for use with the GNU C/C++ cross
development toolchain.
 Open Eclipse if it isn’t already opened.
 Select File ► New ► Project… from the menu bar.
A new dialog opens.
 Select Managed Make C Project and click Next.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
71
phyCARD-L
Quick Start Instructions
 Enter the project name myHelloWorld and click Next.
 Click Next.
72
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
 Click Finish.
 Select Yes to open the C/C++ perspective.
You will see the C/C++ IDE with the myHelloWorld project.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
73
phyCARD-L
Quick Start Instructions
 Right-click on HelloWorld.c in the HelloWorld project which we have
worked with previously.
 Select Copy.
74
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
 Select the myHelloWorld project.
 Right-click and select Paste.
 Double-click on HelloWorld.c in the myHelloWorld project.
If Build Automatically from the Project menu is selected, the HelloWorld
application will now be compiled and created with the standard GCC
C/C++ compiler suitable for your host machine. You will find the
executable file, which can only be run on your host system, in the
workspace/myHelloWorld/Debug directory.
To compile your project for the phyCARD-L instead, you will have to use
the GNU C/C++ cross compiler.
 Right-click the myHelloWorld project and choose Properties.
The Properties dialog appears.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
75
phyCARD-L
Quick Start Instructions
 Select C/C++ Build.
 Enter arm-cortexa8-linux-gnueabi-gcc into the Command input field.
76
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
 Select GCC C Linker.
 Enter arm-cortexa8-linux-gnueabi-gcc into the Command input field.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
77
phyCARD-L
Quick Start Instructions
 Select GCC Assembler.
 In the Command input field, change the default as to arm-cortexa8linux-gnueabi-as.
 Click Apply.
78
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
 Select the Build Steps tab.
 Enter following command in the Post-build step Command input field:
ftp -u ftp://root:[email protected]/ ./myHelloWorld;
ssh [email protected] ./myHelloWorld
Be sure to enter the semicolon between ./myHelloWorld and
ssh.
Be sure the file myHelloWorld on the target will have
execution rights, because otherwise ssh will fail.
 Click Apply.
 Click OK.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
79
phyCARD-L
Quick Start Instructions
 Select Project ► Clean from the menu bar.
 Confirm with OK.
The project will be rebuilt.
 Select the Console tab.
If no errors occur while building the project, you will see the
following output:
80
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
You have successfully created your first own project with the
Eclipse IDE. You have configured the project to create an
application for your target platform.
3.4 Changing the Demo Application
Now we will extend the myHelloWorld application. The extended
myHelloWorld application will write an output to the first serial interface as
well as to the standard output.
 Open Eclipse if it is not opened yet.
 Double-click HelloWorld.c in the myHelloWorld project.
 First include the following two additional header files:
#include <unistd.h>
#include <fcntl.h>
 Then add the function write_tty(), which writes n bytes to the first serial
interface (which, on the phyCARD-M, is connected to the system
console /dev/console):
void write_tty (char *buffer, int count) {
int out;
out = open ("/dev/console", O_RDWR);
write (out, buffer, count);
close (out);
}
 Enter the following two lines in the main() function to declare the buffer
and call the write_tty() function.
char buf [] = { "Welcome to the World of the
phyCARD-L! (serial)\n" };
write_tty (buf, sizeof (buf) - 1);
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
81
phyCARD-L
Quick Start Instructions
In the next screenshot you can see the complete program.
 Save your program after changing the code.
The application will be compiled, built, copied to the target, and executed.
82
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
3.4.1 Executing the Program on the Target using Microcom
 Click the Microcom icon on the desktop.
 If you are not logged in, enter root and press Enter.
 Type ./myHelloWorld to start the application.
 You will see the following output:
Welcome to the World of the phyCARD-L! (serial)
Welcome to the World of the phyCARD-L!
 Close Microcom.
When you start the application over an SSH session, you only see one
output line. When you execute the program with Microcom, you see two
output lines.
The first line is a direct output on the serial interface. You can’t
see this line in an SSH session, because you are connected over
a TCP/IP connection to the target. With Microcom, however,
you have direct access to serial interface, so you can also see the
line that it written to the serial console.
In this passage you have changed an existing application. You also learned
how to access the serial interface. First you called the function open() on
the device /dev/console. The return value of this function was a file
descriptor. With the file descriptor you called the function write() to send n
bytes to the device /dev/console. After that, the file descriptor was closed
with the function close().
This procedure is in principle quite typical for Linux, because Linux treats
everything like a file.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
83
phyCARD-L
Quick Start Instructions
3.5 Starting a Program out of Eclipse on the Target
After compiling a project in Eclipse, the program is copied to the target and
directly executed. A program can also be executed on the target without
compiling a project. In the following section you will learn how to start a
program on the target as an external tool.
 Select Run ► External Tools ► External Tools… from the menu bar.
 Select Program.
84
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
 Select New.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
85
phyCARD-L
Quick Start Instructions
 In the Name input field, enter: myHelloWorld Target
 Enter /usr/bin/ssh in the Location input field.
 Enter [email protected] ./myHelloWorld into the Arguments field.
 Select Apply.
 Select Run.
If you want to execute the program the next time, you can use the
Run External Programs button from the menu bar.
86
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
3.6 Automatically starting the Program when booting the Target
In this passage you will integrate the myHelloWord program into the
startup process of the target. When you have finished this part, the
myHelloWorld application will be started automatically each time you are
starting the target.
The scripts for controlling the system startup will be found in
/etc/init.d. These are executed directly or indirectly by
/sbin/init, the father of all processes. The configuration of
/sbin/init is placed in /etc/inittab.
After system startup, /sbin/init will switch to the default run
level, as configured in /etc/inittab. It calls the run level master
script /etc/init.d/rcS to start or stop services provided by the
other scripts in /etc/init.d. This is done by the help of symbolic
links in the directory /etc/rc.d. These links point to the actual
startup scripts in /etc/init.d.
First you will have to create a startup script in /etc/init.d.
 Click the FTP for Target icon on your KDE desktop.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
87
phyCARD-L
Quick Start Instructions
 Browse to the target’s /etc/init.d directory. If an authorization dialog
should appear, just click OK (no password is required).
In the directory /etc/init.d you can see the existing scripts.
 Right-click in the opened window and select Create New ► Text File.
 Enter myHelloWorld.
 Click OK.
 Right-click on myHelloWorld and select Open with….
88
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
 Enter kwrite and click OK.
The text editor KWrite starts with an empty document.
 Enter the following two lines:
#!/bin/sh
/home/myHelloWorld
 Select File ► Save.
 Close the KWrite window.
 Close the FTP window.
 Click the Telnet for Target icon on your desktop.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
89
phyCARD-L
Quick Start Instructions
 Enter root and press Enter to login.
 The startup script we have just created with KWrite must be made
executable in order to run it later:
chmod a+x /etc/init.d/myHelloWorld
 Change to the directory /etc/rc.d. Type the following command:
cd /etc/rc.d
 Enter ls -l to list the directory content.
You can see the different links to the scripts in the directory /etc/init.d.
The scripts are started in alphabetic order: The script udev is the first
script started, because the link starts with S00…, whereas
S99zzz_PHYTEC_BSP_version_startup_script will be started last.
To start your myHelloWorld application automatically when the
system boots, you have to create a new link to the start script
/etc/init.d/myHelloWorld.
90
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Getting More Involved
 In /etc/rc.d, create a symbolic link which
/etc/init.d/myHelloWorld. Enter the following command:
points
to
ln -s ../init.d/myHelloWorld S99myHelloWorld
 Type ls -l again to check the newly created link.
 Close the window.
 Open Microcom.
 Push the RESET button on the target to restart your system.
The program myHelloWorld now starts automatically on startup. Because
its link in /etc/rc.d starts with S99…, you should see myHelloWorld’s
output near the output of the two other scripts that start with S99… (which
print all sorts of version information).
 Close Microcom.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
91
phyCARD-L
Quick Start Instructions
Now you can add your own programs to the root file system and start these
programs automatically when your phyCARD-L boots.
You have successfully passed the “Getting More Involved”
part of this Quick Start.
92
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Chapter 4
Project
Debugging an Example Project
Debugging an Example
20 min
In this chapter you will learn using the GNU debugger GDB on the host for
remote debugging in conjunction with the GDB server on the target. GDB
is the symbolic debugger of the GNU project and is arguably the most
important debugging tool for any Linux system.
First you will start the GDB server on the target. Then you will configure
the Eclipse platform and start the GNU debugger out of Eclipse using the
Debug view.
The CDT extends the standard Eclipse Debug view with functions for
debugging C/C++ code. The Debug view allows you to manage the
debugging and running of a program in the Workbench. Using the Debug
view you will be able to set breakpoints/watchpoints in the code and trace
variables and registers. The Debug view displays the stack frame for the
threads of each target you are debugging. Each thread in your program
appears as a node in the tree, and the Debug view displays the process for
each target you are running.
The GDB client is running on the host and is used to control the GDB
server on the target, which in turn controls the application running on the
target. GDB client and GDB server can communicate over a TCP/IP
network connection as well as via a serial interface. In this Quick Start we
will only describe debugging via TCP/IP.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
93
phyCARD-L
Quick Start Instructions
4.1 Starting the GDB Server on the Target
In this passage you will learn how to start the GDB server on the target.
The GDB server will be used to start and control the myHelloWorld
program.
To debug a program with GDB, the program needs extended debugging
symbols. This has already been added while building the program.
 Open Microcom.
 Type root and press Enter.
 Start the GDB server:
gdbserver 192.168.3.11:10000 myHelloWorld
94
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Debugging an Example Project
You have started the GDB server on the target. The GDB server is now
waiting for connections on TCP port 10000.
4.2 Configuring and Starting the Debugger in Eclipse
In this passage you will learn how to configure your project settings to use
Eclipse with the GNU debugger. After the configuration of your project
settings, the GNU debugger will start and connect to the GDB server on the
target.
 Start Eclipse if the application is not started yet.
 Select myHelloWorld in the Navigator window.
 Select Run ► Debug… from the menu bar.
A dialog to create, manage and run applications will appear.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
95
phyCARD-L
Quick Start Instructions
 Double-click C/C++ Local Application.
96
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Debugging an Example Project
 Click the Search Project… button.
 Click OK.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
97
phyCARD-L
Quick Start Instructions
 Select the Debugger tab.
 Select GDB Server from the Debugger drop-down box.
 Click the Browse button right beside the GDB debugger input field.
A new dialog opens to choose the GDB executable.
 Click File System.
 Navigate to the directory /opt/OSELAS.Toolchain-1.99.3/arm-cortexa8linux-gnueabi/gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27sanitized/bin.
 Select the file arm-cortexa8-linux-gnueabi-gdb.
 Click OK.
98
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Debugging an Example Project
 From the Connection drop-down box, select TCP.
 Enter 192.168.3.11 (the target’s IP address) in the Host name input
field. The host’s GDB will connect to this IP address to communicate
with the target’s GDB server.
 Click Apply.
 Click Debug.
A new dialog appears.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
99
phyCARD-L
Quick Start Instructions
 Select Yes to switch to the Debug perspective.
The Debug perspective opens and the debugger stops at the beginning of
the program automatically. The host’s GDB is now connected to the GDB
server on the target.
You have configured your project for remote debugging. You have started
the GNU debugger in Eclipse and connected the host’s GDB with the
target’s GDB server. You can now start to debug the project.
100
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Debugging an Example Project
4.3 Setting a Breakpoint
Now you will set a breakpoint in your program. The breakpoint will be set
on the last line of the function main(). If you resume the application, the
debugger will stop on this line.
 Select the last line in main().
 Right-click into the small grey border on the left-hand side and select
Toggle Breakpoint to set a new breakpoint.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
101
phyCARD-L
Quick Start Instructions
4.4 Stepping and Watching Variable Contents
In this part you will step through the example project with the debugger.
You will also learn how to watch the content of a variable.
 Click the Resume
line of the program.
button in the Debug window to step to the first
 Expand buf in the Variables window.
 Click the Step Over
line.
102
button in the Debug window to step to the next
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Debugging an Example Project
You will see the content of the buf variable in the Variables window.
 Click on the variable buf.
 Then click the button Step into
to enter the function write_tty().
The debugger stops in write_tty().
You will see the following variable window:
 Click on the variable buffer.
You will probably see a different address at the buffer pointer. Remember
what address is shown in your case; you will need this address later.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
103
phyCARD-L
Quick Start Instructions
4.5 Changing Variable Values
In this section you will change the value of a variable. At the end of this
part you will see the effect of this change.
 Select the count variable in the Variables window.
 Right-click on count and select Change Value….
104
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Debugging an Example Project
 Change the value of count to 7 and click OK.
 Open Microcom if the application is not already opened.
 Go back to Eclipse.
 Click the Step Over
button two times.
 Change to Microcom.
You will see the output Welcome in the Microcom window. This means
that due to changing the counter variable’s value, instead of printing the
full “Welcome to the World of the phyCARD-L” string, only the first seven
characters of the buffer were written to the screen.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
105
phyCARD-L
Quick Start Instructions
4.6 Using the Memory Monitor
In the last section of this chapter you will use the memory monitor to watch
the content at a memory address.
 Select the Memory tab.
 Click Add Memory Monitor.
 Enter the address of buffer and click OK. Remember that the variable’s
address might differ on your system.
106
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Debugging an Example Project
 Change the window size.
 Click Add Rendering(s).
 Select ASCII and click OK.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
107
phyCARD-L
Quick Start Instructions
You can see the contents of the variable buffer at the address 0xbe821c47
(or whatever address is used on your system).
 Now click the Resume
button from the menu bar.
The debugger stops at the breakpoint in the last line of main().
 Click the Resume
button to end the application.
You have successfully passed the debugging chapter. You are
now able to configure and use Eclipse for remote debugging.
You can step through a project, watch and change the content
of variables, and you can use the memory monitor to view the
content at a memory address.
108
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Chapter 5
Summary
Summary
This Quick Start manual provided a general “Rapid Development Kit”
description, as well as software installation advice and an example program
enabling quick out-of-the-box start-up of the phyCARD-L in conjunction
with the Eclipse IDE and GNU C/C++ software tools.
In the Getting Started section you learned how to configure your host to
provide a basis for working with your target platform. You installed the
Rapid Development Kit software and learned how to copy and run a
program on the target.
In the Getting More Involved section you got step-by-step instructions on
how to configure and build a new kernel, modify the example application,
create and build new projects, and copy programs to your phyCARD-L
using Eclipse.
The Debugging part of this Quick Start gave you information on setting up
and using the GNU debugger with the Eclipse IDE. You learned how to set
breakpoints, watching and changing variable contents and using the
memory monitor.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
109
phyCARD-L
Chapter 6
Quick Start Instructions
Installing Linux on the phyCARD-L
This part provides instructions on how to install the x-loader and the boot
loader (Barebox) on the phyCARD-L and how to write a kernel and/or a
root file system image into the target’s flash memory.
6.1 Installing the X-Loader and the Boot Loader
The boot loader used on the phyCARD-L is Barebox. In order to get it
started, you need to flash the X-Loader in addition. Flashing both will be
performed by the EVM FlashTool provided by Texas Instruments. The
EVM FlashTool uses the serial port and must be executed on a PC running
Microsoft Windows.
There’s also the possibility to get the both loaders flashed by
using an SD card. If the SD card is being made bootable, the
OMAP will automatically search for a file named MLO and
load and use it as X-Loader.
 Insert your PHYTEC Linux-phyCARD-L-Disc, navigate to the
PHYTEC\PCA-A-L1
phyCARD-L\Linux-Kit\Software\Tools\
EVM_FlashTool directory, and execute evmflash3530_v2_0_bin.exe to
install the EVM FlashTool.
 Configure JP1 by closing PIN 1+2 to boot from UART first.
 Connect the UART1 (connector P1) to your computer.
 Start the program EVM FlashTool.
The EVM FlashTool dialog opens.
110
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Installing Linux on the phyCARD-L
 Choose link type UART, select the right port and choose baud rate
115200 and mode BOOT ROM.
 Click Download in the tree Target Board under EVM1 / EVM2 Micron
NAND OMAP35xx.
 Select the first rider Download and there the device type NAND.
 Check Erase Entire Flash.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
111
phyCARD-L
Quick Start Instructions
 In the Program section, click << Add File, add file PHYTEC\PCA-A-L1
phyCARD-L\Linux-Kit\BSP\X-Loader\bin\x-load.bin.ift from the CD
and set its Address to 0x20000000. Then click << Add File again, add
file PHYTEC\PCA-A-L1 phyCARD-L\Linux-Kit\BSP\Barebox\bin\
barebox-image and set its Address to 0x20080000.
 Click Download.
 When you’ll see the Message Reset Target to proceed, power up the
baseboard.
112
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Installing Linux on the phyCARD-L
 When finished, power down the baseboard.
 Configure JP1 by opening PIN 1+2 to boot from NAND Flash first.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
113
phyCARD-L
Quick Start Instructions
6.2 Configure Barebox Environment Variables
The following steps will be done on a Linux platform. We assume that you
have configured your host platform and have executed the setup program
provided on the Linux-phyCARD-L-Disc. Information on how to configure
the host platform can be found in the Getting Started part of this Quick
Start.
 Connect the serial cable with the UART1 (connector P1) on the target
and the first serial interface on your host.
 Connect the cross-over Ethernet cable with the connector X27 on the
target and the right network card of your host.
 Click the Microcom icon on your desktop
Microcom was configured during the setup with the following
configuration:
115200 baud, 1 start bit, 8 data bits, 1 stop bit, no parity, no flow control.
If you want to use a program other than Microcom for serial
communication, you will have to setup that program with these settings.
 Connect the AC adapter with the power supply connector PWR (12V)
on your board.
114
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Installing Linux on the phyCARD-L
 Press any key to stop autoboot.
 Type edit /env/config to check and edit the configuration file.
You will see the configuration file that holds Barebox’s environment
variables.
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
115
phyCARD-L
Quick Start Instructions
The default IP address of the target is 192.168.3.11, and the default server
IP address is 192.168.3.10. If you want to set up a different network
configuration, you can edit the following lines of the configuration file:
eth0.ipaddr=target IP address
eth0.netmask=target netmask
eth0.serverip=server IP address
 Type CTRL-D to save the settings to the file.
 Type save to write the settings to the target’s flash.
 Press the RESET button on your board. The target will restart with the
new settings applied.
6.3 Restoring the Barebox Default Configuration
If you want to restore the default Barebox configuration, you can use the
following commands to delete the Barebox environment partition:
 erase /dev/nand0.bareboxenv
After pressing the RESET button on your board, the default Barebox
configuration will be used.
 Type save to write the default settings to the target’s flash.
After a new Reset you won’t get the meassages Wrong magic on /dev/env0
and no valid environment found any more.
116
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Installing Linux on the phyCARD-L
6.4 Writing the Kernel / Root File System into Flash
Before the kernel and/or root file system can be written into the target’s
flash, the target will have to download the image from a TFTP server. This
will be done from the command line of the boot loader. First the image will
be downloaded via TFTP and copied into target’s RAM. Then the part of
the flash where the kernel or root file system should be written to must be
erased. Finally the kernel or root file system image can be transferred from
RAM into flash.
In the directory PHYTEC/PCA-A-L1 phyCARD-L/Linux-Kit/BSP/Images on
your setup CD-ROM you can find a file called uImage-pca102 – this file is
the Linux kernel image. There is another file, root-pca102.jffs2; this file
contains the Linux root file system.
 Copy the files uImage-pca102 and root-pca102.jffs2 to your host’s
/tftpboot directory.
You can download the kernel or root file system from the TFTP server into
the target’s RAM, erase the corresponding flash partition, and write the
kernel from RAM into flash with one simple command, update_kernel or
update_rootfs, respectively.
Before executing these commands, you should check that your Barebox
environment is properly configured.
 Open Microcom and press the RESET button on the target.
You will see the message “Hit any key to stop autoboot.”
 Press any key to stop autoboot.
 Type the following command to check your Barebox settings:
edit /env/config
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
117
phyCARD-L
Quick Start Instructions
You will see the configuration file which holds Barebox’s
environment variables.
 Make sure the following values are set within the configuration file:
eth0.ipaddr=target IP address
eth0.netmask=target netmask
eth0.serverip=server IP address
 Type CTRL-D to save the settings to the file.
 If you have made any changes to the Barebox environment, type save to
write these changes to the target’s flash. Then press the RESET button
on the target. The board reboots with the new settings applied. Then,
again, press any key to stop autoboot.
 Type update_kernel nand uImage-pca102 to download and write the
kernel into the target’s flash.
 Type update_rootfs nand root-pca102.jffs2 to download and write the
root file system into the target’s flash.
The copy process can take quite a while, depending on the speed of
your system.
 Press the RESET button on the board to restart your target.
The target should now start with the kernel and root file system you
have written into the flash.
118
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
phyCARD-L
Installing Linux on the phyCARD-L
Document:
phyCARD-L with Linux
Quick Start Instructions
Document Number:
L-743e_0 December 2010
How would you improve this manual?
Did you find any mistakes in this manual?
page
Submitted by:
Customer number:
Name:
Company:
Address:
Return to:
PHYTEC Messtechnik GmbH
Robert-Koch-Str. 39
D-55129 Mainz
Fax: +49 (6131) 9221-26
© 2010 PHYTEC Messtechnik GmbH
L-743e_0
119
Published by
 2010 PHYTEC Messtechnik GmbH
Ordering No. L-743e_0
Printed in Germany
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement