EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Porting IAR code for GCC

Started by saiberion January 24, 2007
Hi,

currently I'm trying to port existing code for an AT91SAM7S256 written
with IAR into my Eclipse environment and I have problems with
compiling/linking.
All works fine except one thing so far. The IAR Code used the Atmel
Functions for setting register values (lib_AT91SAM7S256.h) and for all
those inline functions I get the same 2 errors:
- multiple definition of 'function'
- first defined here

I could get around this by replacing the inline function calls with the
code of the functions (as I did from the beginning with another
project) but this project is rather big and is packed with lots of
these inline function calls and I'd like to use them nevertheless (even
for other projects)
Matthias,
> All works fine except one thing so far. The IAR Code used the Atmel
> Functions for setting register values (lib_AT91SAM7S256.h) and for all
> those inline functions I get the same 2 errors:
> - multiple definition of 'function'
> - first defined here

Replace "inline" by "static inline".

AFAIK: inline is in C only a hint to the compiler.
--
42Bastian
Thanks that worked but now I have another problem. The objcopy blows up
my 300k elf file to a 2M bin file although it should get smaller.
The objcopy call is similar to my other project where that works
correctly.

--- In A..., 42Bastian Schick wrote:
>
> Matthias,
> > All works fine except one thing so far. The IAR Code used the Atmel
> > Functions for setting register values (lib_AT91SAM7S256.h) and for
all
> > those inline functions I get the same 2 errors:
> > - multiple definition of 'function'
> > - first defined here
>
> Replace "inline" by "static inline".
>
> AFAIK: inline is in C only a hint to the compiler.
> --
> 42Bastian
>
On Thursday 25 January 2007 00:31, saiberion wrote:
> Thanks that worked but now I have another problem. The objcopy blows up
> my 300k elf file to a 2M bin file although it should get smaller.
> The objcopy call is similar to my other project where that works
> correctly.

This is most likely because you have mapped something wrongly.

Use
#arm-elf-obj-objdump -g blaah.elf

The map file is also your friend.

this will show you the sections in your code and should quickly show you what
is wrongly placed.

If there are sections you want to ignore in the copy, then you can use -j or
-R to control which sections you copy.

The 2024 Embedded Online Conference