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 />

sysALib.s<br />

This file contains the entry point for RAM-based images such as vxWorks. The<br />

entry point, sysInit( ), performs the minimal setup necessary to transfer control to<br />

usrInit( ) (defined in config/all/usrConfig.c). This routine is similar to romInit( ).<br />

The sysInit( ) routine is largely the same for each architecture. As such, copying<br />

the code from a template <strong>BSP</strong> is the best way to start. The sysInit( ) routine<br />

typically just masks processor interrupts and sets the stack pointer. For processors<br />

whose stack grows down, the stack pointer is set to sysInit( ). For processors<br />

whose stack grows up, it is set to a few hundred bytes below sysInit( ). It then calls<br />

usrInit( ), passing it the parameter BOOT_WARM_AUTOBOOT. Most hardware<br />

and device initialization is performed later in the initialization sequence by<br />

sysHwInit( ) in sysLib.c.<br />

<strong>BSP</strong> routines should be coded in C when possible, but if there are compelling<br />

technical reasons for resorting to assembler, then place the routines in sysALib.s.<br />

config/all/usrConfig.c<br />

During development you will want to add debugging code and make other such<br />

modifications to the generic (non-<strong>BSP</strong>) configuration files. Rather than modifying<br />

the generic code directly, instead create local copies in the <strong>BSP</strong> directory as follows:<br />

1. First copy the files config/all/usrConfig.c and config/all/bootInit.c into your<br />

<strong>BSP</strong> directory. Next, add the following lines to your <strong>BSP</strong>’s Makefile, right after<br />

the definition of HEX_FLAGS:<br />

BOOTINIT<br />

USRCONFIG<br />

= bootInit.c<br />

= usrConfig.c<br />

This causes the makefile to use your copy of these generic configuration files<br />

when building VxWorks.<br />

2. Next, modify your copy of usrConfig.c to remove everything except the<br />

pre-kernel initialization code by using #if FALSE/#endif pairs so that<br />

usrExtra.c is not included, and the body of usrRoot( ) is empty:<br />

...<br />

#if FALSE<br />

#include "usrExtra.c"<br />

#endif<br />

...<br />

void usrRoot<br />

...<br />

{<br />

#if FALSE<br />

48

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

Saved successfully!

Ooh no, something went wrong!