ADSP BF 548 Checksum calculation.

HI Everybody

Iam using ADSP BF 548 evaluation board in my project,i need to calculate checksum of my application code,i want to use Xor for checksum,but i am not getting which address my code is stored ?iam booting my code from external flash(NOR FLASH). do i need to use nor flash address read and need to calculate checksum? can anybody suggest me how to calculate checksum?

below is the sample code for calculating checksum.

can anybody suggest us how i have to take address?

unsigned int chkSumCnt=0;
unsigned int *FlashAddress = (unsigned int *)0xffa10000;
unsigned short m_nCheckSum=0;

for(chkSumCnt=0;chkSumCnt<=0x3FFF;chkSumCnt++)
{
      m_nCheckSum^=*FlashAddress;
      FlashAddress++;
}
printf("Chksm is %x\n\r",m_nCheckSum);.

Best regards

Amar TR

Software engineer

SLN technologies.

Parents
  • Dear Jithul

     

    Thanks for the reply,"yes we are going to add the checksum code snippet in our application code",

     

    below is the sample code for calculating checksum.

     

    unsigned short ChecksumValue=0,ChecksumValue1=0,AddrInc=0,tempvar=0;

     

    for(AddrInc=0;AddrInc<0x452;AddrInc++)
    {
          ChecksumValue = (*(volatile unsigned short *)((0x20000000)+tempvar));
          printf("%x\n\r",ChecksumValue);
          ChecksumValue1 = (ChecksumValue1 ^ ChecksumValue);
          tempvar+=2;
    }
    printf("Final Checksum is %x\n\r",ChecksumValue1 );

     

    when i print the Checksum variable after each reading as mentioned in above code snippet

    0x5006

    0xafd2

    0x0

    0x620

    0x0

    and this sequence is repeating continously, may i know the reason for this? i initialized the external bus also and my external flash start address is 0x20000000,is any ther configuration is missing? or i have to point to other address? or do i have to take sram address?  

     

    Best regards

    Amar TR

    Software engineer

    SLN technologies.

  • +1
    •  Analog Employees 
    on Nov 8, 2018 7:45 AM over 1 year ago in reply to amar26121993

    Hi Amar,

    The -CRC32 (polynomial coefficient) switch directs the loader utility to generate CRC32 checksum. Use a polynomial coefficient if specified; otherwise, use default 0xD8018001.

    The -CRC32 switch can be inserted in the 'Additional Option' of 'Load' properties. Refer the attached image, in case of you want to use different polynomial coefficient declare the switch as follows, -CRC32 polynomial coefficient value (eg: -CRC32 0xA8018001)

    This switch inserts an initcode boot block that calls an initialization routine residing in the on-chip boot ROM. The argument field of the boot block provides the used polynomial. The loader utility calculates the CRC checksum for all subsequent data blocks and stores the result in the block header’s argument field. Please refer the image "ldr with CRC switch.JPG" for better understanding.

    Hope this helps.

    Best Regards,

    Jithul

Reply
  • +1
    •  Analog Employees 
    on Nov 8, 2018 7:45 AM over 1 year ago in reply to amar26121993

    Hi Amar,

    The -CRC32 (polynomial coefficient) switch directs the loader utility to generate CRC32 checksum. Use a polynomial coefficient if specified; otherwise, use default 0xD8018001.

    The -CRC32 switch can be inserted in the 'Additional Option' of 'Load' properties. Refer the attached image, in case of you want to use different polynomial coefficient declare the switch as follows, -CRC32 polynomial coefficient value (eg: -CRC32 0xA8018001)

    This switch inserts an initcode boot block that calls an initialization routine residing in the on-chip boot ROM. The argument field of the boot block provides the used polynomial. The loader utility calculates the CRC checksum for all subsequent data blocks and stores the result in the block header’s argument field. Please refer the image "ldr with CRC switch.JPG" for better understanding.

    Hope this helps.

    Best Regards,

    Jithul

Children
No Data