[Top][All Lists]
[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:59:39 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, May 29, 2008 at 11:25:01AM -0600, Blake Leverett wrote:
> On Thursday 29 May 2008, trile58 wrote:
> >
> > I had flash changed to PROGMEM as instructed in the porting document.
> > However, I got an error "undefined reference to __checksum" .
> It looks like the problem is the "flash" keyword. Avr-gcc handles
> flash differently from IAR - so more is needed than just a keyword
> change. The __checksum name is just a variable name, so I think that
> the flash keyword is where the compiler is losing track.
Yes, but an undefined reference says that *nothing* is known about
__checksum. Would seem IAR automatically buries a __checksum in the code
image but avr-gcc does not.
> Be sure you are including <avr/pgmspace.h>, and you may want to place
> the PROGMEM keyword later in the line:
>
> extern unsigned short PROGMEM __checksum;
But somewhere one has to allocate this variable and somehow put
something in it.
> Also, in the slow_crc16() function, make sure that you call
> pgm_read_byte() or pgm_read_word() as necessary. You cannot simply
> say
>
> uint16_t a = __checksum;
>
> you have to use
>
> uint16_t a = pgm_read_word(&__checksum);
>
> Or something like that.
Not only that but if the intent is to CRC the FLASH contents then
slow_crc16() needs to be coded accordingly. Is my understanding that
slow_crc16() is a standard IAR library function.
--
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.