Internal Static RAM (SRAM)
MPC5510 Microcontroller Family Reference Manual, Rev. 1
21-6
Freescale Semiconductor
Preliminary
NOTE
You must initialize the SRAM, even if the application does not use ECC
reporting. If using a part with less than 80 KB of RAM, you must also
initialize four words past the end address (or up to the entire 80 KB space).
21.7.1
Example Code
It is essential that each memory address be written to a known value before it is read. This includes reads
generated from the read/modify/write operation which occurs when a write transfer of less than 32 bits or
unaligned write is requested. Without writing an address to a known value first, a read from this address
will most likely generate an ECC multiple error.
The following Book E assembly instructions (
), formed as a subroutine, is an example of
clearing SRAM memory space. This code clears 0x2000 bytes of memory.
Example 21-1. Clearing SRAM Memory Space
enable_and_invalidate_sram();
asm ("li r14,0x2000"); // size to clear
asm ("lis r13,0x4000"); // RAM base address
asm ("clear_mem:");
asm ("subi r14,r14,0x20");
asm ("dcbz r14,r13");
asm ("dcbf r14,r13");
asm ("cmpwi r14,0x0");
asm ("beq continue");
asm ("b clear_mem");