Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12748 Discussions

Linux application debug problem

Altera_Forum
Honored Contributor II
1,926 Views

Hello, 

 

I'm having problems debugging a Linux application using Eclipse. I followed the steps in the "Microtronix Nios II Linux Distribution Reference Guide" document and I get the following results: 

 

1) On the Linux console, I've uploaded my app (hello.exe) and started it with debug. The output looks normal: 

 

# debug hello.exe 

DEBUG: running "hello.exe" ... 

 

2) In Eclipse, when I launch the debugger it displays the following in the Console window: 

 

# [nios2-gdb-server] nios2-gdb-server listening on port 2342 

# [nios2-gdb-server] accepting gdb connection 

# [nios2-gdb-server] connecting to JTAG debug module 

??---># [nios2-gdb-server] CPU will be reset on connect 

# [nios2-gdb-server] using MDI port: "sld" 

# [nios2-gdb-server] JTAG cable: "USB-Blaster [USB-0]" 

# [nios2-gdb-server] JTAG device: 2 

# [nios2-gdb-server] JTAG debug module instance: 0 

# step: c 

# [nios2-gdb-server] tcp receive failed 

# [nios2-gdb-server] closing gdb connection 

 

 

The problem seems to be that the debugger is resetting the CPU which kills the "debug hello.exe" running under Linux. 

 

After this the debugger halts with a pop-window which says: 

 

Exception occurred during launch 

 

Reason: 

An existing debugging session is running. Trying to return Linux to a known state. 

 

 

 

In the meantime the Nios II has been reset and the Linux login prompt is displayed on the console again. 

 

 

I can't find any setting in Eclipse which will disable this CPU reset. 

 

Also, is there a way to specify which JTAG cable to use when debugging Linux applications? The normal Nios II debugger lets you specify a cable and device to use, but this option is not available in the Linux debugger. 

 

Has anybody else encountered this problem? 

 

 

Thanks, 

Terry Graessle
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
691 Views

I also had a question about the "debug" program running on the Linux host. 

 

After I start 'debug' with my application, the Nios II seems to be completely locked up and unresponsive. Is this normal? Does 'debug' totally supend the Linux kernel while it's running? 

 

Thanks, 

Terry Graessle
0 Kudos
Altera_Forum
Honored Contributor II
691 Views

No, that is *not* normal at all. Which version of Nios II Linux are you running and which version of the Nios II processor do you have installed? 

 

Nios II Linux v1.2 and below work with the Nios II v1.01 and below distributions. 

Nios II Linux v1.3 works with the Nios II v1.1 distribution. 

 

This is because some of the command line options for nios2-gdb-server have changed between nios II v1.01 and Nios II v1.1...
0 Kudos
Altera_Forum
Honored Contributor II
691 Views

Ken, 

 

I'm using version 1.01 of the Nios II IDE along with v1.3 of the uClinux distribution. 

 

It sounds like I need to upgrade my Nios II IDE to v1.1. 

 

I'll try that and see if it helps. 

 

 

Thanks. 

Terry Graessle
0 Kudos
Altera_Forum
Honored Contributor II
691 Views

Ok. I finally received the CD's for Nios v1.1 and upgraded everything. I'm now running NiosII IDE v1.1, Quartus 4.2 SP1 and NiosII Linux v1.3. 

 

After removing all JTAG targets except one (USB-Blaster), I am finally able to connect to a process running on the target through the Nios II IDE. However, when I try to step into the code, the program running on the target exits with an "EL: not found" error. 

 

# debug /bin/hello_linux.gdb 

DEBUG: running "/bin/hello_linux.gdb" ... 

EL: not found 

 

 

I've found that this error is generated whenever I try executing a .elf file on the Nios II under uClinux. Perhaps there is an option the kernel configuration that allows execution of .elf files; however I can't find such an option.  

 

The "Executable File Formats" section of menuconfig contains the following options: 

 

Kernel support for flat binaries 

Enable ZFLAT support 

Enable shared FLAT support 

Kernel support for MISC binaries. 

 

Currently, I only have the "Kernel support for flat binaries" enabled. 

 

Is there some other option I need to turn on which will allow .elf files to be executed? 

 

Thanks, 

Terry Graessle
0 Kudos
Altera_Forum
Honored Contributor II
691 Views

Problem solved. 

 

I was running "debug app.gdb" on the Nios II target instead of "debug app.exe".  

 

The app.gdb file is only loaded through Eclipse and not actually executed on the target. 

 

Thanks for the help. 

 

-- 

Terry G.
0 Kudos
Reply