This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Validating my code memory

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

Parents
  • 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!

Reply
  • 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!

Children
No data