How to add C++ support to my BSP?

Phil Torre ptorre at zetron.com
Tue Jun 18 18:56:54 UTC 2002


(Configuration is rtems-4.5.0 release on an MPC860 target.)

I'm trying to add C++ support to my 860 BSP, and running across
a couple of problems:

First is global constructors.  __do_global_ctors() is running, but
it's screwing up when it indexes into the __CTOR_LIST__.  The first
longword in the list is a count of vectors, and the last longword
is a NULL, but __do_global_ctors() is interpreting the count as
an actual vector, and jumping through it.  Boom, crash, die.
I've watched it happen in the debugger, but I can't find out where
the actual source for __do_global_ctors() lives.  I'm also not sure
if I need to fix that code, or if my linkcmds are defective somehow.

Then, while looking for clues to the above problem, I noticed that
two of the powerpc BSPs have an rtems-ctor.cc file.  The comments
in the header of that file describe a scheme whereby bsp_start() is
actually called as the first global constructor, to ensure that
the other constructors can allocate memory.  I don't think I need
this, as my bsp_start() is getting called before main() already
(and thus before __do_global_ctors()).  Is that correct?

Many thanks...

-- 

=====================================================================
Phil Torre                               phone: 425-820-6363 x234
Design Engineer                          email: ptorre at zetron.com
Switching Systems Group                    fax: 425-820-7031
Zetron, Inc.                               web: http://www.zetron.com


  




More information about the users mailing list