AnsweredAssumed Answered

checksum CODE and IELFTOOL

Question asked by guif on Apr 23, 2013
Latest reply on Apr 23, 2013 by Clive One
Hello everybody,

I would like to know if you have already use IELFTOOL to calculate the checksum of your code and to store it in the FLASH.

Like explain by IAR and theirs technicals notes, 
->I have created a section like this in the ICF file:

1.define block CHECKSUM_TEST { readonly section .checksum };
2.place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
3.place in ROM_region { ro, first block CHECKSUM_TEST };

and I add 
1.--keep=__checksum --place_holder __checksum,2,.checksum,4
line to arguments of IAR ELF linker.

If I see the MAP file, I can see the section created and keep:
1."P1":                                     0x5b70
2.  CHECKSUM_TEST               0x08000124     0x2  <Block>
3.    .checksum        const    0x08000124     0x2  Place holder __checksum
4.   ...


Now, I would like to calculate the checksum with IELFTOOL.
So I tried to use the tool like this:
1.ielftool --checksum=__checksum:2,crc16;0xSTART_RANGE-0xEND_RANGE

This method works if I choose a START_RANGE just after the .checksum (ok it's normal) and If I chhose the END_RANGE in the code, not after the code.

Else ielftool write an error :
1.ielftool error: The checksum range contains uninitialized data
 Do you know How to Find the last byte of code?

And do you think that my method is ok or not?

Thank a lot.


Outcomes