Gumstix programming

From GumstixDocsWiki

(Redirected from Programming)
Jump to: navigation, search

As of 2010, all Gumstix customers should be using Gumstix OpenEmbedded, not Buildroot.

The Gumstix Developer's website is www.gumstix.org


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

For legacy customers still requiring buildroot:


Since the Gumstix embedded computers run a full Linux environment, programmers can leverage the vast library of Linux development tools.

Normally, development for the Gumstix is done on a host computer using a cross-compilation toolchain. This allows you to develop on a more powerful machine, and then install the results on the Gumstix. The cross-compilation toolchain is built automatically when you initially compile the Buildroot.

Contents

Ported Packages

A large library of ready-to-go software is available in the Gumstix Buildroot. Before writing your own application or porting an existing one, check the Buildroot -- someone may have done the work for you!

Languages

For new development, the Gumstix supports the following languages out of the box:

  • C
  • sh scripting
  • C++ (Buildroot revision 1444 and later)

The following languages can be easily enabled in the Buildroot:

  • C++
  • Java
  • Awk
  • Perl (incarnated as MicroPerl)
  • Python
  • Tcl


(Note that -- except for the scripting languages -- the development tools are installed on the host computer, not the Gumstix itself, to save space. You can install the development tools on the Gumstix by enabling the native toolchain in the target filesystem option in the Buildroot configuration menu.)

The following languages have been built and run on a Gumstix:

Porting Third-Party Software

Most Linux software can be recompiled for the Gumstix with some simple configuration options -- though there are exceptions, particularly for software that was specifically designed to run on a different sort of processor (such as the Intel x86/Pentium line). Fortunately, these applications are few and far-between.

For applications that use the autoconf scripts for configuration -- which most Linux applications do -- porting is often very easy. The compilation instructions for these applications usually ask you to run a script, named configure, as a first step. This script will do most of the porting work for you.

First, make sure you have the cross-compile toolchain (gumstix-build/build_arm_nofpu/staging_dir/bin) in your path. Check the instructions on Buildroot on how to compile the cross compilation toolchain on your host system.

Then, simply enter (on Linux)

./configure --host=arm-linux (any other options you want here)

Or, more specifically for those cross compiling on an i686-linux machine

CC=arm-linux-gcc ./configure --host=arm-linux --build=i686-linux --prefix=/PATH/TO/YOUR/BUILDROOT/build_arm_nofpu/root

Followed by

make


This should build the application using the Gumstix tools. You'll have to collect the application's compiled binaries and files and manually copy them to your Gumstix.

Alternatively, to have configure automatically deposit the files into your Buildroot output directory, add an additional option to configure and run the install step:

./configure --host=arm-linux --prefix=/PATH/TO/YOUR/BUILDROOT/build_arm_nofpu/root
make && make install

Then, to rebuild your flash filesystem image, enter your Buildroot and type make.

Note that this will perform a one-time installation of the software into your Buildroot. If you clean or reinstall the Buildroot, you will need to do this again.

Adding Software to the Buildroot

If you need a particular software package that isn't in the Buildroot, and get tired of compiling it by hand, you can add it to the Buildroot itself.

If you think others might also have use for this package, you can submit it for inclusion in the official Gumstix Buildroot, thereby making it available to all your fellow Gumstix users with a simple menu selection.

Details on this and other aspects of the Buildroot can be found on the Buildroot page.

Kernel programming

The Kernel programming page has a sample character driver.

Debugging with gdb

From Box to Debug

In this example the program to debug is named ‘arm_executable’:


  • I used ‘make menuconfig’ in the buildroot to enable building both GDB server and GDB client on host;
  • built the buildroot using ‘make’;
  • flashed the new rootfs to the gumstix;
  • ran ‘gdbserver localhost:2000 arm_executable’ on the gumstix;
  • ran gdb from directory ‘buildroot/toolchain_build_arm_nofpu/gdbclient-6.3/gdb/’ with options ‘-symbols arm_executable’ – i.e. ‘./gdb -symbols arm_executable’
  • used command ‘target remote 192.168.1.103:2000’ in gdb, where 192.168.1.103 is the IP of my gumstix;
  • and everything worked!


The trick here is to use the ‘-symbols’ option instead of just ‘./gdb arm_executable’; for me this got rid of a problem that manifested as “SIGILL – illegal instruction” in gdb. Another thing to watch out for is to specify a path when running gdb, because you don’t want the normal gdb likely installed on your system and in your path to be used.

Personal tools