8-26
ColdFire CF4e Core User’s Manual
For More Information On This Product,
Go to: www.freescale.com
SRAM Overview
2. Read the source data and write it to the SRAM. Various instructions support this
function, including memory-to-memory move instructions and the move multiple
instruction (MOVEM). MOVEM is optimized to generate line-sized burst fetches on
line-aligned addresses, so it generally provides maximum performance.
3. After the data is loaded into the SRAM, it may be appropriate to revise the
RAMBAR attribute bits, including the write-protect and address space mask fields.
If the SRAM contains instructions, RAMBAR[D/I] must be set to logically connect
the memory to the processor’s internal instruction bus.
Remember that the SRAM cannot be accessed by on-chip DMAs. The on-chip system
configuration allows concurrent core and DMA execution where the core can execute code
out of internal SRAM or cache during DMA access, where the core can access instructions
and operands from the internal RAM, ROM, or cache while the DMA is operational.
The ColdFire processor or an external emulator using the debug module can perform these
initialization functions.
8.5.4 SRAM Initialization Code
The code segment below initializes the SRAM using RAMBAR0. The code sets the base
address of the SRAM at 0x2000_0000 and then initializes the 2-Kbyte block to zeros.
RAMBASE
RAMVALID
move.l
movec.l
EQU
EQU
#RAMBASE+RAMVALID,D0
D0, RAMBAR
0
0x20000000
0x00000035
;set this variable to 0x20000000
;load RAMBASE + valid bit into D0
;load RAMBAR
0
and enable SRAM
The following loop initializes the entire SRAM to zero:
lea.l
move.l
RAMBASE,A0
#512,D0
;load pointer to SRAM
;load loop counter into D0
SRAM_INIT_LOOP:
clr.l
subq.l
bne.b
(A0)+
#1,D0
SRAM_INIT_LOOP
;clear 4 bytes of SRAM
;decrement loop counter
;exit if done; else continue looping
The following function copies the number of bytesToMove from the source (*src) to the
processor’s local RAM at an offset relative to the SRAM base address defined by
destinationOffset. The bytesToMove must be a multiple of 16. For best performance, source
and destination SRAM addresses should be line-aligned (0-modulo-16).
; copyToCpuRam (*src, destinationOffset, bytesToMove)
RAMBASE
RAMVALID
EQU
EQU
0x20000000
0x00000035
;SRAM base address
;RAMBAR valid + mask bits
lea.l
movem.l
-12(a7),a7
#0x1c,(a7)
;allocate temporary space
;store D2/D3/D4 registers
F
Freescale Semiconductor, Inc.
n
.