Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This page shows you how to:

  • Get set-up for Linux Application Development
  • Create a simple application
  • Debug applications on Linux

Setup

To get setup, you will need to:

  1. Determine the toolchain and SDK you need
  2. Install the toolchain and SDK
  3. Install and setup an IDE

ToolChain

A toolchain is needed to build custom applications. You can use:

  1. A pre-built toolchain for our XFCE demo image, or
  2. Build one yourself using the YOCTO tools we provide.

Demo Toolchain

The download link for this is on the releases page.  Grab the latest version and put it XXXX.

To install

Building a Toolchain

If you have the YOCTO bits installed from this page, you can use it to generate a toolchain.

Execute the following commands:

$ cd fsl-community-bsp
$ source setup-environment build
$ bitbake opal6-image-base -c populate_sdk

To install, do the following:

$ cd ~/fsl-community-bsp/build/tmp/deploy/sdk
$ ./poky-glibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-2.0.1.sh

The actual installer name may be different to that used above. Just follow the prompts to complete the installation. In most cases you can simply accept the defaults.

IDE Setup

We use the CodeBlocks IDE for development and this section details how to set it up.  

First, download and install CodeBlocks.  Use the Ubuntu Software Centre, or the following command line:

$ sudo apt-get install codeblocks codeblocks-contrib

To configure CodeBlocks for our toolchain:

We need to configure CodeBlocks to use our toolchain and sysroot so do the following:

  1. Start CodeBlocks
  2. Open Settings->Compiler
  3. Choose ‘GNU GCC for ARM’ from ‘Selected Compiler’ and click ‘Copy’
  4. Give your new compiler a name e.g. YOCTO compiler for Opal-6
  5. Now click the ‘Toolchain executables’ tab and browse to your sdk installation directory. You are looking for the parent to the compilers bin directory which in our case is: /opt/poky/2.0.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi
  6. Now fill in the Program Files by prepending ‘arm-poky-linux-gnueabi-’ to each of gcc, g++ and ar. You should end up with the following:

 

Debugger Setup

Debugging applications on Opal-6 requires two components:

  1. gdbserver running on Opal-6
  2. gdb client running on the VM

The Opal-6 images include the gdbserver components, so we just need to configure CodeBlocks to connect via the gdb client:

  1. Start CodeBlocks
  2. Open Settings→Deugger
  3. Click the 'GDB/CDG debugger' option from the left side menu
  4. Click 'Creage Config' button and enter a name for this debugger.  e.g. "Opal-6" and press ENTER.
  5. Click "Opal-6" on the left hand menu and paste the path of your Opal-6 toolchain debugger into the Executable Path text box:
    e.g. /opt/poky/2.0.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gdb
  6. Press OK

To set this debugger as the default for Opal-6, do the following:

  1. Open Settings→Compiler
  2. Click the Toolchain Executables tab.
  3. Select the Opal-6 compuler from the menu
  4. Change Debugger to Opal-6 from the meny and click OK.

Creating a Linux Application

These steps will show how to create and compile a simple project for Opal-6.

First we will create the project and configure it to use the Opal-6 tools:

  1. Start CodeBlocks
  2. Select File->New->Project from the menu, then select Empty Project
  3. Set the title as Hello World and choose a project folder
  4. Click Next and set the compiler to YOCTO Compiler for Opal-6 
  5. Click Finish

Now we need to add a file:

  1. Select File->New->File  and select C/C++ Source

Debugging 

 

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.