
VxWorks
BSP Developer’s Guide, 6.0
18
■
Initializing Interrupt Vectors—The exception vectors must be initialized before
enabling interrupts and starting the kernel. First, intVecBaseSet( ) is called to
establish the vector table base address.
After intVecBaseSet( ) is called, the routine excVecInit( ) initializes all
exception vectors to default handlers. These handlers safely trap and report
exceptions caused by program errors or unexpected hardware interrupts.
■
Initializing System Hardware to a Quiescent State—Calling the
system-dependent routine sysHwInit( ) initializes the system hardware.
Initialization mainly consists of resetting and disabling hardware devices.
Otherwise, when the kernel is started and interrupts are enabled, these devices
can cause unexpected interrupts.
In VxWorks, ISRs (for I/O devices, system clocks, and so on) are not connected
to their interrupt vectors until system initialization is completed by the
usrRoot( ) task. This is a requirement because the memory pool is not yet
initialized. You must not connect an interrupt handler to an interrupt during
the sysHwInit( ) call—doing so requires memory allocation, which is not
available at this time. Most interrupt connection occurs later in the
sysHwInit2( ) routine located in sysLib.c.
■
Calling kernelInit( )—The VxWorks libraries contain the code for
kernelInit( ). Therefore, it is not normally available to BSP developers in
source form. The kernelInit( ) routine initiates the multitasking environment
and never returns. It takes the following parameters:
– the address of the routine to be spawned as the “root” task, typically
usrRoot( )
– the stack size
– the start of usable memory; that is, the memory after the main text, data,
and bss segments of the VxWorks image. All memory after this area is
NOTE: The intVecBaseSet( ) routine is not called first on all architectures. For
more information, see the appropriate VxWorks Architecture Supplement.
NOTE: Take care to ensure that all interrupts are disabled. A typical problem
during BSP development is that an interrupt is not correctly disabled in
sysHwInit( ). When this happens, the system can hang once interrupts are
enabled in usrInit( ) and it can be difficult to determine the cause of the
problem.
Comentarios a estos manuales