EmbDev.net

Forum: ARM programming with GCC/GNU tools libc and libstdc++


von Mirec Talasek (Guest)


Rate this post
useful
not useful
Please in every make file script is -lc or -lstdc++ but i dont have it.
I am using only arm-elf-gcc/g++ on linux.
In my ARM7TDMI i don use any os only my compiled binary.

Please tell me how i compile libc, libm a and libstdc++ (without any
parts which need kernel (syscalls , iostreams .....))

THX

von Martin Thomas (Guest)


Rate this post
useful
not useful
Mirec Talasek wrote:
> Please in every make file script is -lc or -lstdc++ but i dont have it.
> I am using only arm-elf-gcc/g++ on linux.
> In my ARM7TDMI i don use any os only my compiled binary.
>
> Please tell me how i compile libc, libm a and libstdc++ (without any
> parts which need kernel (syscalls , iostreams .....))

There are several choices for an "embedded" libc/libm. The libc used in
most precompiled free GNU arm-elf-toolchains is the newlib but there are
others available too (i.e. dietlibc, uclibc). Beside the technical
aspects check the licenses for the different libs. There should be
several tutorials available in the net which explain how to build a
cross-compiler with gcc and newlib.

libstdc++ ist part of the gcc-distribution and should be build
"automaticly" when enabling C++-support. (Maybe it does not build when
there is no libc for the target so try to build a "cross"-libc first.)

Martin Thomas

von Clifford S. (clifford)


Rate this post
useful
not useful
Mirec Talasek wrote:
> Please in every make file script is -lc or -lstdc++ but i dont have it.
> I am using only arm-elf-gcc/g++ on linux.
> In my ARM7TDMI i don use any os only my compiled binary.
>
> Please tell me how i compile libc, libm a and libstdc++ (without any
> parts which need kernel (syscalls , iostreams .....))
>
> THX

The GNU C library assumes a Linux/Unix-like subsystem, and is not really
suited to OS-less or non-Posix RTOS based embedded systems. The most
common solution is to use the Newlib C library (which incidentally has
fewer licence restrictions that GPL code).

GNU libstdc++ will work hapilly with Newlib as its low-level runtime
support.

The libraries are normally build with the compiler, so it is surprising
that you do not have them. Last time I built GCC for ARM I used the
instructions here: http://ecos.sourceware.org/build-toolchain.html
(don't worry about the "for eCOS" references, the critical thing is that
it is not "for Linux". A similar pagem but which is specific to GCC
4.1.1 is at
http://www.jstuber.net/lego/nxt-programming/arm-toolchain.html (oddly,
these instructions have a separate build stage for Newlib, despite it
being built with GCC - the eCOS instructions simply copy the library to
the required location. It is possible to build Newlib separately, but
the GCC configure script seems to deal with creating all the necessary
architecture variations for Thumb, FPE, etc. Which I have never been
able to get the Newlib script to do (perhaps because I know very little
about all that configure script stuff!).

With Newlib, it is your responsibility to provide the necessary
low-level glue by implementing some or all of the syscall routines. The
examples provided assume the existance of one of the supported ROM
monitor interfaces, which may not be suitable in your case.

Clifford

von Mirec Talasek (Guest)


Rate this post
useful
not useful
Martin Thomas wrote:
> Mirec Talasek wrote:
>> Please in every make file script is -lc or -lstdc++ but i dont have it.
>> I am using only arm-elf-gcc/g++ on linux.
>> In my ARM7TDMI i don use any os only my compiled binary.
>>


than you very much

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.