Phytec Linux-Kit phyCARD-M Programming manual

PHYTEC Messtechnik GmbH
A product of a PHYTEC Technology Holding company
Quick Start Instructions
Linux-Kit
phyCARD-M
Using Eclipse and the GNU Cross Development Tool Chain
Note: The PHYTEC Linux-phyCARD-M-Disc includes the electronic
version of the English phyCARD-M Hardware Manual.

phyCARD-M Quick Start Instructions
© 2010 PHYTEC Messtechnik GmbH L-746e_1
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.
EUROPE NORTH AMERICA
Address: 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
Information:
+49 (800) 0749832
1 (800) 278-9913
Technical
Support:
+49 (6131) 9221-31
1 (800) 278-9913
Fax: +49 (6131) 9221-33 1 (206) 780-9135
Web Site: http://www.phytec.de http://www.phytec.com
1st Edition: July 2010

phyCARD-M Table of Contents
© 2010 PHYTEC Messtechnik GmbH L-746e_1
Chapter 1 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
5 min
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
35 min
2.2.2 Set Up Network Card Configuration ............................14
2.2.3 Disabling the Firewall...................................................15
2.2.4 Set Up TFTP Server......................................................16
2.3 Linux-phyCARD-M-Kit Setup.................................................18
2.3.1 Starting the Setup..........................................................20
2.4 Advanced Configuration Information ......................................29
2.5 Connecting the Host with the Target........................................30
2.6 Copying an Example to the Target...........................................35
2.6.1 Copying a Program to the Target..................................35
2.6.2 Using Telnet to Execute a Program on the Target........37
2.6.3 Using SSH to Execute a Program on the Target...........38
2.7 Advanced Information..............................................................41
2.7.1 Copying a Program to the Target with the Command......
Line ...............................................................................41
2.7.2 Executing a Program on the Target ..............................41
2.7.3 Executing a Program directly on the Target using SSH41
Chapter 3 Getting More Involved.....................................42
3.1 Configuring and Compiling the Kernel....................................42
70 min

phyCARD-M Quick Start Instructions
3.1.1 Writing the Images into the Target´s Flash .................. 48
3.2 Opening an Existing Project..................................................... 52
3.2.1 Copying the HelloWorld Project .................................. 52
3.2.2 Starting Eclipse and Importing the Example Project ... 53
3.3 Creating a New Project............................................................. 58
3.4 Changing the Demo Application.............................................. 68
3.4.1 Executing the Program on the Target using Microcom 70
3.5 Starting a Program out of Eclipse on the Target ...................... 71
3.6 Automatically Starting the Program when Booting the Target 74
Chapter 4 Debugging an Example Project.......................79
4.1 Starting the GDB Server on the Target .................................... 80
4.2 Configuring and Starting the Debugger in Eclipse .................. 81
35 min
4.3 Setting a Breakpoint ................................................................. 86
4.4 Stepping and Watching Variable Contents .............................. 87
4.5 Changing Variable Values ....................................................... 89
4.6 Using the Memory Monitor...................................................... 91
Chapter 5 Summary............................................................94
Chapter 6 Installing Linux on the phyCARD-M.............95
6.1 Installing the Boot Loader........................................................ 95
6.2 Configure Barebox Environments Variables ......................... 100
6.3 Restoring the Barbebox Default Configuration ..................... 102
6.4 Writing the Kernel / Root File System into Flash.................. 103
© 2010 PHYTEC Messtechnik GmbH L-746e_1

phyCARD-M Introduction
Chapter 1 Introduction
5 min
In this Quick Start you can find general information on the PHYTEC
phyCARD-M, 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-M,
mounted on the PHYTEC Development Board, in conjunction with the
Eclipse development tool.
Please refer to the phyCARD-M 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-M-Disc:”
•The PHYTEC phyCARD-M Hardware Manual.
•phyCARD-M 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-M in
conjunction with the Eclipse and GCC C/C++ software development
tool chain.
© 2010 PHYTEC Messtechnik GmbH L-746e_1 1

phyCARD-M Quick Start Instructions
2© 2010 PHYTEC Messtechnik GmbH L-746e_1
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-M 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-M 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-M-Disc contains supplemental information on
embedded microcontroller design and development in general.

phyCARD-M 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-746e_1 3

phyCARD-M Quick Start Instructions
1.5 System Requirements
Use of this “Rapid Development Kit” requires:
•The PHYTEC phyCARD-M. (i.MX 35)
•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.0 (x86) and the KDE 3.5 desktop.
•Recommended free disk space: at least 2 GB.
For more information and updates, please refer to the following sources:
http://www.phytec.de
4© 2010 PHYTEC Messtechnik GmbH L-746e_1

phyCARD-M Introduction
© 2010 PHYTEC Messtechnik GmbH L-746e_1 5
1.6 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.

phyCARD-M Quick Start Instructions
6© 2010 PHYTEC Messtechnik GmbH L-746e_1
•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 an phyCARD-M 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.

phyCARD-M Getting Started
Chapter 2 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.0 (x86) and the KDE 3.5 desktop.
When you are installing openSUSE 11.0, you can select KDE 3.5 as
Desktop selection. The default packages to use openSUSE 11.0 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-746e_1 7

phyCARD-M 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-746e_1

phyCARD-M 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-746e_1 9

phyCARD-M 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-746e_1

phyCARD-M Getting Started
•
•Type python-devel and click the Search button.
•Check python-devel.
•Type tftp and click the Search button.
•Check the packages tftp and yast2-tftp-server
© 2010 PHYTEC Messtechnik GmbH L-746e_1 11

phyCARD-M Quick Start Instructions
•Type qt3-devel and click the Search button.
•Check qt3-devel.
•Select the filter Patterns.
•Select Basis Development, C/C++ Development, and Tcl/Tk
Development.
•Click Accept.
12 © 2010 PHYTEC Messtechnik GmbH L-746e_1

phyCARD-M Getting Started
Some additional packages will be selected automatically to resolve any
dependencies.
If problems occur while resolving dependencies, we re-
commend going back to a default configuration.
•Click Continue to install the packages.
•Click Finish.
© 2010 PHYTEC Messtechnik GmbH L-746e_1 13

phyCARD-M 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.
14 © 2010 PHYTEC Messtechnik GmbH L-746e_1

phyCARD-M Getting Started
•Select the right network card (if more than one network card is installed
on your host).
•Click Edit to enter the Network Card Setup.
•Choose Static address setup.
•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-746e_1 15

phyCARD-M 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 Finish to complete
the settings.
The firewall is now disabled for this network card.
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.
16 © 2010 PHYTEC Messtechnik GmbH L-746e_1
Table of contents
Other Phytec Microcontroller manuals

Phytec
Phytec LAN-087e.A2 phyCORE-i.MX 8 Alpha Kit User manual

Phytec
Phytec phyCORE-i.MX31 User manual

Phytec
Phytec phyCORE-SC520 User manual

Phytec
Phytec SYS TEC ELECTRONIC CANopen Chip164 Programming manual

Phytec
Phytec IoT-Enablement-Kit 1 User manual

Phytec
Phytec phyCORE-XScale/PXA255 Installation and operating instructions

Phytec
Phytec phyCORE-MPC5200B tiny User manual

Phytec
Phytec phyCORE-167CS User manual

Phytec
Phytec nanoModul-164 Programming manual

Phytec
Phytec miniMODUL-537 User manual