RE: [avr-gcc-list] Using in/out Instructions with ATmega128

2009-05-04 Thread Weddington, Eric
 

 -Original Message-
 From: 
 avr-gcc-list-bounces+eric.weddington=atmel@nongnu.org 
 [mailto:avr-gcc-list-bounces+eric.weddington=atmel@nongnu.
 org] On Behalf Of Thomas D. Dean
 Sent: Monday, May 04, 2009 4:37 PM
 To: avr-gcc-list@nongnu.org
 Subject: [avr-gcc-list] Using in/out Instructions with ATmega128
 
 I have
 # avr-gcc --version
 avr-gcc (GCC) 4.3.2
 Copyright (C) 2008 Free Software Foundation, Inc.
 ...
 
 I want to use the ATmega128 and in/out instructions for 
 registers below
 0x40.  
 
 # avr-gcc   -mmcu=atmega128  -c -o 4x40-lcd.o xxx.c
 # avr-gcc-mmcu=atmega128  4x40-lcd.o -o xxx.elf  -lc
 # avr-objdump   -d xxx.elf
 ...
 804:  a2 e3   ldi r26, 0x32   ; 50
  806: b0 e0   ldi r27, 0x00   ; 0
  808: e2 e3   ldi r30, 0x32   ; 50
  80a: f0 e0   ldi r31, 0x00   ; 0
  80c: 80 81   ld  r24, Z
  80e: 8f 70   andir24, 0x0F   ; 15
  810: 80 62   ori r24, 0x20   ; 32
  812: 8c 93   st  X, r24
 ...
 
 This can be done with four instructions, in, andi, ori, and, 
 out.  And,
 6 fewer clocks.

Where is the source code that corresponds to the above assembly?


___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


RE: [avr-gcc-list] Using in/out Instructions with ATmega128

2009-05-04 Thread Weddington, Eric
 

 -Original Message-
 From: 
 avr-gcc-list-bounces+eric.weddington=atmel@nongnu.org 
 [mailto:avr-gcc-list-bounces+eric.weddington=atmel@nongnu.
 org] On Behalf Of Thomas D. Dean
 Sent: Monday, May 04, 2009 4:37 PM
 To: avr-gcc-list@nongnu.org
 Subject: [avr-gcc-list] Using in/out Instructions with ATmega128
 
 I have
 # avr-gcc --version
 avr-gcc (GCC) 4.3.2
 Copyright (C) 2008 Free Software Foundation, Inc.
 ...
 
 I want to use the ATmega128 and in/out instructions for 
 registers below
 0x40.  
 
 # avr-gcc   -mmcu=atmega128  -c -o 4x40-lcd.o xxx.c

Also, you need to turn optimization on to get those IN/OUT instructions. Add 
-Os to your compiler flags.


___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


RE: [avr-gcc-list] Using in/out Instructions with ATmega128

2009-05-04 Thread Weddington, Eric
 

 -Original Message-
 From: Thomas D. Dean [mailto:tomd...@speakeasy.org] 
 Sent: Monday, May 04, 2009 5:24 PM
 To: Weddington, Eric
 Subject: RE: [avr-gcc-list] Using in/out Instructions with ATmega128
 
 On Mon, 2009-05-04 at 17:08 -0600, Weddington, Eric wrote:
 
  Also, you need to turn optimization on to get those IN/OUT 
 instructions. 
  Add -Os to your compiler flags.
 
 Thanks, -o3 gets covered by -o fname later in the command stream!

No. The switches are case sensitive, just like the C language itself. You want 
to use an uppercase 'O', not lowercase. It is better if you optimize for size, 
rather than for speed. This is why it is suggested to use -Os, not -O3.

And please also reply to the list and not just to me personally.


___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list