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
You'd typically define a post-link application to run and perform whatever packaging and checksumming you wanted. Under the "user" tab of the options you can select "Run User Program" at various stages.
The ARM architecture doesn't define +0x1C as being a checksum, some manufacters use it for a sum or size field, really depends on what exactly you're using. But this is usually a boot condition, if you have your own boot loader, and it's not checking it, no one really cares what's there. Most every thing I've used, or worked on, has a checksum or CRC at the end of the image, to ensure it's completely intact