6-4
MCF5249UM
MOTOROLA
SRAM Programming Model
6.3.2
SRAM INITIALIZATION
After a hardware reset, the contents of the SRAM module are undefined. The valid bit of the RAMBAR is
cleared, disabling the module. If the SRAM requires initialization with instructions or data, the following
steps should be performed:
1. Load the RAMBAR mapping the SRAM module to the desired location within the address space.
2. Read the source data and write it to the SRAM. There are various instructions to support this
function, including memory-to-memory move instructions, or the MOVEM opcode. The MOVEM
instruction is optimized to generate line-sized burst
fetches on 0-modulo-16 addresses, so this opcode generally provides maximum performance.
3. After the data has been loaded into the SRAM, it may be appropriate to load a revised value into
the RAMBAR with a new set of attributes. These attributes consist of the write-protect and address
space mask fields.
The ColdFire processor or an external emulator using the debug module can perform these initialization
functions.
6.3.3
SRAM INITIALIZATION CODE
The following code segment describes how to initialize the SRAM. The code sets the base address of the
SRAM at $20000000 and then initializes the RAM to zeros.
RAMBASE EQU $20000000 set this variable to $20000000
RAMVALID EQU $00000000
move.l #RAMBASE+RAMVALID,D0;load RAMBASE + valid bit into D0.
movec.l D0, RAMBAR;load RAMBAR and enable SRAM
The following loop initializes the entire SRAM to zero
lea.l RAMBASE,A0;load pointer to SRAM
move.l #1024,D0;load loop counter into D0
SRAM_INIT_LOOP:
clr.l (A0)+) clear 4 bytes of SRAM
subq.l #1,D0;decrement loop counter
bne.b SRAM_INIT_LOOP;if done, then exit; else continue looping
6.3.4
POWER MANAGEMENT
As noted previously, depending on the configuration defined by the RAMBAR, instruction fetch and operand
read accesses may be sent to the SRAM and unified cache simultaneously. If the access is mapped to the
SRAM module, it sources the read data, and the unified cache access is discarded. If the SRAM is used only
for data operands, asserting the ASn bits associated with instruction fetches can decrease power dissipation.
Additionally, if the SRAM contains only instructions, masking operand accesses can reduce power
dissipation. The following table shows some examples of typical RAMBAR settings.
.
Table 6-4 Typical RAMBAR Setting Examples
DATA CONTAINED IN SRAM
RAMBAR[7:0]
Code Only
$2B
Data Only
$35
Both Code And Data
$21
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
..
.