I'm using codewarrior for Coldfire architectures and Processor expert to help me program the MCF5225x. Using the initialisation procedure provided in the Reference Manual I wrote the following function to initialise the SRAM.
void Int_sram_initialise (void)
{
asm
{
lea.l RAMBAR, A0 //following loop initialises entire SRAM to zero
move.l #16384, D0
sram_init:
clr.l (A0)+
clr.l (A0)+
clr.l (A0)+
clr.l (A0)+
subq.l #4, D0
bne.b sram_init
}
}
The Cpu.c file has already initialised the RAM enable bit.
/* Initialize RAMBAR */
asm {
move.l #0x20000221,d0
movec d0,RAMBAR
}
What I would like to know is, if there is a way that the SRAM initialisation to zeroes can be done in C? Is there a way that the address and data registers can be accessed using C.
TIA!
Regards,
Prao.
Oh! I just realised the the startup code in startcf.c clears all memory! Does this mean that the RAM need not be cleared to zeroes explicitly?
Regards.