[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Optimization?
From: |
Patrick Lanphier |
Subject: |
[avr-gcc-list] Optimization? |
Date: |
Mon, 12 Nov 2001 21:27:29 -0500 (EST) |
Well the below code works fine, flashing that is, when using the -O3
optimization but does not work with -O1 optimization, I don't understand.
/**************************************************************************
avr-gcc -O0 -mmcu=at90s2313 -c demo2.c -o main.o
avr-gcc -o main.elf main.o
avr-objcopy -O ihex main.elf main.hex
***************************************************************************/
#include <io.h>
#include <interrupt.h>
#include <sig-avr.h>
int main(void)
{
uint8_t f,i, j, k;
outp(255, DDRB); /* port B all outputs */
outp(0, PORTB); /* turn all leds off */
while(1){
outp(0, PORTB); // turn led on
for(f=0; f<255; f++) // delay
for(i=0; i<255; i++)
for(j=0; j<255; j++)
k=k+1;
outp(255, PORTB); // turn led off
for(f=0; f<255; f++) // delay
for(i=0; i<255; i++)
for(j=0; j<255; j++)
k=k+1;
}
}
Patrick Lanphier
The Artemis Group
http://www.artemisgroup.com
phone: 814-235-0444
fax: 800-582-9710
- [avr-gcc-list] Optimization?,
Patrick Lanphier <=