02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

VxWorks 5.5<br />

<strong>BSP</strong> Developer’s <strong>Guide</strong><br />

lib/*.a: kernelInit( )<br />

The kernelInit( ) routine initiates the multitasking environment and never returns.<br />

It takes the following parameters:<br />

– The application to be spawned as the “root” task, typically usrRoot( ).<br />

– The stack size.<br />

– The start of usable memory; that is, the memory after the main text, data, and<br />

bss of the VxWorks image. All memory after this area is added to the system<br />

memory pool, which is managed by memPartLib. Allocation for dynamic<br />

module loading, task control blocks, stacks, etc., all come out of this region.<br />

– The top of memory as indicated by sysMemTop( ). If a contiguous block of<br />

memory is to be preserved from normal memory allocation, set the macro<br />

USER_RESERVED_MEM in config.h to the amount of reserved memory<br />

desired.<br />

– The interrupt stack size. The interrupt stack corresponds to the largest amount<br />

of stack space that could be used by any interrupt-level routine that might be<br />

called (plus a safe margin for the nesting of interrupts).<br />

– The interrupt lock-out level. For architectures that have a level concept, it is the<br />

maximum level. For architectures that do not have a level concept, it is the<br />

mask to disable interrupts. See the appropriate VxWorks Architecture<br />

Supplement.<br />

The kernelInit( ) routine calls intLockLevelSet( ), disables round-robin mode, and<br />

creates an interrupt stack if supported by the architecture. It then creates a root<br />

stack and TCB from the top of the memory pool, spawns the root task, usrRoot( ),<br />

and terminates the usrInit( ) thread of execution. At this time, interrupts are<br />

enabled; it is critical that all interrupt sources are disabled and pending interrupts<br />

cleared.<br />

usrConfig.c and bootConfig.c: usrRoot( )<br />

For the generic VxWorks development environment, usrRoot( ) initializes the I/O<br />

system, installs drivers, creates devices, and then sets up the network as<br />

configured in configAll.h and config.h.<br />

The usrRoot( ) routine calls memInit( ). Optionally, it calls memShowInit( ) and<br />

usrMmuInit( ).<br />

The routine sysClkConnect( ) is the first routine called in the <strong>BSP</strong> after the system<br />

is multitasking. It immediately calls sysHwInit2( ). This is an opportune time for<br />

36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!