Hi to all,
Can somebody answer please how can I use GNU compiler in Keil uVision3 evaluation version? Just I need for it because of code limitation. As I am aware to get a compiled unlimited code is possible by configuring the Keil uVision for GNU compiler. Also I'll need for using of GNU libs. Tell me please who knows how to do it. Thanks.
"... GNU compiler the generated hex file size was 2.3 times greater than the same project which was built by using of the Keil integrated compiler."
First of all, the size of the Hex file is not necessarily much of an indication of the size of the actual execuatable image; eg, if GNU uses shorter lines in its hex files, that will increase the overhead for the same executable code size!
For a meaningful comparison, you need to look at the actual execuatable image sizes.
Anyhow, if we assume that the GNU-generated code really is significantly larger than Keil's then, obviously, Keil would point to this as justification for the price of their tools!
As the saying goes, "You get what you pay for"!
But are you sure that the options you have specificed for Keil are comparable to the options you have specified for Keil?
Obviously, if you set Keil to maximum optimisations, and GNU to none, you would expect the GNU-generated code to be larger, wouldn't you?!
Then again, code size is not the only issue - maybe GNU gives faster code, or better data usage, or...?
"But are you sure that the options you have specificed for Keil are comparable to the options you have specified for Keil?"
That should say:
"But are you sure that the options you have specificed for GNU are comparable to the options you have specified for Keil?"
I set the following options for GNU: in the "Options for target" window's linker's tab I have not selected any check box. That means: - do not collect garbage - use Standard System Startup File - use Standard System Libraries - do not use math labriaries
Size for the same project with GNU compiler is 23 668 bytes. Size for the same project with Keil compiler is 10 700 bytes.
Even setting the code optimization into "Level 2(size)" doesn't make any changes.
The GCC and Keil compilers are completely different products from completely different sources - so they are never going to give exactly the same results!
Even "Level 2(size)" will almost certainly mean different things to Keil and GCC.
If this really matters to you, you are going to have to dig deeply into both the Keil and GCC manuals, examine the generated code, etc, etc.
A crude comparison of file sizes has little value.
If you still can't find a set of options that brings the GCC code size down to an "acceptable" level for your requirements, then you are just going to have to pay-up and buy a Keil licence!
Remember, "GCC" is the GNU Compiler Collection - it is a whole range of compilers supporting many different languages and many different targets; Keil, on the other hand, is specifically targetted directly for the ARM architecture alone. One would therefore hope that the Keil compiler would, indeed, give "better" results than the more generalist GCC...
I recommend to read the following link:
www.compuphase.com/dhrystone.htm
Although the old version of Keil tool is referenced, information about GNU ARM based tools are still relevant and I think very useful.
Proper setting of GNU compiler is very important. Then you can expect also very good results from GNU based compilers. Of course, linking some standard functions (e.g. printf) significantly increase the final image.
Thank you for your given link. Unfortunately I couldn't find any useful thing regarding the GNU compiler properly configuration in Keil IDE tool. You have mentioned in your post that GNU compiler can make an effective size code while it has been configured properly. Could you tell me please how can we achieve that results? Thanks.
For GCC support, you'd probably be better going to a GCC forum
Dear Andy,
I think this issue could be discussed in Keil forum more comprehencive than in GNU forum because this issue is related to Keil's IDE configurations to use the GNU compiler. OK, let me ask anoder one question: below I give two configurations for Keil IDE for the same project:
1. GNU-Tool-Prefix: arm-uclibc- Cygnus Folder: C:\Cygnus
2. GNU-Tool-Prefix: arm-elf- Cygnus Folder: C:\Program Files\GNUARM\
For the 1-st configuration compilation and linking passes OK, no warnings.
For the 2-nd configuration I see in Keils IDE output window the following error messages:
/cygdrive/c/Program Files/GNUARM/Bin/../lib/gcc/arm-elf/4.2.0/../../../../arm-elf/bin/ld: ERROR: startup.o uses hardware FP, whereas LCD_GNU.elf uses software FP
/cygdrive/c/Program Files/GNUARM/Bin/../lib/gcc/arm-elf/4.2.0/../../../../arm-elf/bin/ld: failed to merge target specific data of file startup.o
Could anybody give me please a clarification on this matter? Thanks.
"2. GNU-Tool-Prefix: arm-elf- Cygnus Folder: C:\Program Files\GNUARM\"
Cygnus cannot work with spaces in folder names!
Remember: Cygnus is basically unix for windows - and unix doesn't support spaces in filenames
If you want really good results, you should move to the newest GNU releases.
E.g. this is also written on the page that I point you to: >Code generation for Thumb mode has reportedly been >improved in GNU GCC 3.4.3...
Current version is arround 4.2. Not only compiler is improved but also libraries were optimized (and this can have a big influence to the generated code).
What is a problem is the setting of uVision environment for the newest GNU tools as you can see from many threads in the Keil forum. The settings is not as easy as for officialy supported GNU version downloaded form Keil webpages.
"I think this issue could be discussed in Keil forum more comprehencive than in GNU forum because this issue is related to Keil's IDE configurations to use the GNU compiler."
There are two issues here:
(1). Configuring the GCC compiler;
(2). Applying those configurations via the Keil IDE (uVision).
Clearly, before you can think about (2), you have to thoroughly understand (1) - and this is where you need to go to a GCC forum!
Once you know what you're trying to achieve with the GCC compiler (independent of Keil), then (and only then), can you start thinking about how to implement that in uVision - and that's where you need this forum!
"officialy supported GNU version downloaded form Keil webpages."
I think you'll find that GCC is not actually supported by Keil at all - it's purely on a "as-is" basis.
As is generally the case with free software, of course!
I personally use CodeSourcery GNU toolchain that is very well maintained. It uses no Gygwin envronment taht is also a big advantage. As I already mention, there are some problems with integration into uVision. Here you can find one of possible solutions:
http://www.keil.com/forum/docs/thread8537.asp
Andy, you are definitely right.
Actually I wanted to say, that GNU version downloaded from Keil webpage works correctly with uVision. This is not the case with newer versions.
Sorry for confusing formulation.
"Remember: Cygnus is basically unix for windows - and unix doesn't support spaces in filenames"
Unix doesn't have any problems with spaces. It just has a different way of handling them than broken Windoze. If the path is encapsulated in quotes or the space is prefixed by a break character, they will be processed ok.
This requirement is needed to make sure that a path is always processed the same way, insted of the OS trying to auditected if the space is a separator or part of a name.
Dear Milos,
Thank you for your given link. I downloaded the glue tools and tried. Although I couldn't see the object files ( *.o ) as a compiler results for source files *.C ( C code ) and *.S ( assempler code, f.e. Startup.S ). I didn't see any errors or warnings ! As a result of build I saw two new files lcd_gnu.__i.gnu and startup._ia.gnu What the files these are? As these files had small sizes ( 129 bytes and 115 bytes ) I don't have any idea about these files.
Anyway here are the compilation results I have got:
Build target 'LPC2148' compiling lcd_gnu.c... assembling Startup.s... linking... "LCD_GNU.elf" - 0 Error(s), 0 Warning(s).
But.. While I tried to configure to create a hex file too, it gives the following messages:
Build target 'LPC2148' compiling lcd_gnu.c... assembling Startup.s... linking... creating hex file... --- Error: failed to execute 'arm-glue-objcopy' "LCD_GNU.elf" - 1 Error(s), 0 Warning(s).
Thanks.