Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

C/C++ application dumps

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

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

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

    Uros