Forums

Buying IAR C

Started by Nickolai Leschov January 11, 2008
On 2008-01-13, Wilco Dijkstra <Wilco_dot_Dijkstra@ntlworld.com> wrote:

>> What "gcc libraries" are you talking about? Are we talking >> about libc implimentations or about compiler code generation? > > I already mentioned Newlib which is one of the GCC libraries
I wasn't aware that newlib was part of gcc or tied to gcc, so it nevered occured to me that it would be called a "gcc library".
> (others are glibc, tinylibc, dietlibc etc).
I'm confused. Are those also "gcc libraries"? Are they tied exclusively to gcc?
> The examples I gave are compiler helper functions which are in > the main GCC source tree.
I give up. I thought the thread was about compilers. -- Grant Edwards grante Yow! Life is a POPULARITY at CONTEST! I'm REFRESHINGLY visi.com CANDID!!
"Grant Edwards" <grante@visi.com> wrote in message news:13oiu6pefaqqg5d@corp.supernews.com...
> On 2008-01-13, Wilco Dijkstra <Wilco_dot_Dijkstra@ntlworld.com> wrote: > >>> What "gcc libraries" are you talking about? Are we talking >>> about libc implimentations or about compiler code generation? >> >> I already mentioned Newlib which is one of the GCC libraries > > I wasn't aware that newlib was part of gcc or tied to gcc, so > it nevered occured to me that it would be called a "gcc > library". > >> (others are glibc, tinylibc, dietlibc etc). > > I'm confused. Are those also "gcc libraries"? Are they tied > exclusively to gcc?
They are not exclusively tied to GCC, but (apart from Newlib) primarily meant to run on Linux, which is tied to GCC. They are typically supplied with prebuilt GCC packages. If these libraries didn't exist it would not be possible to use GCC or Linux. That's why I call them "GCC libraries".
>> The examples I gave are compiler helper functions which are in >> the main GCC source tree. > > I give up. I thought the thread was about compilers.
We were talking about code size (ie. size of application) which includes the libraries. On embedded systems the libraries are as important as the compiler as they take a significant proportion of the total codesize. It's also much easier to halve the size of libraries than to make a compiler emit much smaller code, so it is one of the first things people optimise. Wilco
Grant Edwards wrote:
> Wilco Dijkstra <Wilco_dot_Dijkstra@ntlworld.com> wrote: > >> I already mentioned Newlib which is one of the GCC libraries > > I wasn't aware that newlib was part of gcc or tied to gcc, so > it nevered occured to me that it would be called a "gcc > library". > >> (others are glibc, tinylibc, dietlibc etc). > > I'm confused. Are those also "gcc libraries"? Are they tied > exclusively to gcc? > >> The examples I gave are compiler helper functions which are in >> the main GCC source tree. > > I give up. I thought the thread was about compilers.
In general, basic libraries for compilers are particular to that compiler on that device. The reason is that all compilers need some routines that cannot be written (portably) in the language itself. One example is the malloc/realloc/free/calloc package in C. Usually preparing a program calling those routines requires no special action. [1] The library is routinely searched at some point, and the necessary modules loaded. [1] Use of the C #include facility is another matter. This is used to specify the calling sequences and types required, not to access a library. -- [mail]: Chuck F (cbfalconer at maineline dot net) [page]: <http://cbfalconer.home.att.net> Try the download section. -- Posted via a free Usenet account from http://www.teranews.com
Grant Edwards wrote:
> On 2008-01-12, David Brown <david.brown@hesbynett.removethisbit.no> wrote: > >>>> Also the GCC libraries >>> What libraries? I'm only aware of one: libgcc. >> avrlibc is the main library for avr-gcc. > > Oh. I wasn't aware that avrlibc was part of (or somehow tied to > gcc). >
avrlibc is not part of the avr port of gcc - but for most practical purposes, it is closely tied. The library uses gcc-specific extensions, and is thus not directly usable with any other compiler, and while avr-gcc users may well use other libraries in addition, I doubt if there are many that don't also use avrlibc. However, it *is* possible to avoid using it - for example, support functions for gcc-generated code are part of the gcc port libraries rather than avrlibc. The maintainance, development, support and documentation of the avr gcc port and the avrlibc library are strongly intertwined.
> > OK, the thread seems to have morphed from comparing compilers > to comparing libc implementations. >
The C standards define both the language and certain library functions, making it difficult to separate them entirely. From the users viewpoint, a toolchain consists of (at least) a compiler, assembler, linker, and library - each is virtually useless without the other. It is thus important that library implementations are considered when comparing toolchains, at least for the sort of functions that are going to be used (i.e., for most small embedded systems you can ignore big, slow printf's or malloc's, because they are not used anyway). mvh., David
On 2008-01-13, CBFalconer <cbfalconer@yahoo.com> wrote:

>> I give up. I thought the thread was about compilers. > > In general, basic libraries for compilers are particular to > that compiler on that device.
I guess I just wouldn't include libc in the category of "basic libraries that are particular to a compiler/device". I've used several cross compilers that didn't come with a libc implementation. Usually when I build a gcc cross compiler, it doesn't include libc, and quite a few of my projects don't use libc. What I would call "basic libraries" would be just those required for the compiler to produce executable code. In the case of gcc, that's libgcc. Comparing one libc implementation with another is a useful enough thing to do, but let's not conflate it with comaring one _compiler_ with another. You can mix and match compiler and libc just as you can compiler and debugger or compiler and editor.
> The reason is that all compilers need some routines that > cannot be written (portably) in the language itself. One > example is the malloc/realloc/free/calloc package in C.
A compiler doesn't needs malloc/realloc/free/calloc. I don't use them on embedded systems, so it would seem to be the user that needs them not the compiler. -- Grant Edwards grante Yow! I want DUSTIN at HOFFMAN!! ... I want visi.com LIBRACE!! YOW!!
Grant Edwards wrote:

> On 2008-01-13, CBFalconer <cbfalconer@yahoo.com> wrote: > > >>>I give up. I thought the thread was about compilers. >> >>In general, basic libraries for compilers are particular to >>that compiler on that device. > > > I guess I just wouldn't include libc in the category of "basic > libraries that are particular to a compiler/device".
What would you call (name) the library that contains 'getch', 'putch' and friends then? I suppose its name isn't particularly relevant except that convention is 'libc'. Michael
On 2008-01-13, msg <msg@_cybertheque.org_> wrote:

>>>In general, basic libraries for compilers are particular to >>>that compiler on that device. >> >> I guess I just wouldn't include libc in the category of "basic >> libraries that are particular to a compiler/device". > > What would you call (name) the library that contains 'getch', > 'putch' and friends then? I suppose its name isn't particularly > relevant except that convention is 'libc'.
I'd call it 'libc'. I just wouldn't refer to it as part of the compiler or as a basic library required by the the compiler. It's a library just like any other with the distinction that it's defined by a particular standard. Many of my projects have nowhere to 'getch' a character from nor anywhere to 'putch' a character to. If those routines were required by the compiler then I couldn't be using the compiler for those projects. Yet I am. -- Grant Edwards grante Yow! If I pull this SWITCH at I'll be RITA HAYWORTH!! Or visi.com a SCIENTOLOGIST!
Grant Edwards wrote:

> On 2008-01-13, msg <msg@_cybertheque.org_> wrote: > > >>>>In general, basic libraries for compilers are particular to >>>>that compiler on that device. >>> >>>I guess I just wouldn't include libc in the category of "basic >>>libraries that are particular to a compiler/device". >> >>What would you call (name) the library that contains 'getch', >>'putch' and friends then? I suppose its name isn't particularly >>relevant except that convention is 'libc'. > > > I'd call it 'libc'. I just wouldn't refer to it as part of the > compiler or as a basic library required by the the compiler. > It's a library just like any other with the distinction that > it's defined by a particular standard. > > Many of my projects have nowhere to 'getch' a character from > nor anywhere to 'putch' a character to. If those routines were > required by the compiler then I couldn't be using the compiler > for those projects. Yet I am. >
Granted, Grant <g>, but I was replying to your comment: "I guess I just wouldn't include libc in the category of 'basic libraries that are particular to a compiler/device'", with the emphasis on 'device'; IOW, device specific code resides therein, and isn't likely portable as-is between toolchains and other devices. Regards, Michael
On 2008-01-13, msg <msg@_cybertheque.org_> wrote:

> Granted, Grant <g>, but I was replying to your comment: > "I guess I just wouldn't include libc in the category of 'basic > libraries that are particular to a compiler/device'", with the > emphasis on 'device'; IOW, device specific code resides therein, > and isn't likely portable as-is between toolchains and other > devices.
Agreed. A particular implimentation of libc might be device specific, and might also be written using compiler extensions so that it's compiler specific. -- Grant Edwards grante Yow! I'm RELIGIOUS!! at I love a man with visi.com a HAIRPIECE!! Equip me with MISSILES!!
> Would it be possible to questimate the code size IAR generates in > comparison > with ICCAVR? I have a project which completely fills an ATMega162 and I > would like to have some space for extra features without a hardware > redesign. > > Meindert >
You can get a 4 kB limited version of the IAR compiler for free. You can get a 30 day evaluation version for free as well. If you are using ICCAVR, then there should be some room for improvement. A very good feature of the IAR compiler is the ability to optimize global variables into the lower bank of registers. It allowed me to reduce code from 5 kB to below 4 kB in one important application. With the ATmega164P providing 2 serial ports there are IMHO very few reasons to use the ATmega162 Existing design (like yours) and need of the external bus. The ATmega164P has a migration path to m324P and m1284P. -- Best Regards, Ulf Samuelsson This is intended to be my personal opinion which may, or may not be shared by my employer Atmel Nordic AB