[Top][All Lists]

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

Re: [avr-gcc-list] PORTC

From: Andi
Subject: Re: [avr-gcc-list] PORTC
Date: Tue, 11 Mar 2008 09:59:11 +0700

Hi Joerg,

I didn't missed to add #include <avr/io.h> in my file. Sorry I didn't attach the all code because it's too long. I have no problem before when I compile with WinAVR2004 and WinAVR2005, this only happen with WinAVR2007 where the compiler can generate sbi and cbi command for PORTC (no problem for the other ports)
I'm still checking where is the problem now.


----- Original Message ----- From: "Joerg Wunsch" <address@hidden>
To: <address@hidden>
Sent: Tuesday, March 11, 2008 3:32 AM
Subject: Re: [avr-gcc-list] PORTC

"Andi" <address@hidden> wrote:

This is the code:

Sending compilable code makes us better trust you not doing any
copy&paste errors.  Let's hope all that you left out is the #include

the LST generated file:

I never understand why people are so fond of that unreadable
disassembly stuff.  It also appears your copy&paste left out some
single letters there.

Here's the assembly code the compiler generates when I add the
<avr/io.h> include line, and compile it for an ATmega8 with -Os:

..global InitLoad
       .type   InitLoad, @function
/* prologue: frame size=0 */
/* prologue end (size=0) */
       sbi 52-0x20,2
       cbi 53-0x20,2
/* epilogue: frame size=0 */
/* epilogue end (size=1) */
/* function InitLoad size 3 (2) */
       .size   InitLoad, .-InitLoad
..global InitPABX
       .type   InitPABX, @function
/* prologue: frame size=0 */
/* prologue end (size=0) */
       sbi 52-0x20,1
       sbi 49-0x20,4
       cbi 53-0x20,1
       cbi 50-0x20,4
/* epilogue: frame size=0 */
/* epilogue end (size=1) */
/* function InitPABX size 5 (4) */

That looks pretty fine to me.  If I compile it into a .o file, and
just disassemble it (without the annoying attempt to intersperse it
with what the disassembler believes were the related source code),
I get:

Disassembly of section .text:

00000000 <InitLoad>:
  0:   a2 9a           sbi     0x14, 2 ; 20
  2:   aa 98           cbi     0x15, 2 ; 21
  4:   08 95           ret

00000006 <InitPABX>:
  6:   a1 9a           sbi     0x14, 1 ; 20
  8:   8c 9a           sbi     0x11, 4 ; 17
  a:   a9 98           cbi     0x15, 1 ; 21
  c:   94 98           cbi     0x12, 4 ; 18
  e:   08 95           ret

Again, all looks fine to me.

cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

AVR-GCC-list mailing list

reply via email to

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