Hi there, I need to write a program to check consistency of memory... the problem is: I don't have any idea about how to do that. xD Could someone post some useful link or useful tool that will help me? Thanks in advance!
Memory test program
Good afternoon eduardo, Like a check for bad blocks in flash? Consistency means everything is the same. So, you want to check that every memory location in flash is working? Another test could be when you are close to using all the memory, ie RAM. Some terms here are "stack paint" and "stack canary". I can give you an example if that is what you are after. Dave
Hi davef! i get errors like Segmentation fault and Unable to handle kernel paging request at virtual address. This errors happens if i run rootfs form NAND flash and NFS. So i decided to check my RAM. What program can i use?
I use this technique on a 8bit 32K FLASH 2K RAM device. The idea is to fill all of ram with a character like 0xC5 (would need to be changed to something bigger for a 32 bit machine) and periodically check that you have some 0xC5s left or you know you have run out of RAM. here is the code: *** #define STACK_CANARY 0xc5 // stack monitoring variables extern uint8_t _end; extern uint8_t __stack; (these must be extern because they live somewhere in the startup code) void StackPaint(void) __attribute__ ((naked)) __attribute__ ((section (".init1"))); void StackPaint(void); now in main.c // stack monitoring pointer const uint8_t *p = &_end; uint16_t c = 0; and then somewhere you place this code and execute it every so many seconds // stack count while(*p == STACK_CANARY && p <= &__stack) { p++; c++; } // we are running low on RAM if(c < 100) // more like 1000 or 10000 { turn on a LED; } and then the function: void StackPaint(void) { uint8_t *p = &_end; while(p <= &__stack) { *p = STACK_CANARY; p++; } } *** Now, there must be code more suitable for use on our platform. All the variables would need to be made BIGGER, I don't know if _end and __stack even exist in our environment and who knows if: void StackPaint(void) __attribute__ ((naked)) __attribute__ ((section (".init1"))); is even relevant for this platform. The device I use it on has a Harvard architecture. I guess this would also tell you if a RAM memory location failed as either it wouldn't have a 0xC5 in it or it wouldn't read that memory position correctly. Good luck in your search for a more suitable tool. Dave Good luck i
Thanks for the responses Dave! I found a useful link: http://www.cyberciti.biz/tips/howto-linux-server-memory-check.html