Develop with C/C++

From BUG Wiki

Jump to: navigation, search

Contents

Overview

As BUG is a Linux system, the standard Linux C/C++ tools are available for compiling binaries. Poky Linux provides a SDK that can be used for BUG SW 1.4.x releases.

BUG Version

BUG SW 1.3 - 1.4.x: Poky Linux

A version of the Poky Linux SDK is available from our community website, here. (http://bugcommunity.com/development/poky_sdk/poky-eabi-glibc-x86_64-arm-toolchain-sdk-1.4.3.tar.bz2) This version of the SDK is compiled for 64-bit Linux host computers. For other architectures, please ask us on Contact_Information IRC.

BUG SW 2.0 on OMAP: Angstrom

BUG 2.0 uses the Angstrom distro built for OMAP. The x86-64 toolchain SDK is available here: http://bugcommunity.com/development/angstrom_sdk/

Installing the SDK

The SDK is designed to be installed into /usr/local:

$ tar xfj poky-eabi-glibc-x86_64-arm-toolchain-sdk-1.4.3.tar.bz2
$ sudo mv usr/local/poky /usr/local
$ cd /usr/local/poky/eabi-glibc/arm/
$ source environment-setup 
$ arm-poky-linux-gnueabi-gcc --version
arm-poky-linux-gnueabi-gcc (GCC) 4.1.2
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Building helloworld.c

Let's compile helloworld for BUG, to show the tools are working:

$ mkdir /tmp/hwt
$ cd /tmp/hwt
$ wget http://dora.eeap.cwru.edu/msb/131-F07/code/helloworld.c
$ arm-poky-linux-gnueabi-gcc -o hello helloworld.c
$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.10, not  stripped

Running on BUG

Now we'll scp the program to a BUG and see if it runs:

$ scp hello root@[BUG IP Address]:
$ ssh root@[BUG IP Address]
root@BUG:~# ./hello
Hello, world!

Further Reading

Resources