Hi, I am presently trying to validate the contents of my code memory, so i can perform a CRC check on every startup of my unit. I know the size of code memory in bytes and was wondering if Keil can support passing as an argument, to my checksum algorithm function, a memory address which would be the starting address of my code memory, and then running the algorithm until it reaches the final address in my stored code memory? I would appreciate any thoughts one would have on the subject. Thanks again Dave
I had a similar question which I had posted on 7-26-04 but never received any replys. Unlike you (I think), I do not know my code size and wanted to find a way to declare a label or location at the absolute end of code space. This would give me an "end marker" for my checksum or CRC procedure. Ray
Refer to http://www.keil.com/support/docs/494.htm. Jon
Well Ray, I discovered a way to get around it, even though I do know my program code size, I am still going to run my checksum across the full 64K code size that is available. So it will in fact be traversing alot of unused Memory Locations. The way I'm approaching it is to use memory specific pointers, I've set up a MemPtr in code memory to point to the first location of code memory unsigned char code *MemPtr = 0x0000; This will be fixed forever which is ideal. In my CRCCompute function I then pass it two parameters, effectively the starting address and then a constant for the end address (representing 64K), I use this constant to set up an EndPtr to point to the start address + this fixed constant i.e. the end of my code memory. I then use pointer arithmetic to traverse the locations!
"Unlike you (I think), I do not know my code size and wanted to find a way to declare a label or location.." You can avoid the need for any of this by just running the check over the entire ROM Chip. Just make sure that you fill all unused locations with a known value (eg, 0xFF).