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: Volkmar Dierkes
Subject: Re: [avr-gcc-list] crc16.h - why inlined
Date: Sat, 11 Jan 2003 01:59:59 +0100
User-agent: 40tude_Dialog/2.0.3.1 Hamster/2.0.0.0

Marek,

On Sat, 11 Jan 2003 00:57:53 +0100 (CET), Marek Michalkiewicz wrote:

>> 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).

Thanks for the hint. Sometimes I can't see a tree in front of a 
whole wood ;-) In this case it isn't necessary to change the 
crc16.h. Than it is already compatible to exisiting projects.
 
> 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... :)

I am sorry, but in this case I have to delete the nice CRC16 and I 
think you didn't want this ;-)

BTW: As just compiled, my bootloader has a size of 1876 Bytes. As I 
tested it to use it for ATmega128 I found some more bytes in the 
code ;-) Only to use unsigned int instead of unsigned long (which is 
necessary for the big flash area of the m128) results in about 100 
Bytes less. But do not ask for the size of the m128 version of the 
bootloader. It is much bigger and doesn't fit into 2K any more. But 
that shouldn't be a problem for the m128 and if anyone need a 
smaller bootloader, he can do the job to minimize the code.

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



reply via email to

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