Hi All, We are trying to port our application from PPC405 to MIPS 4KC. I have come across one erratic behaviour of following code snippet.
******************************************************************************* /*Definitions for Safe Memory Backup, reboot reasons etc */ #define SAFE_MEMORY_BASE 0x81FB0000 #define SAFE_MEMORY_LIMIT 1024 char safeMemoryBackup[SAFE_MEMORY_LIMIT];void sysHwInit(void) { int romStartedWatchdog = 1; unsigned int resetVal; unsigned int * location; int i; . . . sysBootLine = (char *)BOOT_LINE_ADRS; sysExcMsg = (char *)EXC_MSG_ADRS;
/* Copying Safe Memory contents (Reboot reasons etc) into structure and clearing the memory*/ bcopy( (char*)(SAFE_MEMORY_BASE), (char*) safeMemoryBackup,SAFE_MEMORY_LIMIT); bzero((char*)(SAFE_MEMORY_BASE), SAFE_MEMORY_LIMIT);
************************************************************************************************************The purpose of above bcopy function is to write post-mortem(which is written in to SAFE_MEMORY_BASE while rebooting) data in to a variable called safeMemoryBackup.
And the bzero function is to erase the reboot reason from SAFE_MEMORY_BASE as we already stored RebootReason contents in to a variable called safeMemoryBackup.
But after execution of above code, safeMemoryBackup contents are always shows Zero instead of my reboot reason. If I comment bzero line, I could see the reboot reason contents in safeMemoryBackup as expected.
IS THIS MEAN, safeMemoryBackup IS GETTING UPDATED AFTER EXECUTION OF LINE bzero???????
to confirm that, I have used following code instead of bzero routine to erase the reboot reason.
bcopy( (char*)(SAFE_MEMORY_BASE), (char*) safeMemoryBackup,SAFE_MEMORY_LIMIT); location=(unsigned int *)SAFE_MEMORY_BASE; for(i=0;i