Hi, I want to know if exist some way to read or verify the version/checksum of the (.bin) program writed into the rabbit (RCM3720)???
for example: for PIC microcontroller we can use a universal programmer, select the device family and read, so we knows the checksum of the firmware writed in the chip.
I want to know how do this…
thanks
1 Like
This might provide a good starting point for code to accomplish your goal. I used it with an RCM2200 (and I believe RCM2260) back with Dynamic C 8.61.
The fs_checksum_x() function came from FS2.LIB. Note that it skips over the UserBlock which might be at the top of flash 1 (IIRC, the RCM2250/RCM2260 had two 256K flash chips).
This will only work on boards with parallel flash, where the entire flash space is mapped into physical memory. For Dynamic C 10.72, take a look at Samples/RemoteProgramUpdate/verify_firmware.c.
word getProgChecksum()
{
#define CHECK_BLOCK_SIZE 2048U
unsigned long checkaddr, bytestogo;
unsigned int checklen;
FSchecksum checksum;
checksum = 0;
bytestogo = ( ((unsigned long) prog_param.HPA.aaa.a.base) << 12) + prog_param.HPA.aaa.a.addr;
checkaddr = 0;
while (bytestogo) {
checklen = (bytestogo > CHECK_BLOCK_SIZE ? CHECK_BLOCK_SIZE : (unsigned int) bytestogo);
fs_checksum_x(&checksum, checkaddr, checklen);
checkaddr += checklen;
// skip over userblock
if (checkaddr == (0x40000 - MAX_USERBLOCK_SIZE)) checkaddr += MAX_USERBLOCK_SIZE;
bytestogo -= checklen;
}
return checksum;
}