Eclipse from Box to Debug

From Gumstix User Wiki

Jump to: navigation, search

This page is meant to serve as a quickstart guide that takes you from opening an Overo + Expansion out of the Box up to Remote Debugging with Eclipse on Ubuntu.

Contents

Setting up Minicom

  1. sudo apt-get install minicom
  2. sudo minicom -s
  3. [Serial port setup] -> A - Serial Device -> /dev/ttyUSB0 -> [enter]
  4. [Serial port setup] -> F - Hardware Flow Control -> NO -> [enter]
  5. [Modem and dialing] -> A - Init String -> [empty] -> [enter]
  6. [Modem and dialing] -> B - Reset String -> [empty] -> [enter]
  7. [Modem and dialing] -> K - Hang-up String -> [empty] -> [enter]
  8. [Save as dfl]
  9. [Exit from Minicom]

Power & Boot

  1. Plug the gumstix into the expansion board
  2. Plug the expansion board into your ethernet router / switch / whatever
  3. Plug in the micro-SD
  4. Plug a mini-usb plug (as you would use with a camera) into the mini-usb port labeled console
  5. sudo minicom -o # disables modem and dialing settings
  6. Plug in the 5v power supply
  7. Watch the system boot

OpenEmbedded [OE] Toolchain on Ubuntu

Official (and Thorough) Documentation

   sudo apt-get install git-core
   cd
   mkdir -p ~/overo-oe/user.collection
   cd ~/overo-oe
   git clone git://gitorious.org/gumstix-oe/mainline.git org.openembedded.dev
   cd org.openembedded.dev
   git checkout --track -b overo origin/overo
   cd ~/overo-oe
   git clone git://git.openembedded.net/bitbake bitbake # just try this again if it hangs up
   cd bitbake
   git checkout 1.8.18
   cd ~/overo-oe
   cp -r org.openembedded.dev/contrib/gumstix/build .
   cp ~/.bashrc ~/bashrc.bak
   cat ~/overo-oe/build/profile >> ~/.bashrc
   source ~/overo-oe/build/profile

The important part:

   bitbake gdb-cross

Gumstix Setup

From the previous step your Gumstix should have started configuring itself and hopefully is done, leaving you at the login prompt

   root
   passwd #(change your password)
   ifconfig # configure as necessary. I assume that your IP address is 192.168.1.150
   opkg install gdbserver

Hello World!

This is all taking place on the Ubuntu system (192.18.1.100)

hello.c

   mkdir ~/overo-oe/Code/
   cd ~/overo-oe/Code/
   vim hello.c
   #include <cstdio>
   
   int main(int argc, char ** argv) {
     printf("Hello World!\n");
   }

Makefile

   vim Makefile
   CGTOOLS = ~/overo-oe/tmp/cross/armv7a
   
   # Compiler and Linker flags
   C_FLAGS += -Wall -g
   CPP_FLAGS += -Iinclude
   LD_FLAGS += -g -lm
   
   # compiler
   CC = $(CGTOOLS)/bin/arm-angstrom-linux-gnueabi-g++ $(C_FLAGS) $(CPP_FLAGS) -c
   LINK = $(CGTOOLS)/bin/arm-angstrom-linux-gnueabi-g++ $(LD_FLAGS)
   STRIP = $(CGTOOLS)/bin/arm-angstrom-linux-gnueabi-strip 
   
   .PHONY: all clean
   all: clean hello
   clean:
        rm hello *.o -rf
   hello: hello.o
        $(LINK) -o hello hello.o
        cp hello hello.debug
        $(STRIP) hello
   hello.o: hello.c
        $(CC) -o hello.o hello.c

Compile

Now we'll compile the program with the debug symbols, strip the symbols, and copy it to the gumstix (192.168.1.150)

   make
   cp ./hello ./hello.debug
   ~/overo-oe/tmp/cross/armv7a/bin/arm-angstrom-linux-gnueabi-strip ./hello
   
   ./hello # fails because it can't run on your architecture
   ssh-copy-id root@192.168.1.150
   scp ./hello root@192.168.1.150:/hello #
   ssh root@192.168.1.150 "/hello" # succeeds
   ssh root@192.168.1.150 "gdbserver 192.168.1.100:43276 /hello" # starts remote gdb
   # use ctrl-z and then bg 1 to background this process, or run it from another ssh session
   ~/overo-oe/tmp/cross/armv7a/bin/arm-angstrom-linux-gnueabi-gdb --symbols ./hello.debug
   target remote 192.168.1.150:43276
   continue

Debug

Now we can introduce a bug and test again

   mkdir ~/overo-oe/Code/
   cd ~/overo-oe/Code/
   vim hello.c
   #include <cstdio>
   
   int main(int argc, char ** argv) {
     printf("Hello World!\n");
     char * h;
     delete h;
     delete h;
   }

Eclipse

We explore how to use eclipse.

I'm currently grokking through http://old.nabble.com/Solution:-Using-Eclipse-CDT-for-Gusmtix-development-tt18251552.html#a18251552 and http://krupets.com/index.php?option=com_content&view=article&id=18&Itemid=20

Plugins

Update sites and plugins

Configuration

Navigating through menus

Remote Deployment Debugging

Having it somehow all come together to this culminating point

Personal tools