Exists a user function executed before C++ class object initialization?

Sebastian Huber sebastian.huber at embedded-brains.de
Tue May 2 05:53:29 UTC 2017

On 25/04/17 14:56, Jan.Sommer at dlr.de wrote:
> Hi,
> We would like to operate the Leon3 FPU in non-standard mode to avoid traps with denormalized numbers and set the corresponding NS bit in the fsr in the init task.
> As it turns out this is too late because the rtems tasks are created before that in the constructors of global C++ classes.
> That means after the init task is done, the context restore function of RTEMS will restore the fsr of the tasks without the NS bit set.
> Is there a service hook which I could register to set this bit before global class objects are initialized?

You can use a constructor function with priority, e.g.

void  __attribute__((__constructor__(0)))  foo(void)
     /* Some stuff */

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 users mailing list