verify vector checksum

Hi,

I've installed a second bootloader code, which is already running, but I'm facing a problem to test if the user application is really valid.

My bootloader which starts at 0x00 will start my application which is located at 0x10000. Before starting the application I want to verify if the vector table is correct. I've found the information that the 0x1001C should contain the checksum of the first 7 vectors. Unfortunately this int value is 0x00.

Testing the same code with the addr 0x00 is working - which means the checksum value for the bootloader is correct.

#define USER_FLASH_START 0x10000
#define COMPUTE_BINARY_CHECKSUM

int user_code_present(void)
{
param_table[0] = BLANK_CHECK_SECTOR;
param_table[1] = USER_START_SECTOR;
param_table[2] = USER_START_SECTOR;
iap_entry(param_table,result_table);
if( result_table[0] == CMD_SUCCESS )
return (FALSE);

#ifdef COMPUTE_BINARY_CHECKSUM
unsigned *pmem, checksum,i;

checksum = 0;
pmem = (unsigned *)USER_FLASH_START;
for (i = 0; i <= 7; i++)
{
checksum += *pmem;
pmem++;
}
if (checksum != 0)
{
return (FALSE);      //<- always false
}
else
#endif

{
return (TRUE);
}
}

Is there a setting I've to attach in Keil to generate this checksum value?

By the way, the application is running from the bootloader code.

best regards
Lars

More questions in this forum