Hi everyone, I am using LPC2468 and put the U-Boot as my boot loader in the on-chip flash, and my application program is not uLinux, it compiles by KEILC with MicroLIB and exist in an external NOR Flash. After power on reset, the U-Boot will go to my application program, the program will copy U-Boot's environment variables from the on-chip flash sector(0x7C000~0x7CFFF) to on-chip RAM. Now my application program can read and modify an environment variable, but when I computes the CRC, the result was wrong if I use printf() to show the result. Even though I do not change the data of the environment variables, the problem still occurs. For example:
char AppEnv_UbootDataAllLoad(void) { unsigned char *ptr = (unsigned char*)0x07C000; unsigned char *evn_ptr = (unsigned char*)&env_var; int i; unsigned long tmp = 0; unsigned long tmp2 = 0; printf("Copying U-Boot Env to RAM.."); for(i=0; i<0x1000; i++){ // load data from flash to RAM evn_ptr[i] = ptr[i]; } printf(" done.\n\r"); tmp = crc32(0, env_var.data, ENV_DATA_SIZE); printf("crc32:%08X\n\r", tmp); // <here> tmp2 = crc32(0, env_var.data, ENV_DATA_SIZE); printf("crc32_2nd=%08X\n\r",tmp2); return 0; }
This function calls crc32() twice and get diffenet result, but if I don't use the KeilC' MicroLIB, the two crc32() result will be the same. It seems like the printf() will change some RAM data, or there is something I need to setup for my KeilC project with MicroLIB.
Snaku