Keine Ahnung wie der Kompiler das anstellt:
Wird bei mir zuCode:int main(void) { int i; int ba = 6, tempo = 45, temp; temp = 8505 - (ba * tempo); // Schleife1 Anfang for (i=0; i < temp; i++) {}; // Schleife 1 Ende // Schleife2 Anfang for (i=0; i < 8235; i++) {}; // Schleife2 Ende while(1); return(0); }
Identischer Code! 68-6c bzw. 72-76, hier mein Output beim Kompilieren:Code:0000005c <main>: int main(void) { 5c: cf e5 ldi r28, 0x5F ; 95 5e: d4 e0 ldi r29, 0x04 ; 4 60: de bf out 0x3e, r29 ; 62 62: cd bf out 0x3d, r28 ; 61 64: 8a e2 ldi r24, 0x2A ; 42 66: 90 e2 ldi r25, 0x20 ; 32 int i; int ba = 6, tempo = 45, temp; temp = 8505 - (ba * tempo); // Schleife1 Anfang for (i=0; i < temp; i++) {}; 68: 8d 97 sbiw r24, 0x2d ; 45 6a: 97 ff sbrs r25, 7 6c: fd cf rjmp .-6 ; 0x68 <main+0xc> 6e: 8a e2 ldi r24, 0x2A ; 42 70: 90 e2 ldi r25, 0x20 ; 32 // Schleife 1 Ende // Schleife2 Anfang for (i=0; i < 8235; i++) {}; 72: 8d 97 sbiw r24, 0x2d ; 45 74: 97 ff sbrs r25, 7 76: fd cf rjmp .-6 ; 0x72 <main+0x16> // Schleife2 Ende while(1); 78: ff cf rjmp .-2 ; 0x78 <main+0x1c>
Verblüffend.Code:rm -f test.hex rm -f test_eeprom.hex rm -f test.elf rm -f test.map rm -f test.cof rm -f test.lst rm -f temp.lst rm -f temp.o avr-gcc -mmcu=atmega8 -Os -mno-interrupts -funsigned-char -funsigned-bitfields -Wall -Wstrict-prototypes -ggdb -c -DF_CPU=8000000UL -Wa,-acdhlmns=temp.lst temp.c -o temp.o avr-gcc -mmcu=atmega8 -Os -mno-interrupts -funsigned-char -funsigned-bitfields -Wall -Wstrict-prototypes -ggdb temp.o -o test.elf -Wl,-Map=test.map --cref -lm avr-objcopy -j .text -j .data -O ihex test.elf test.hex avr-objcopy -j .eeprom --change-section-lma .eeprom=0 -O ihex test.elf test_eeprom.hex avr-objdump -d -S test.elf > test.lst 0







Zitieren

Lesezeichen