Skip navigation.
The QNX Community Portal

View topic - moving from gcc 2.95 to 4.4.2

moving from gcc 2.95 to 4.4.2

For discussion of realtime and/or embedded programming.

moving from gcc 2.95 to 4.4.2

Postby Shaidar » Thu May 12, 2011 8:45 am

I have software generated using the IBM Rhapsody code tool (v7.4).

The target was QNX 6.3.2 for the i386 architecture. This builds using qcc 2.95

We are now moving to QNX 6.5 (still i386). Rebuilding using the version of qcc supplied (4.4.2?). Everything builds OK, but there are problems when I run the software.

The processor card communicates over VME by memory mapping the interface. The card is running QNX 6.5. When I run the code build for 6.3.2 (i.e. qcc 2.95) this communication appears to work. When I run the code built for 6.5 (qcc 4.4.2) this communciation appears unreliable. Its not an all or nothing affair, there seems to be no pattern to what works on the interface or not.

I've been using objdump and readelf to compare the executable, and I've found the manuals for the different versions of gcc to try and find out what has changed. I'm new to examining executables at this level of detail and would appreciate any help to try and determine what the newer compiler is doing differently that could cause this.


New Member
Posts: 3
Joined: Thu May 12, 2011 8:27 am

RE: moving from gcc 2.95 to 4.4.2

Postby mario » Thu May 12, 2011 12:44 pm

The compiler is quite different and the generated code is probably different. I personnaly don't use 4.4.2 because of issue with usage of xmm registers on miss aligned data. I stick with 4.3.3 ( 6.4.1 ) for now.

Maybe the difference is how variable/structures are aligned or packed. Print the size of what ever structure you map to the VME memory and compare the difference.
QNX Master
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Postby Tim » Thu May 12, 2011 1:27 pm


When you say it doesn't work what exactly do you mean.

Are you getting crashes/system hangs or simply strange results?

In addition to what Mario said, I'd make sure you have the highest level of warnings turned on in both 2.95 and 4.4.2 and then eliminate any warning in the code.

I know that when we moved a large project from 2.95 to 3.3.5 in QNX 6.3.2 that some working code stopped working (even with no compiler warnings at the highest levels) and sometimes crashed. Eventually with the help of the debugger and some time I tracked down what were all legitimate errors (uninitialized variables, walking off the end of arrays) that somehow under 2.9.5 weren't crashing/causing problems. I chalked it up to how 2.9.5 aligned memory/initialized variables/managed the stack compared to how 3.3.5 does it, fixed them and the problems went away.

Senior Member
Posts: 1388
Joined: Wed Mar 10, 2004 12:28 am

Postby Shaidar » Thu May 12, 2011 1:50 pm

Thanks for the responses.

The processor reads and writes data to another card on the VME bus, controlling it via a number of registers. The interface is memory mapped and access is done directly with a pointer, which is offset to access the correct register on the other card. There are no structures involved.

By not working I mean that the program runs, but it seems to not read and write to the other card properly all the time. This is evidenced by what appears to missing elements of the initialisation of the other card at program startup and during operation we might go into mode X which sets the other card up in a particular way, going into mode X may set up 3 things on the other card, for example, but we see maybe only 2 of then are happening, we also appear to have reads failing, e.g. when we read from the other card over the VME but we get 0 back from the pointer to the mapped memory.

I've just rebuilt the executable with GCC 3.3.5 which also comes with QNX6.3.2 and this evidenced the same problem as using the later compiler .

I'm guessing I will have to try the same and switch on all the warnings, see what pops up and start from there.
New Member
Posts: 3
Joined: Thu May 12, 2011 8:27 am

Postby koko » Thu May 12, 2011 8:13 pm

I believe you are using a VME driver( probably GE Fanuc one ). Probably it has been compiled with some older compiler version.
You should check with the vendor about the problem.
Senior Member
Posts: 100
Joined: Wed Aug 20, 2003 1:31 am

Postby Thunderblade » Fri May 13, 2011 7:35 am

Do you link in libraries other than QNX-supplied ones? They have to be compiled with the new compiler, too.
Senior Member
Posts: 487
Joined: Thu Apr 07, 2005 11:52 am

Postby Shaidar » Fri May 13, 2011 7:59 am

The VME driver is up to date, provided by the processor card supplier. I'm using the same VME driver in both cases.

There are rhapsody framework libraries but I have version rebuilt with the appropriate compilers, part from that it's just the QNX ones.
New Member
Posts: 3
Joined: Thu May 12, 2011 8:27 am

Return to Realtime and Embedded

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest