[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] optimization flags causes problems??
From: |
Ramazan Kerek |
Subject: |
[avr-gcc-list] optimization flags causes problems?? |
Date: |
Thu, 17 Apr 2008 10:15:43 +0300 |
Hello,
I have started using AT90CAN128 with WinAVR-20080402.
I am having problem with with optimizatin flags.
1- When I use the following code along with "-O1, -O2,-O3, -O4, -Os "
and whenI debug it, I do not see any change in PORTA. But when I built
it with -O0, I see the changes in PORTA as I expected.
DDRA=0xFF;
for(i=0;i<8;i++)
{
PORTA=0x01;
PORTA=0x02;
PORTA=0x04;
PORTA=0x08;
PORTA=0x10;
PORTA=0x20;
PORTA=0x40;
PORTA=0x80;
}
2-I am using EEPROM_Write/Read functions in my project. When I compile
the project with -O0 option, and start dtata transfer to EEPROM memory,
I do not see any transfer to EEPROM memory. With other optimization
options, I can transfer it.
See the functions below
void EEPROM_write (unsigned int uiAddress, unsigned char *ucWrData,
unsigned int uiBufSize)
{
volatile unsigned int i=0;
asm("cli");
for(i=0;i<uiBufSize;i++)
{
/* Wait for completion of previous write */
while(EECR & (1<<EEWE));
while(SPMCSR & (1<<SPMEN));
/* Set up address and data registers */
EEAR = uiAddress++;
EEDR = *(ucWrData++);
/* Write logical one to EEMWE */
EECR |= (1<<EEMWE);
/* Start eeprom write by setting EEWE */
EECR |= (1<<EEWE);
}
EECR=0x00;
asm("sei");
}
void EEPROM_read(unsigned int uiAddress, unsigned char
*ucRdData,unsigned char ucRdDataSize)
{
volatile unsigned int i=0;
asm("cli");
for(i=0;i<ucRdDataSize;i++)
{
/* Wait for completion of previous write */
while(EECR & (1<<EEWE));
while(SPMCSR & (1<<SPMEN));
/* Set up address register */
EEAR = uiAddress++;
/* Start eeprom read by writing EERE */
EECR |= (1<<EERE);
/* Return data from data register */
*(ucRdData++)=EEDR;
}
EECR=0x00;
asm("sei");
}
COULD YOU PLEASE TELL ME IF ANYONE IS HAVING SIMILAR PROBLEMS?
IF SO, IS THERE ANY SOLUTION FOR THIS.
Best Regards
R. Kerek
- [avr-gcc-list] optimization flags causes problems??,
Ramazan Kerek <=
- RE: [avr-gcc-list] optimization flags causes problems??, Ramazan Kerek, 2008/04/17
- RE: [avr-gcc-list] optimization flags causes problems??, Ramazan Kerek, 2008/04/17
- RE: [avr-gcc-list] optimization flags causes problems??, Ramazan Kerek, 2008/04/17
- RE: [avr-gcc-list] optimization flags causes problems??, Ramazan Kerek, 2008/04/18
- RE: [avr-gcc-list] optimization flags causes problems??, Ramazan Kerek, 2008/04/18