By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,919 Members | 1,625 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,919 IT Pros & Developers. It's quick & easy.

Porting embedded code in c/c++ from GHS v1.8.8 to GHS v4.2.4

P: 2
Hi All,

We are trying to port the embedded code in C/C++. It is currently compiled and linked using GHS compiler v1.8.8. Now we want to move to GHS compiler v4.2.4. There is huge gap between the compilers here. When we are trying to use the new compiler it is doing lot of optimizations, and changing the way the memory map is getting generated old compiler. I want to know if someone has worked on such an activity and it would be great if they could share their thoughts. Any suggestions are welcome to resolve the same?

Thanks and Regards,
Sep 1 '10 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 983

First off, I'm not familiar with GHS - Greenhills, perhaps?

Do you have a test suite? That's the best way to determine if your port worked reasonably well.

If need be, you can start off by writing a series of unit tests. Unit testing is perhaps the best way to determine if a port worked reasonably well. In general they won't find subtle behavioral issues, but they will at least cover most of the bases.

As you know, optimizers can be the death of embedded code. If there are new optimizations in the newer version, make sure you understand them before using them. Or, if you want them, make sure you understand them well enough to know how they will affect your code.

As for race conditions and similar problems that can occur in multi-threaded or other shared-memory code, all you can really do is test or try to prove analytically that they are robust.

Good luck!
Sep 1 '10 #2

Expert 100+
P: 2,398
There are typically ways to control how much optimization takes place (such as command line switches). It might be useful to compare the output of the two compilers when both are instructed to suppress all optimizations. If this comparison is promising then you could repeat the exercise with more and more optimizations enabled.

You might want to invest in a good static analyzer (lint) to see how portable your original source code is.
Sep 2 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.