[PATCH 2/2] Add moxie gdb simulator BSP

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Feb 27 14:20:11 UTC 2013


On 02/26/2013 10:22 PM, Anthony Green wrote:
> diff --git a/c/src/lib/libbsp/moxie/moxiesim/startup/__main.c b/c/src/lib/libbsp/moxie/moxiesim/startup/__main.c
> new file mode 100644
> index 0000000..1db4f51
> --- /dev/null
> +++ b/c/src/lib/libbsp/moxie/moxiesim/startup/__main.c
> @@ -0,0 +1,22 @@
> +/*
> + *  Copied from newlib 1.8.2
> + *
> + *  $Id: __main.c,v 1.3 2008/09/14 21:02:10 joel Exp $
> + */
> +
> +typedef void (*pfunc) (void);
> +extern pfunc __ctors[];
> +extern pfunc __ctors_end[];
> +
> +void __main (void)
> +{
> +  static int initialized;
> +  pfunc *p;
> +
> +  if (initialized)
> +    return;
> +
> +  initialized = 1;
> +  for (p = __ctors_end; p > __ctors; )
> +    (*--p) ();
> +}

Why do we need this?  Normally the constructors are called in the context of 
the first initialization task.  See also

http://git.rtems.org/rtems/tree/cpukit/score/src/threadhandler.c

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list