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

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

Re: [avr-gcc-list] crc16.h - why inlined


From: Marek Michalkiewicz
Subject: Re: [avr-gcc-list] crc16.h - why inlined
Date: Sat, 11 Jan 2003 00:57:53 +0100 (CET)

> I like the efficient implementation of this routine. But, to come to 
> my initial post, as I needed it for a boot loader, I didn't have 
> much space, especially that I am using the ATmega8 with a maximum of 
> 2KB boot space. Therefore I had a problem with the inlined function. 

unsigned int
crc16_update_not_inline(unsigned int crc, unsigned char data)
{
        return _crc16_update(crc, data);
}

I've just checked GCC asm output - it's the original inline asm code
with only "ret" added, total 24 words.  Any inline function can be
easily made non-inline this way, if that helps to reduce code size
(it really depends very much on the application).

With some other hacks (like global register variables - for example,
put the CRC accumulator in r3:r2 instead of SRAM) you could even try
to fit the boot loader in 1K if you try hard enough... :)

Hope this helps,
Marek

avr-gcc-list at http://avr1.org



reply via email to

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