MasterofProject
CSDN home>

Development of Linux cross compiler application for on Power C/C++ system

Published in17:34 2015-08-12| Time reading| sourceCSDN| ZeroArticle comments| authorCSDN

Abstract:This article will introduce how to use SDK for Linux on Power IBM IBM integrated environment using Advance Toolchain and QEMU user mode for Power IBM server development cross compiler application. The SDK is free of charge based on the eclipse integrated development environment (integrated development environment, IDE), integrated C / C + + source code development and advance toolchain, Post-Link optimization and typical Linux performance analysis tools,...

brief introduction

IBM & reg; software development kit (SDK) for Linux on power is free of charge based on the eclipse integrated development environment (integrated development environment, IDE). This SDK integrates C/C++ source code development with Toolchain Post-Link, Optimization Advance and typical Linux performance analysis tools, including Oprofile, Perf, and Valgrind.

This paper introduces how to use IBM SDK provides integrated environment using IBM advance toolchain and QEMU user mode for Linux on power development cross compile application, this allowed one run and debugging for a processor to compile the application to make it in the other a have different architecture processor operation (this is the cross compile / debug).

requirement

For the use of QEMU in the SDK user mode, the need to install the Advance Toolchain IBM cross compiler, QEMU user mode and SDK for IBM on Linux Power.

For the purpose of this article, we use the following version:

  • Advance Toolchain cross compiler 8.0-1 IBM
  • SDK for Linux on Power IBM 1.6
  • QEMU user mode

Important tips:In the preparation of this paper, SDK 1.6 has been introduced, but has not yet provided support for the ppc64le (on Power Linux version of the small end) of the package. In order to provide the latest improvements, the SDK team created a software package that can be installed.

The operating system used is Fedora 20.

Install Advance Toolchain IBM cross compiler

IBM advance toolchain for powerlinux "is a set of open source development tools and runtime library, which enables the user to on linux using the following the latest IBM Power & reg; hardware features (in the publication of this paper).

  • IBM POWER8 support
  • POWER8 optimized scheduler
  • Transactional Memory POWER8 support
  • Crypto Operations OWER8 support
  • Fusion POWER8 support

Perform the following steps to install the Advance Toolchain IBM cross compiler.

1, download the 8.0-1 AT cross compiler universal package

2, download the 8.0-1 AT cross compiler ppc64le version

3, run the following command to install two kinds of packages:

Yum install -y./advance-toolchain-at8.0-cross-common-8.0-1.x86_64.rpm a.$sudo

Yum install -y./advance-toolchain-at8.0-cross-ppc64le-8.0-1.x86_64.rpm b.$sudo

You will notice that the 8.0-1 AT cross compiler is installed and the directory is /opt/at8.0.

Install x86_64 version of SDK

X86_64 version of the SDK IBM support Advance Toolchain IBM cross compiler version 7.0-1, 7.1-0 and 8.0-1. You can also use it to create a synchronization project, which allows you to use a remote Power IBM server development application.

For more information on how to create a synchronization project, see the SDK user guide. If you want to access the Power server, please visitMiniCloudWeb site and submit your request. It is free of charge!

Return to SDK installation. Follow the steps below:

1, download the x86_64 version of SDK for Linux on Power IBM

 2, run the following command to install the software package.

Yum install -y./ibm-sdk-lop-1.6.0-1.x86_64.rpm $sudo

Install QEMU user mode

QEMU is a widely used open source computer simulator and virtual machine. This user mode allows the program to be compiled on one processor for another, so that cross - compiler applications can run and debug.

When SDK 1.6 is released, the available QEMU user mode version of the supported release does not contain patches that support ppc64le. In order to overcome this situation, the SDK team created a package that can be installed.

To install the QEMU user mode, follow these steps.

  1, DownloadQEMUUser-mode software package.

2, run the following command to install this software package.

Yum install -y./qemu-user-space-emulator-1-1.x86_64.rpm $sudo

Now, QEMUcanDirect input, but if you want to use the latest version of QEMU, you can build it locally. This process is very simple, and the steps are as follows:

Before you start, make sure you have installedGit.

1 using the following command to clone QEMU source code:

Clone git://git.qemu.org/qemu.git a.git

./qemu b.cd

2 use the following command to create a build directory:

-p bin/debug/native a.mkdir

Bin/debug/native b.cd

3 use the following command to install dependencies:

Yum install -y zlib.x86_64 $sudo glibc-devel.x86_64 zlib-devel.x86_64 pixman-devel.x86_64 libfdt-devel.x86_64 glib2-devel.x86_64

4 use the following command to configure the project:

--disable-debug-tcg --enable-tcg-interpreter --target-list= ppc64abi32-linux-user "ppc64le-linux-user ppc64-linux-user../../../configure" --extra-cflags= --disable-vnc "-O3"

5 run the following make command.

-j5 make

6 use the following command to install the QEMU library.

Make install $sudo

Important tips:After the installation is complete, the QEMU library is located under /usr/local/bin, but SDK hopes that their directory is /opt/ibm/qemu-user-space-emulator. The following steps provide a way to solve this problem:

 

1 use the following command to create the directory:

MKDIR -p /opt/ibm/qemu-user-space-emulator $sudo

2 use the following command to copy the library from /usr/local/bin to /opt/ibm/qemu-user-space-emulator:

CP /usr/local/bin/qemu-ppc64 /usr/local/bin/qemu-ppc64abi32 /usr/local/bin/qemu-ppc64le /opt/ibm/qemu-user-space-emulator $sudo

Create cross compiler

Using SDK for Linux on Power IBM to create cross compilation project is very simple. After completing the installation of Toolchain QEMU, Advance, and SDK, you can start developing the C/C++ cross compiler application.

1 the first step is to start SDK. You can start by selecting the SDK or using the command line at the user interface.

   A. user interface:

   Search SDK for Linux on Power IBM 1.6.

B. using command line:

   Run the following command:/opt/ibm/ibm-sdk-lop/ibm-sdk-lop

When SDK starts, you will be prompted to select a workspace.

Figure 1 definition of work area

After you have defined the workspace, you can use the SDK.

 

Figure 2 SDK view

2 now, you can create cross compiler projects. stayStarted GettingTab, selectIBM Advance Toochain New C Project IBM or Advance Toolchain C++ Project. 

Figure 3 select project type

Select item type

3 after selecting the required item type, you need to configure the new project, including the name, location, type, and tool chain.

Figure 4 project configuration

4 can also tune applications by selecting the processor type.

 

Figure 5 Tuning Applications

5 ClickFinishSet items in the workspace you created earlier. It will be located on the Explorer Project tab.

 

Figure 6 project structure
Project structure

 

Build cross compiler

Now that you have created the project, you can start building it. Select items, right click and selectProject Build.

Figure 7 construction projects

Construction project

After the completion of the construction process, the cross compiler library will appear in the Explorer Project tab under theBinariesNode in.

Fig. 8 construction results

Construction result

 

Run cross compilation project using QEMU user mode

To run cross compilation projects using the QEMU user mode, you need to perform the following steps.

1 choose your project, right click, and then clickAs Qemu - Run.

 
Figure 9 using QEMU to run cross compiler applications
Run cross compiler applications using QEMU

Since this is the first time you try to use QEMU to run the application. Therefore, it is necessary to configure the application to a new starter.

 
Figure 10 QEMU starter configuration
QEMU starter configuration

2 now, the application needs to be selected. single clickBrowse, will display the Selection Program dialog box.

 
Figure 11 binary selection
Binary choice

3 ClickOK. This will automatically fill in all required fields. QEMU is a required field position and path, it is needed to run the application base storage location.

Important tips:If your application relies on a specific library, you need to process this dependency before running the application.

 
Figure 12 field required
A required field

4 to set the location of the new library, click the Paths Libraries section of theBrowse.

 
Fig. 13 library path manager
Library path manager

5 in the Paths Libraries dialog box, you can use the option Path New or Remove to add or delete path location.

An optional step is to set the QEMU option. When you select an option, the output of this option will be included in a file named qemu.log, which is displayed on the Explorer Project tab. The options available are shown below.

 
Figure 14 QEMU options
QEMU options

top
Zero
step on
Zero