Community
cancel
Showing results for 
Search instead for 
Did you mean: 

Eclipse CDT

Eclipse CDT

 

This is a mini-how to use Eclipse CDT to develop/debug Nios2 uClinux application.

First, follow DebugApps and install nios2 gdb.

 

Next, make use your Linux PC have a working JAVA runtime. Then download Eclipse IDE for C/C++ Developers- Linux (63 MB) .

 

tar zxf eclipse-cpp-europa-fall2-linux-gtk.tar.gz

cd eclipse

./eclipse

 

It will ask you for the path of work space. Then then eclipse front page window will come out, select workbench on the right. 

 

Create a new project with, File-->New-->C project

enter project name, eg. hello

project types, executable , Hello world ANSI C Project, (or empty project and add your source).

Finish.

 

Setup for nios2 toolchain,

Project-->Properties

C/C++ build --> Settings ,

 GCC C Compiler, command: nios2-linux-uclibc-gcc

 GCC C Linker,     command: nios2-linux-uclibc-gcc, miscellaneous Linker flag :  -Wl,-d -Wl,-elf2flt

Run/Debug Settings, New_configuration, Edit,

 Main, project: hello, C/C++ application: Debug/hello.gdb

 Debugger, Debugger: gdbserver Debugger,

     Debugger options, 

          Main - GDB Debugger : nios2-linux-uclibc-gdb, 

          Connection - type : TCP, Host name or IP address: 192.168.1.29, port number: 9999,

OK.

 

Now compile the application,

Project-->Build project

 

Copy from your workspace/hello/Debug/hello to romfs/bin in uClinux-dist or transfer it to nios2 target via ftp,nfs etc.

Build the image, start uClinux, and config the ethernet ip, eg 192.168.1.29 . The start the gdbserver listening on an unused port eg 9999,

gdbserver localhost:9999 /bin/hello

It will display,

Process /bin/hello created; pid = 20

Listening on port 9999

 

Start the debugger,

Run--> Debug as -.... or Open Debug dialog (make sure settings are correct), Debug, 

 

It will ask you to switch to Debug perspective, and you may view the soruce, set break points and step in.

 

If you got "out of memory" error, you need to enlarge the heap size from default 256M to a larger one. eg, 512M. You need this only once.

./eclipse -vmargs -Xmx512M

 

You may update the CDT with,

Help--> Software Updates --> Find and Install , Finish, select the mirror and update.

 

Link: http://www.eclipse.org/

 

Version history
Revision #:
2 of 2
Last update:
‎11-01-2020 09:53 PM
Updated by:
 
Contributors