BSP and Device Driver Development Guide
The pretasking_hook
entry in the RTEMS CPU Configuration
Table may be the address of a user provided routine that is
invoked once RTEMS API initialization is complete but before interrupts
and tasking are enabled. No tasks -- not even the IDLE task -- have
been created when this hook is invoked. The pretasking hook is optional.
Although optional, most of the RTEMS BSPs provide a pretasking hook
callback. This routine is usually called bsp_pretasking_hook
and is found in the file:
c/src/lib/libbsp/CPU/BSP/startup/bspstart.c
The bsp_pretasking_hook()
routine is the appropriate place to
initialize any support components which depend on the RTEMS APIs.
Most BSPs set the debug level for the system and initialize the
RTEMS C Library support in their
implementation of bsp_pretasking_hook()
. This initialization
includes the application heap used by the malloc
family
of routines as well as the reentrancy support for the C Library.
The routine bsp_libc_init
routine invoked from the
bsp_pretasking_hook()
routine is passed the starting
address, length, and growth amount passed to sbrk
.
This "sbrk amount" is only used if the heap runs out of
memory. In this case, the RTEMS malloc implementation will
invoked sbrk
to obtain more memory. See
Miscellaneous Support Files sbrk() Implementation for more details.
BSP and Device Driver Development Guide
Copyright © 1988-2000 OAR Corporation