SLS Audio NEEK Board Support Package uClinux User Manual

Page 49

Advertising
background image

uClinux NEEK BSP

Debugging Kernel and User Applications

7.2 Debugging User Application using gdbserver over Ethernet

Insight is the GUI of gdb debugger. Often it’s not easy to remember the debug
Command. Therefore insight provides the graphical interface so user can debug
easily. The aim of the document is to explain how to debug user space
application. Steps are mentioned below:

For debugging user application over Ethernet you should have proper zImage .To
build zImage, Follow Driver for Ethernet in NEEK BSP DRIVERS.

Here is the example of simple helloworld.c program debugging:

1. Select gdbserver (old) in menuconfig under user application Æ

miscellaneous application.

2. Select the ifconfig utility in your busybox.

3. On your host set PATH environmental variable to toolchain with

following command:

#PATH=$PATH:/home/uClinux/Bintools/opt/nios2/bin

#export PATH

4. Compile the application with debug symbols and no optimization, on your

host, Here is helloworld.c example. Your current working dir should have
this .c file.

#nios2-linux-uclibc-gcc -g helloworld.c -o helloworld

-elf2flt

This will generate Helloworld and Helloworld.gdb files in your current
working dir. Copy generated Helloworld to romfs/bin in uClinux-dist dir.

5. Build the image, download it to target and configure the Ethernet IP,

192.168.0.14 through following command

/>ifconfig eth0 192.168.0.14

Then start the gdbserver listening on an unused port eg. 9999,with
command:

6. Apply the command given below:

/> gdbserver localhost:9999 /bin/Helloworld

7. It will display,

Process /bin/Helloworld created; pid = 20

Listening on port 9999

8. Next, on your Linux PC, in the hello source dir, run insight gdb,

System Level Solutions

41

Advertising