User`s guide
3 Porting a BSP to Custom Hardware
3.2 Getting a Minimal Kernel Running
71
3
do is to perform board-specific hardware initialization in sysHwInit( ) and to
connect the interrupt by calling intConnect( ) in sysHwInit2( ). The timer drivers
are simple devices that can be tested by modifying usrRoot( ) to perform some
action periodically, such as blinking an LED. For example:
void myTestCode (void)
{
while (1)
{
taskDelay (5*sysClockRateGet());
sysFlashLed();
}
}
For a normal development system, it is often useful to have serial and Ethernet
drivers as well, but these are not required.
3.2.11 Serial Drivers
Most BSPs include an SIO driver for the console serial port. In many cases, one of
the standard drivers in target/src/drv/sio can be used.
Early in the development process, it was suggested that you remove most of the
body of usrRoot( ) with #if FALSE/#endif pairs. In order to enable the serial
driver, you must move the #if FALSE line to a point further down in the code,
below the point at which the serial devices are initialized. To test the port, modify
usrRoot( ) to spawn some application test code that tests your driver.
For example, periodically print a message to the console as follows:
void myTestCode (void)
{
extern int vxTicks;
char * message = "still going...\n";
while (1)
{
/* print a message every 5 seconds */
taskDelay (5*sysClockRateGet());
write (1, message, strlen (message));
}
}
If none of the standard drivers is applicable to your BSP, you can create a custom
SIO driver using a similar driver from target/src/drv/sio and the template driver in
target/src/drv/sio/templateSio.c.
If you are porting an older BSP (for example, a BSP from a version of VxWorks
older than VxWorks 5.2), the device driver used for the serial port may be the older
type of serial driver instead of an SIO driver. For the purpose of backward