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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

C/C++ application dumps

Altera_Forum
Honored Contributor II
1,470 Views

Hello, 

 

I've been working with NIOS2 for few months now I use std_1c20 (from now on I am going to use self developed NIOS board).  

For NIOS2 environment I am using uClinux-dist-test 20060511, kernel 2.6.16, uClibc 0.9.27, gcc 3.4.6, binutils 2.15. 

I have build gcc (3.4.6 c++) NIOS2 compiler from build root environment and NIOS2 patches from nioswiki.jot.com (many thanks). 

 

Now the problem I have is that I am working on a uClibc mixed C and C++ application with POSIX ptread. For stdio/file IO I've been using C functions and not c++ stdio. 

 

Application builds correctly, but when I try to run it I get something like this in console: 

SIGSEGV 

and 

BINFMT_FLAT: reference 0x680000 to shared library 53, killing maindemo! 

in dmesg 

 

Application is definitely statically build so I don&#39;t know why I am getting error with shared library. I have checked that application is linked statical with nios2-linux-uclibc-nm. I&#39;ve also checked: the stack, FLT header, rebuild gcc/g++ few times nothing helped http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

 

I have also successfully build an a little bit complex hello world using same libraries and it works but main application is not working. Otherwise the main application works on i686 Gentoo Linux. 

 

The reasons I thought of for my application not working are: 

 

- mixing C/C++ code in the same file (few people from Ecos suggest full C/C++ code separation) 

- bug in code not detectable on i386 arch (might be possible) 

- gcc (g++) compiler/linker ? 

 

Another question is there a debugger like strace or gdb I could use? 

 

Any kind of help or comments would be very appreciated. 

 

Uros
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
630 Views

The current Nios2 c++ compiler from our buildroot does not work. It can compile, but crashs when calling a c++ class function. But I am not a c++ user, and didn&#39;t know c++ function calling well, so I can not resolve it. I wonder if there are problems in memory allocation. 

 

I know Microtronix&#39;s had resolved the problem and sell the c++ compiler. I think it should be GPL, but I didn&#39;t have access to them. Maybe you can try to get the compiler or source from them. 

 

Otherwise, you may trace the code of a c++ function call. 

 

Good luck, 

Hippo
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

Many thanks Hippo for the fast answer, so I will probably tray Microtronix&#39;s compiler and I&#39;ll see. 

 

Uros
0 Kudos
Reply