Newbie question: Initialisation of internal SRAM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Newbie question: Initialisation of internal SRAM

959 Views
Prao
Contributor I

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.

Labels (1)
0 Kudos
Reply
1 Reply

413 Views
Prao
Contributor I

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.

0 Kudos
Reply