Browse Source

init: call pre_main before C++ constructors

This moves the platform specific initialization function pre_main
in front of C++ constructors. This is especially necessary for
platforms which need to setup the stack pointer (pre_main itself
is inline, hence no stack needed for this function).
pull/345/merge
Stefan Agner 10 years ago
committed by Karl Palsson
parent
commit
0d5dac515a
  1. 6
      lib/cm3/vector.c

6
lib/cm3/vector.c

@ -74,6 +74,9 @@ void WEAK __attribute__ ((naked)) reset_handler(void)
*dest++ = 0;
}
/* might be provided by platform specific vector.c */
pre_main();
/* Constructors. */
for (fp = &__preinit_array_start; fp < &__preinit_array_end; fp++) {
(*fp)();
@ -82,9 +85,6 @@ void WEAK __attribute__ ((naked)) reset_handler(void)
(*fp)();
}
/* might be provided by platform specific vector.c */
pre_main();
/* Call the application's entry point. */
main();

Loading…
Cancel
Save