02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

VxWorks 5.5<br />

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

Generic Initialization<br />

The remainder of the initialization code is common to both ROM and RAM based<br />

images.<br />

usrConfig.c: usrInit( )<br />

From a <strong>BSP</strong> writer’s point of view, the main significance of usrInit( ) is that it clears<br />

the bss segment (so that uninitialized C global variables are now zero), and then<br />

calls sysHwInit( ) (in sysLib.c) to initialize the hardware. If memory has been set<br />

up properly, there is little that can go wrong in this routine.<br />

sysLib.c: sysHwInit( )<br />

This is the heart of the <strong>BSP</strong> initialization code. It must reset all hardware to a<br />

quiescent state so as not to generate uninitialized interrupts later when interrupts<br />

are enabled.<br />

usrConfig.c: usrInit( )<br />

After sysHwInit( ) has completed, control returns to usrInit( ). The last thing<br />

usrInit( ) does is call kernelInit( ) to start the VxWorks kernel. This is the end of<br />

the pre-kernel initialization code. The routine kernelInit( ) does not return. Rather,<br />

it starts the kernel with usrRoot( ) as the first task. It is deep within the<br />

kernelInit( ) routine that interrupts are finally enabled; serious confusion ensues if<br />

not all interrupt sources were disabled and cleared in sysHwInit( ).<br />

You can start the agent as this point if you want to bring up the kernel under<br />

control of the agent. This is an optional step which is not typically done. For more<br />

information, see 3.3.4 Starting the WDB Agent Before the Kernel, p.53.<br />

usrConfig.c: usrRoot( )<br />

The remainder of the VxWorks initialization is done after the kernel has been<br />

started in usrRoot( ). Details are covered in subsequent sections. In this phase, it is<br />

enough if usrRoot( ) can verify that sysHwInit( ) was properly written.<br />

If kernelInit( ) is called but execution fails to reach the start of usrRoot( ), one of<br />

two things are wrong. Either your sysMemTop( ) routine is returning a bogus<br />

address, or, more likely, some device has not been reset and is generating an<br />

interrupt. In the second case, you must modify sysHwInit( ) to reset the<br />

interrupting device.<br />

52

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

Saved successfully!

Ooh no, something went wrong!