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.

3<br />

Creating a New <strong>BSP</strong><br />

not, use the src/drv/sio/templateSio.c template driver as the basis for your own<br />

custom serial driver.<br />

Earlier, you removed most of the body of usrRoot( ) with #if FALSE/#endif pairs.<br />

Now, you need to move the #if FALSE line further down, below the point at which<br />

the serial devices are initialized.<br />

You should modify usrRoot( ) to spawn some application test code to test your<br />

drivers. For example, you can periodically print a message to the console:<br />

3<br />

void myTestCode (void)<br />

{<br />

extern int vxTicks;<br />

char * message = "still going...\n";<br />

while (1)<br />

{<br />

taskDelay (5*sysClockRateGet()); /* every 5 seconds */<br />

write (1, message, strlen (message)); /* print a message */<br />

}<br />

}<br />

3.5 The Target Agent and Tornado<br />

The debug agent is initialized by a call to wdbConfig( ). By default, this happens<br />

at the very end of usrRoot( ). However, you modified this usrRoot( ) to be empty<br />

(see config/all/usrConfig.c, p.48). To restore the agent, call wdbConfig( ) right after<br />

your serial-line initialization code. The default configuration for the target agent<br />

uses the network as a connection to the host. Unfortunately, networking is not yet<br />

available. Therefore, you must use an alternative method of connection. For<br />

information on how to do this, see the section on Alternative Back Ends in the<br />

Tornado Users <strong>Guide</strong>: Setup and Startup.<br />

3.6 Finishing the Port<br />

This section summarizes the various and diverse tasks essential to completing the<br />

port. Included is a discussion of cleanup, timers, networking, and other issues.<br />

57

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

Saved successfully!

Ooh no, something went wrong!