Hello guys !!!
I´m happy to see how we can help each other by these storm of doubts.
Well, now its my turn..if you can help me I would apreaciate...
I´m using MCF52233 EVB for start the game, although I need to port a whole NE64 design to CF...
I realized you were discussing about run the flash routine program in the flash page wich is not the one is been programmed.
After got crazy with hundreds of labels , several h files and conclude there are thousands of reused pieces of code from others ColdFires devices, wich make the learning more difficult and confused as it should be,I decided to try the simplest way to burn the flash, I mean, not use relocated segments , pragmas , const tables, et etc in order to put the code into the ram and then rum in the mcu flash....
Based on the well succed attempt of Vagnoni, I also tried it and It worked at the first time.
I copied your basic ideas and so the all (simply!!!) I did was 3 very small parts:
1) Invocation of burning routine by the application
void test_flash(void)
{
uint16 i;
i=runInRam(0x20,0x9000,0xAABBCCDD);
}
2) initialization flasf parameters, called by during the mcu initialization
void cfm_flash_init(void)
{
MCF_CFM_CFMCLKD=0x54;//Set Freq To About ~156Khz
MCF_CFM_CFMPROT=0;//No Sector Is Protect
MCF_CFM_CFMSACC=0;//Flash Sectors Are Placed In Supervisor Address
MCF_CFM_CFMDACC=0;
MCF_CFM_CFMMCR=0x20;
}
3) The main program routine ...
int runInRam(UINT8 Cmd, UINT32 Addr, UINT32 Data)
{
MCF_CFM_CFMUSTAT = (PVIOL | ACCERR);
FLASH_PROGRAM_ADDR(Addr)=Data;
MCF_CFM_CFMCMD = Cmd;
MCF_CFM_CFMUSTAT = CBEIF;
while (!(MCF_CFM_CFMUSTAT & CBEIF));//wait until buffer free
while (!(MCF_CFM_CFMUSTAT & CCIF));//wait until execution complete
return MCF_CFM_CFMUSTAT & (PVIOL | ACCERR);
}
...and I could see through CodeWarrior memory watch window (option:see memory as...)
0x9000 AABBCCDD 0xFFFFFFFF .... 0xFFFFFFFF
0x901C 0xFFFFFFFF 0xFFFFFFFF .... 0xFFFFFFFF
and 0x0000 was returned from the runInRam routine ....
usually we ask for someone discover a bug, but here I ask you if you agree with the approach I used above ...
What your opinion guys ?
Thanks everybody !!!!