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.

3<br />

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

char * sysBspRev (void)<br />

{<br />

return (<strong>BSP</strong>_VERSION <strong>BSP</strong>_REV);<br />

}<br />

The file sysLib.c should also include the following stub drivers:<br />

3<br />

romInit.s<br />

#include "mem/nullNvram.c"<br />

#include "vme/nullVme.c"<br />

The sysHwInit( ) routine is the heart of sysLib.c, and most of your work is done<br />

here. It is the routine that resets all devices to a quiescent state so that they do not<br />

generate interrupts later on when interrupts are enabled.<br />

At power-up (cold start) the processor begins execution at romInit( ), which must<br />

be the first routine in the text segment of romInit.s. For warm starts, the processor<br />

begins execution at romInit( ) plus a small offset (see sysToMonitor( ) in sysLib.c).<br />

Most hardware and device initialization is performed later in the initialization<br />

sequence by sysHwInit( ) in sysLib.c. The job of romInit( ) is to perform the<br />

minimal setup needed to transfer control to romStart( ) (in config/all/bootInit.c):<br />

■<br />

Initialize the processor (this code is specific to the processor and not the board,<br />

and thus can be copied from a reference <strong>BSP</strong>):<br />

– Mask processor interrupts<br />

– Set the initial stack pointer to STACK_ADRS (defined in configAll.h)<br />

– Disable processor caches<br />

■<br />

Initialize access to target DRAM as needed for the following (this code is<br />

board-specific):<br />

– Wait states<br />

– Refresh rate<br />

– Chip-selects<br />

– Disabling secondary (L2) caches (if needed)<br />

At the end, romInit( ) jumps to romStart( ) in bootInit.c, passing the start type. The<br />

start type should be BOOT_COLD on a cold boot, or the parameter passed from<br />

sysToMonitor( ) on a warm boot.<br />

This file must also contain a data variable called sdata to mark the start of the data<br />

segment. This variable typically stores a string such as “start of data.”<br />

Refer to the template romInit.s file in the template <strong>BSP</strong> that accompanies this<br />

product.<br />

47

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

Saved successfully!

Ooh no, something went wrong!