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

[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: Wed, 5 Mar 2008 11:09:27 +0700

This is the code:

#define sbi(PORT,BIT) (PORT |= (1<<BIT))
#define cbi(PORT,BIT) (PORT &= ~(1<<BIT))
#define ToPABX sbi(PORTC,1)
#define ExitPABX cbi(PORTC,1)
#define LoadToLine sbi(PORTC,2)
#define LoadOff cbi(PORTC,2)
#define PABXPowerOn sbi(PORTD,4)
#define PABXPowerOff cbi(PORTD,4)

void InitLoad(void)
{
sbi(DDRC,2);
LoadOff;
}

void InitPABX(void)
{
sbi(DDRC,1);
sbi(DDRD,4);
ExitPABX;
PABXPowerOff;
}

the LST generated file:

992:voip.c        **** void InitLoad(void)
993:voip.c        **** {
1384                ,1000,.LM218-InitPABX
1385                .LM218:
1386                 sbi 52-0x20,1
994:voip.c        ****  sbi(DDRC,2);
1388                19:
1389                 sbi 49-0x20,4
995:voip.c        ****  LoadOff;
1391                220:
1392                 cbi 53-0x20,1
1394                .LM221:
1395 0358 0895        cbi 50-0x20,4
1396                /* epilogue: frame size=0 */
1397                 ret
1398                /* epilogue end (size=1) */
1399                /* function InitPABX size 5 (4) */
1401                .Lscope32:
1403                .global InitIndicator
996:voip.c        **** }
997:voip.c        ****
998:voip.c        **** void InitPABX(void)
999:voip.c        **** {
1404                dicator, @function
1405                InitIndicator:
1407                .LM222:
1000:voip.c        ****  sbi(DDRC,1);
1408                rologue: frame size=0 */
1409                /* prologue end (size=0) */
1001:voip.c        ****  sbi(DDRD,4);
1411                223:
1412                 sbi 49-0x20,0
1002:voip.c        ****  ExitPABX;
1414                224:
1415                 sbi 50-0x20,0
1416 035e A998       /* epilogue: frame size=0 */
1003:voip.c        ****  PABXPowerOff;
1417                t
1418                /* epilogue end (size=1) */
1419 0360 9498       /* function InitIndicator size 3 (2) */
1421 0362 0895       .Lscope33:
1423                .global __vector_2
1425                __vector_2:
1427                .LM225:
1428                /* prologue: frame size=0 */
1429                 push __zero_reg__
1004:voip.c        **** }
1005:voip.c        ****


Andi

----- Original Message ----- From: "Paulo Marques" <address@hidden>
To: "Andi" <address@hidden>
Cc: <address@hidden>
Sent: Wednesday, March 05, 2008 11:06 AM
Subject: Re: [avr-gcc-list] PORTC


Quoting Andi <address@hidden>:
Hi,

Hi,

I have a program for atmega8 and the program is working well when I compile it using WinAVR-20040404-bin-install.exe. But when I compile it using WinAVR-20071221-install.exe the program isn't working anymore. And I found something, the compiler didn't the code to set and clear PORTC. I had tried using PORTC |= (1<<n) and PORTC &= ~(1<<n) but still the compiler won't compile it.

Is it a bug ? Or , do I miss something ?

It is hard to tell without knowing the rest of the code. If that snippet is in a static function that is not called from anywhere, the compiler is free to just drop it. Preferably provide a compilable small example, so that others can compile the same test and see what is going on.

--
Paulo Marques


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.






reply via email to

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