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

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

[avr-gcc-list] Thanks for a great tool!


From: Ned Konz
Subject: [avr-gcc-list] Thanks for a great tool!
Date: Wed, 30 Jun 2004 13:00:12 -0700
User-agent: KMail/1.6.2

I finally got around to trying avr-gcc on my latest hardware project (see 
http://nedkonz.dhs.org:8080/Ned/46) and I have to say that things went much 
easier and better than I'd expected!

I've used a few C compilers for 8 bit micros before, and have done a lot of 
embedded work, so the basic stuff wasn't a problem.

I was impressed by the quality of the code output, as well as the various 
tools. I already use GCC, GNU make, and binutils on my Linux system, of 
course, so I was familiar with most of the tools.

I did think that the avr-libc library headers could be improved by using 
bitfields instead of the _BV() macros where appropriate (and by supplying 
task-oriented inlines for what people really do with these micros). This is 
especially useful when the bitfields are more than one bit wide.

That is, I think that:

        timerControlRegister1A.pwmAEnable = 1;
        timerControlRegister1A.comparatorAOutputMode = 3;

        timerControlRegister1A.pwmBEnable = 1;
        timerControlRegister1A.comparatorBOutputMode = 3;

        timerControlRegister1B.timerPrescaleSelect = 1;

is a bit nicer than:

        TCCR1A |= _BV(COM1A1) | _BV(COM1A0) | _BV(COM1B1) | _BV(COM1B0) | 
_BV(PWM1A) 
| _BV(PWM1B);
        TCCR1B &= ~(_BV(_CS13) | _BV(_CS12) | _BV(_CS11) | _BV(_CS10));
        TCCR1B |= _BV(_CS10);

and generates the same code:

 196:   90 b7           in      r25, 0x30       ; 48    tccr1a
 198:   93 6f           ori     r25, 0xF3       ; 243
 19a:   90 bf           out     0x30, r25       ; 48    tccr1a
 19c:   7f b5           in      r23, 0x2f       ; 47    tccr1b
 19e:   70 7f           andi    r23, 0xF0       ; 240
 1a0:   71 60           ori     r23, 0x01       ; 1
 1a2:   7f bd           out     0x2f, r23       ; 47

Thanks,
-- 
Ned Konz
http://bike-nomad.com



reply via email to

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