[Top][All Lists]

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

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

From: Flemming Gram Christensen
Subject: Re: [avr-gcc-list] crc16.h - why inlined
Date: Fri, 10 Jan 2003 08:52:34 +0100
User-agent: Mutt/1.2.5i

The funtion could be doubled in libc.

void foo() { ... }

_inline_ void fooInlined() { ... }
void foo() { fooInlined() }

This way you can get efficiency in uart routines and 
save program space in bootloaders.


On Thu, Jan 09, 2003 at 10:29:48PM +0100, Volkmar Dierkes wrote:
> Jörg,
> On Thu, 9 Jan 2003 10:22:14 +0100 (MET), Joerg Wunsch wrote:
> > Volkmar Dierkes <address@hidden> wrote:
> >
> >> I used these days the _crc16_update function which works very well.
> >> But why it is defined as an inlined function? As I can see there is
> >> no additional prologue/epilogue code if compiled without inline.
> >
> > The value of this file has already been questioned on the avr-libc
> > mailing list.
> I was not sure if I should send it to the avr-libc or avr-gcc list.
> > We are open for any suggestions, ranging from putting
> > it into an include/compat directory and maintain it for backwards
> > compatibility with older avr-libc releases only, up to make it as
> > useful as possible -- and then fully documented.  If you're using it,
> > and find it useful, please make a stab at documenting it (and in
> > particular, provide a small example for its use).
> I will tell you something about my project. I am implementing a boot 
> loader. I now, there are some available, but non of them meet my 
> requirements. Therefore I changed an existing boot loader which I 
> got from Gernot Gams. His version works very well but I wanted to 
> have a check at the start of the boot loader for correct content in 
> the flash. Also I found that his version has some problems if the 
> hex file isn't in the right format (all page to page borders are at 
> the end of a data line) I decided to include a CRC at the received 
> bytes too. Than I looked for CRC algorithmens but I didn't found 
> something what I am looked for. As I began my own implementation I 
> had the idea to look at the gcc files. And wow, there was a crc16.h 
> ;-)
> 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. 
> I need the function 3 times and this is for this application too 
> much space. I used the crc16 also for incoming data via uart as for 
> calculation of a crc for a flash block. Both are mentioned by Marek.
> As Marek wrote, he thougth that the inlined usage shouldn't be a 
> problem. In most application this might be, but for this it was to 
> much. I didn't used it in a ISR, in this case it would be better to 
> have it inlined. But on my opinion in most cases this could be done 
> outside of an ISR.
> The resulted code for the function increases only a little bit: 
> call/ret and two movw instructions. Maybe a earlier avr-gcc version 
> produced more overhead or maybe in another environment. I used the 
> WINAVR of december.
> Joerg, one question. what do you mean with a "stab" for documenting 
> it. Maybe I can provide the bootloader itself as a example (but this 
> would be a big example, and at least for the boot stuff, too), but I 
> want to ask Gernot Gams before, because I got the initial code from 
> him.
> Volkmar
> avr-gcc-list at http://avr1.org

Flemming Gram Christensen, M.Sc., Software Engineer, Mjølner Informatics
Mjolner Informatics A/S                   Phone:  +45 70 27 43 43       
Helsingforsgade 27                        Fax:    +45 70 27 43 44
DK-8200 Aarhus N, Denmark                 E-mail: address@hidden    
avr-gcc-list at http://avr1.org

reply via email to

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