avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] __checksum


From: David Kelly
Subject: Re: [avr-gcc-list] __checksum
Date: Thu, 29 May 2008 12:09:56 -0500
User-agent: Mutt/1.4.2.3i

On Thu, May 29, 2008 at 09:48:08AM -0700, trile58 wrote:
> 
> I have been successfully porting the old code from IAR to AVR GCC except for
> the followings:
> 
> extern flash unsigned short __checksum; 
>    CRC_SUM = 0;              /* Clear CRC-Check of Program Memory (Flash)     
>         
> */            
>    /* Checksum of Program memory  (IAR-Example)  */
>     CRC_SUM = slow_crc16(CRC_SUM,(unsigned char flash *)0,(unsigned
> long)&__checksum);
>     CRC_SUM = slow_crc16(CRC_SUM,(unsigned char flash *)&zero,sizeof(zero)); 
>      /* call with two 0 bytes for the correct calculation of crc */
>    
> I had flash changed to PROGMEM as instructed in the porting document.
> However, I got an error "undefined reference to __checksum" . From
> Porting from IAR to AVR GCC document, it does not list __checksum  is
> one of the thing need to be ported. I wonder how this __checksum gets
> created and where it is located.  Please advice.

Am guessing you are trying to verify FLASH program content.

What I find online of IAR's slow_crc16() is that the last argument is
the number of bytes starting at the 2nd argument. Your code above is
making an assumption that it is to CRC everything from and including
address 0x0000 to but not including a memory location containing
__checksum.

Avg-gcc isn't going to make or fill a variable named __checksum unless
you do it yourself.

-- 
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]