avr-libc avr/lib/... directories

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Does anyone know how avr-libc arranges it's library structure in the /avr/lib/... directories?

It looks obvious, but I don't know where avr25 comes from, is this the avr2 architecture?

Also, what architecture is in the root lib directory: /avr/lib/ ?

I presume /avr/lib/avr25 is avr2 architecture, and so is /avr/lib/ .. But every assumption I make always seems to be wrong! ; )

I would like to compile a library I use all the time for all architectures, and so I want to create the library for each avr architecture (apart from avr1 ; )
Am I right in thinking that if I create this library, compiled for the relevant architecture and place it in its /avr/lib/avrX architecture directory, the correct library will be used by the linker?

I couldn't see any information in the avr-libc documentation.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> It looks obvious, but I don't know where avr25 comes from, is this
> the avr2 architecture?

No, it's the "avr2.5" architecture. It is only supported by recent
GCC versions (I believe >= 4.2). It is used for devices that are
"between avr2 and avr4": they implement all the enhanced features from
avr4 (like word instructions) but they do not have the hardware
multiplier avr4 does have. Older GCC versions thus had to resort
producing non-optimal code for these devices, by down-classing them as
avr2.

> Also, what architecture is in the root lib directory: /avr/lib/ ?

avr2, for mostly historical reasons. This is the architecture AVR-GCC
has been originally developed for (because it once used to be the
*only* existing AVR architecture, besides "avr1" used for the RAM-less
devices which are not supported by the compiler).

> I would like to compile a library I use all the time for all
> architectures, and so I want to create the library for each avr
> architecture (apart from avr1 ; ) Am I right in thinking that if I
> create this library, compiled for the relevant architecture and
> place it in its /avr/lib/avrX architecture directory, the correct
> library will be used by the linker?

First, better don't mess with the system directories. Their layout is
not documented, and not considered directly usable by users. A future
version of compiler and/or library might change things there without
taking care for backwards compatibility.

Better use -L options to indicate the location of your library to the
compiler.

Second, your guess is wrong. The base directory will *only* be
included into the search for avr2-class devices. For all other
devices, the linker is instructed to *only* look into the respective
architecture-specific directories. If you add the -v option to the
compiler, you can see this.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dl8dtl wrote:
>No, it's the "avr2.5" architecture. It is only supported by recent
GCC versions (I believe >= 4.2).

Ah, okay. That explains why there is no libc in that directory then.

dl8dtl wrote:

First, better don't mess with the system directories. Their layout is
not documented, and not considered directly usable by users. A future
version of compiler and/or library might change things there without
taking care for backwards compatibility.

Better use -L options to indicate the location of your library to the
compiler.

Second, your guess is wrong. The base directory will *only* be
included into the search for avr2-class devices. For all other
devices, the linker is instructed to *only* look into the respective
architecture-specific directories. If you add the -v option to the
compiler, you can see this.

Thank you for the information, as always. I will work with passing specific directories depending on processor then.

Best Regards,

Brian.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And note that we (avr-libc developers) would like to eventually change avr-libc to produce libraries per device, insted of the "per architecture" way it is done now. However, this work has not been done yet, nor is it currently being worked on. It's just future plans.