help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Embedded C++


From: Guy Harrison
Subject: Re: Embedded C++
Date: Wed, 11 Aug 2004 01:00:26 GMT
User-agent: KNode/0.7.7

removeme wrote:

> Hello,
> 
> I'm trying to start a project in C++ for 386 embedded system target. The
> code should support exception handling and most C++ features but there is
> no C/C++ stdlib available.

By design or not? If the latter invesigate less heavyweight libc
alternatives such as newlib/libiberty.

> Actually I started with gcc 3.3.4. I would like to dig out the gcc code I
> absolutely need to link against my binary to let most of C++ stuff work. I
> didn't find any really usefull documentation for this purpose.

Most C/C++ implementations are "hosted" - that is, all the standard C/C++
libs are expected to exist and work as per docs. The alternative is
"freestanding"/"non hosted". Those terms may help your search.

> Currently, 
> I began to link againt libgcc_eh.a which seems to provide the exception
> handling management (_Unwind_*) but as I didn't understand everything, I'm
> not sure I don't miss something. Also, it still does not compile well
> (dl_iterate... symbol not resolved at compile time).
> Last, I don't want to link stuff I don't need (std C++ lib, std C lib,
> ...). I will provide my own functions for this (I know the exception
> handling management needs malloc, free, etc. and I'll provide them).
> 
> Could some of you help me by giving some pointers on how to achieve this
> goal :
> - Parts of gcc source code or libs I need to compile against my project to
> be able to make full use of all C++ language features (except the standard
> lib).

Never done a freestanding target myself (so beware). gcc is gonna need a
libc to build against even though the target may be without.

> - Where to find the initial C++ bootstrap (which calls constructors and
> initialize global variables before entering main).

Forget if this (static_initialization...etc) varies across minor 3.x
versions or not so find out yourself from linker error...

struct foo {
 foo();
};

static foo f;

int main()
{
 return 0;
}

...then search for it, iirc is easy to find from there.

> Any serious link on how to find these informations is welcome. I already
> spent a few hours searching gcc source code and I will find with some more
> hours, but some good documentations about those internals would save me a
> lot of time !

Liberate the overall scheme from an already ported but similar build.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]