logo elektroda
logo elektroda
X
logo elektroda
REKLAMA
REKLAMA
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

Dziwne zachowanie AVR Studio/AVR GCC

benedykt02 18 Lut 2009 11:46 2495 5
REKLAMA
  • #1 6167382
    benedykt02
    Poziom 10  
    Witam.

    Zainstalowalem sobie:
    - AVR Studio 4.15 (Build 623)
    - WinAVR-20081124rc3

    Napisalem prosty program:

    
    # define F_CPU 16000000UL
    #include <avr/io.h> 
    #include <avr/interrupt.h>
    #include <util/delay.h>
    
    void delayms(uint16_t millis);
    
    void delayms(uint16_t millis) {
      while ( millis) {
        _delay_ms(1);
        millis--;
      }
    }
    
    
    int main(void) {
      DDRB |= 1<<PB0; // set PB0 to output 
      while(1) {
        PORTB &= ~(1<<PB0); // LED on 
        delayms(100);
        PORTB |= 1<<PB0; // LED off 
        delayms(100);
      }
      return 0;
    }
    


    WYNIK: PIĘKNIE MRUGA :)

    Ale jak wywalilem funkcje delayms do drugiego pliku:

    # define F_CPU 16000000UL
    #include <avr/io.h> 
    #include <avr/interrupt.h>
    #include <util/delay.h>
    
    void delayms(uint16_t millis);
    
    
    int main(void) {
      DDRB |= 1<<PB0; // set PB0 to output 
      while(1) {
        PORTB &= ~(1<<PB0); // LED on 
        delayms(100);
        PORTB |= 1<<PB0; // LED off 
        delayms(100);
      }
      return 0;
    }



    oraz:

    # define F_CPU 16000000UL
    #include <avr/io.h> 
    #include <avr/interrupt.h>
    #include <util/delay.h>
    
    
    void delayms(uint16_t millis) {
      while ( millis) {
        _delay_ms(1);
        millis--;
      }
    }
    


    WYNIK: NIC NIE MRUGA :((((((((((

    Zagladnalem do plikow lss, i w programie nie dzialajacym wywolywana jest funkcja call 0xe8 ; 0xe8 <delayms> ,
    ktora pozniej wraca ret -em.... Po probach zobaczylem ze z powrotem jest problem.

    PROSZE O POMOC. Jednak chcialbym pisac w C niz w assemblerze :(


    Dodatkowe informacje:

    Kompilacja:

    Build started 18.2.2009 at 11:28:15
    avr-gcc  -mmcu=atmega128 -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT 2th.o -MF dep/2th.o.d  -c  ../2th.c
    avr-gcc -mmcu=atmega128 -Wl,-Map=2th.map 2th.o     -o 2th.elf
    avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature  2th.elf 2th.hex
    avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex 2th.elf 2th.eep || exit 0
    avr-objdump -h -S 2th.elf > 2th.lss
    Build succeeded with 0 Warnings...



    2th.lss
    
    2th.elf:     file format elf32-avr
    
    Sections:
    Idx Name          Size      VMA       LMA       File off  Algn
      0 .text         00000110  00000000  00000000  00000054  2**1
                      CONTENTS, ALLOC, LOAD, READONLY, CODE
      1 .debug_aranges 00000020  00000000  00000000  00000164  2**0
                      CONTENTS, READONLY, DEBUGGING
      2 .debug_pubnames 00000027  00000000  00000000  00000184  2**0
                      CONTENTS, READONLY, DEBUGGING
      3 .debug_info   000001d6  00000000  00000000  000001ab  2**0
                      CONTENTS, READONLY, DEBUGGING
      4 .debug_abbrev 000000f2  00000000  00000000  00000381  2**0
                      CONTENTS, READONLY, DEBUGGING
      5 .debug_line   000001a2  00000000  00000000  00000473  2**0
                      CONTENTS, READONLY, DEBUGGING
      6 .debug_frame  00000030  00000000  00000000  00000618  2**2
                      CONTENTS, READONLY, DEBUGGING
      7 .debug_str    000000bb  00000000  00000000  00000648  2**0
                      CONTENTS, READONLY, DEBUGGING
      8 .debug_loc    00000080  00000000  00000000  00000703  2**0
                      CONTENTS, READONLY, DEBUGGING
      9 .debug_ranges 00000060  00000000  00000000  00000783  2**0
                      CONTENTS, READONLY, DEBUGGING
    
    Disassembly of section .text:
    
    00000000 <__vectors>:
       0:	0c 94 46 00 	jmp	0x8c	; 0x8c <__ctors_end>
       4:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
       8:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
       c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      10:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      14:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      18:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      1c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      20:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      24:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      28:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      2c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      30:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      34:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      38:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      3c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      40:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      44:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      48:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      4c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      50:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      54:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      58:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      5c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      60:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      64:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      68:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      6c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      70:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      74:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      78:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      7c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      80:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      84:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      88:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
    
    0000008c <__ctors_end>:
      8c:	11 24       	eor	r1, r1
      8e:	1f be       	out	0x3f, r1	; 63
      90:	cf ef       	ldi	r28, 0xFF	; 255
      92:	d0 e1       	ldi	r29, 0x10	; 16
      94:	de bf       	out	0x3e, r29	; 62
      96:	cd bf       	out	0x3d, r28	; 61
    
    00000098 <__do_copy_data>:
      98:	11 e0       	ldi	r17, 0x01	; 1
      9a:	a0 e0       	ldi	r26, 0x00	; 0
      9c:	b1 e0       	ldi	r27, 0x01	; 1
      9e:	e0 e1       	ldi	r30, 0x10	; 16
      a0:	f1 e0       	ldi	r31, 0x01	; 1
      a2:	00 e0       	ldi	r16, 0x00	; 0
      a4:	0b bf       	out	0x3b, r16	; 59
      a6:	02 c0       	rjmp	.+4      	; 0xac <__do_copy_data+0x14>
      a8:	07 90       	elpm	r0, Z+
      aa:	0d 92       	st	X+, r0
      ac:	a0 30       	cpi	r26, 0x00	; 0
      ae:	b1 07       	cpc	r27, r17
      b0:	d9 f7       	brne	.-10     	; 0xa8 <__do_copy_data+0x10>
      b2:	1b be       	out	0x3b, r1	; 59
    
    000000b4 <__do_clear_bss>:
      b4:	11 e0       	ldi	r17, 0x01	; 1
      b6:	a0 e0       	ldi	r26, 0x00	; 0
      b8:	b1 e0       	ldi	r27, 0x01	; 1
      ba:	01 c0       	rjmp	.+2      	; 0xbe <.do_clear_bss_start>
    
    000000bc <.do_clear_bss_loop>:
      bc:	1d 92       	st	X+, r1
    
    000000be <.do_clear_bss_start>:
      be:	a0 30       	cpi	r26, 0x00	; 0
      c0:	b1 07       	cpc	r27, r17
      c2:	e1 f7       	brne	.-8      	; 0xbc <.do_clear_bss_loop>
      c4:	0e 94 72 00 	call	0xe4	; 0xe4 <main>
      c8:	0c 94 86 00 	jmp	0x10c	; 0x10c <_exit>
    
    000000cc <__bad_interrupt>:
      cc:	0c 94 00 00 	jmp	0	; 0x0 <__vectors>
    
    000000d0 <delayms>:
        milliseconds can be achieved.
     */
    void
    _delay_loop_2(uint16_t __count)
    {
    	__asm__ volatile (
      d0:	20 ea       	ldi	r18, 0xA0	; 160
      d2:	3f e0       	ldi	r19, 0x0F	; 15
      d4:	04 c0       	rjmp	.+8      	; 0xde <delayms+0xe>
      d6:	f9 01       	movw	r30, r18
      d8:	31 97       	sbiw	r30, 0x01	; 1
      da:	f1 f7       	brne	.-4      	; 0xd8 <delayms+0x8>
    void delayms(uint16_t millis);
    
    void delayms(uint16_t millis) {
      while ( millis) {
        _delay_ms(1);
        millis--;
      dc:	01 97       	sbiw	r24, 0x01	; 1
    #include <util/delay.h>
    
    void delayms(uint16_t millis);
    
    void delayms(uint16_t millis) {
      while ( millis) {
      de:	00 97       	sbiw	r24, 0x00	; 0
      e0:	d1 f7       	brne	.-12     	; 0xd6 <delayms+0x6>
        _delay_ms(1);
        millis--;
      }
    }
      e2:	08 95       	ret
    
    000000e4 <main>:
    
    
    int main(void) {
      DDRB |= 1<<PB0; // set PB0 to output 
      e4:	b8 9a       	sbi	0x17, 0	; 23
      e6:	20 ea       	ldi	r18, 0xA0	; 160
      e8:	3f e0       	ldi	r19, 0x0F	; 15
      while(1) {
        PORTB &= ~(1<<PB0); // LED on 
      ea:	c0 98       	cbi	0x18, 0	; 24
      ec:	84 e6       	ldi	r24, 0x64	; 100
      ee:	90 e0       	ldi	r25, 0x00	; 0
      f0:	f9 01       	movw	r30, r18
      f2:	31 97       	sbiw	r30, 0x01	; 1
      f4:	f1 f7       	brne	.-4      	; 0xf2 <main+0xe>
    void delayms(uint16_t millis);
    
    void delayms(uint16_t millis) {
      while ( millis) {
        _delay_ms(1);
        millis--;
      f6:	01 97       	sbiw	r24, 0x01	; 1
    #include <util/delay.h>
    
    void delayms(uint16_t millis);
    
    void delayms(uint16_t millis) {
      while ( millis) {
      f8:	d9 f7       	brne	.-10     	; 0xf0 <main+0xc>
    int main(void) {
      DDRB |= 1<<PB0; // set PB0 to output 
      while(1) {
        PORTB &= ~(1<<PB0); // LED on 
        delayms(100);
        PORTB |= 1<<PB0; // LED off 
      fa:	c0 9a       	sbi	0x18, 0	; 24
      fc:	84 e6       	ldi	r24, 0x64	; 100
      fe:	90 e0       	ldi	r25, 0x00	; 0
     100:	f9 01       	movw	r30, r18
     102:	31 97       	sbiw	r30, 0x01	; 1
     104:	f1 f7       	brne	.-4      	; 0x102 <main+0x1e>
    void delayms(uint16_t millis);
    
    void delayms(uint16_t millis) {
      while ( millis) {
        _delay_ms(1);
        millis--;
     106:	01 97       	sbiw	r24, 0x01	; 1
    #include <util/delay.h>
    
    void delayms(uint16_t millis);
    
    void delayms(uint16_t millis) {
      while ( millis) {
     108:	d9 f7       	brne	.-10     	; 0x100 <main+0x1c>
     10a:	ef cf       	rjmp	.-34     	; 0xea <main+0x6>
    
    0000010c <_exit>:
     10c:	f8 94       	cli
    
    0000010e <__stop_program>:
     10e:	ff cf       	rjmp	.-2      	; 0x10e <__stop_program>
    


    kompilacje druga:

    Build started 18.2.2009 at 11:34:12
    avr-gcc  -mmcu=atmega128 -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT 2th.o -MF dep/2th.o.d  -c  ../2th.c
    avr-gcc  -mmcu=atmega128 -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT func.o -MF dep/func.o.d  -c  ../func.c
    avr-gcc -mmcu=atmega128 -Wl,-Map=2th.map 2th.o func.o     -o 2th.elf
    avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature  2th.elf 2th.hex
    avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex 2th.elf 2th.eep || exit 0
    avr-objdump -h -S 2th.elf > 2th.lss
    Build succeeded with 0 Warnings...


    plik lss:


    2th.elf:     file format elf32-avr
    
    Sections:
    Idx Name          Size      VMA       LMA       File off  Algn
      0 .text         00000100  00000000  00000000  00000054  2**1
                      CONTENTS, ALLOC, LOAD, READONLY, CODE
      1 .debug_aranges 00000040  00000000  00000000  00000154  2**0
                      CONTENTS, READONLY, DEBUGGING
      2 .debug_pubnames 00000039  00000000  00000000  00000194  2**0
                      CONTENTS, READONLY, DEBUGGING
      3 .debug_info   0000018d  00000000  00000000  000001cd  2**0
                      CONTENTS, READONLY, DEBUGGING
      4 .debug_abbrev 000000ed  00000000  00000000  0000035a  2**0
                      CONTENTS, READONLY, DEBUGGING
      5 .debug_line   000001b3  00000000  00000000  00000447  2**0
                      CONTENTS, READONLY, DEBUGGING
      6 .debug_frame  00000040  00000000  00000000  000005fc  2**2
                      CONTENTS, READONLY, DEBUGGING
      7 .debug_str    000000c5  00000000  00000000  0000063c  2**0
                      CONTENTS, READONLY, DEBUGGING
    
    Disassembly of section .text:
    
    00000000 <__vectors>:
       0:	0c 94 46 00 	jmp	0x8c	; 0x8c <__ctors_end>
       4:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
       8:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
       c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      10:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      14:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      18:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      1c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      20:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      24:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      28:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      2c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      30:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      34:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      38:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      3c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      40:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      44:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      48:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      4c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      50:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      54:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      58:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      5c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      60:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      64:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      68:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      6c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      70:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      74:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      78:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      7c:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      80:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      84:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
      88:	0c 94 66 00 	jmp	0xcc	; 0xcc <__bad_interrupt>
    
    0000008c <__ctors_end>:
      8c:	11 24       	eor	r1, r1
      8e:	1f be       	out	0x3f, r1	; 63
      90:	cf ef       	ldi	r28, 0xFF	; 255
      92:	d0 e1       	ldi	r29, 0x10	; 16
      94:	de bf       	out	0x3e, r29	; 62
      96:	cd bf       	out	0x3d, r28	; 61
    
    00000098 <__do_copy_data>:
      98:	11 e0       	ldi	r17, 0x01	; 1
      9a:	a0 e0       	ldi	r26, 0x00	; 0
      9c:	b1 e0       	ldi	r27, 0x01	; 1
      9e:	e0 e0       	ldi	r30, 0x00	; 0
      a0:	f1 e0       	ldi	r31, 0x01	; 1
      a2:	00 e0       	ldi	r16, 0x00	; 0
      a4:	0b bf       	out	0x3b, r16	; 59
      a6:	02 c0       	rjmp	.+4      	; 0xac <__do_copy_data+0x14>
      a8:	07 90       	elpm	r0, Z+
      aa:	0d 92       	st	X+, r0
      ac:	a0 30       	cpi	r26, 0x00	; 0
      ae:	b1 07       	cpc	r27, r17
      b0:	d9 f7       	brne	.-10     	; 0xa8 <__do_copy_data+0x10>
      b2:	1b be       	out	0x3b, r1	; 59
    
    000000b4 <__do_clear_bss>:
      b4:	11 e0       	ldi	r17, 0x01	; 1
      b6:	a0 e0       	ldi	r26, 0x00	; 0
      b8:	b1 e0       	ldi	r27, 0x01	; 1
      ba:	01 c0       	rjmp	.+2      	; 0xbe <.do_clear_bss_start>
    
    000000bc <.do_clear_bss_loop>:
      bc:	1d 92       	st	X+, r1
    
    000000be <.do_clear_bss_start>:
      be:	a0 30       	cpi	r26, 0x00	; 0
      c0:	b1 07       	cpc	r27, r17
      c2:	e1 f7       	brne	.-8      	; 0xbc <.do_clear_bss_loop>
      c4:	0e 94 68 00 	call	0xd0	; 0xd0 <main>
      c8:	0c 94 7e 00 	jmp	0xfc	; 0xfc <_exit>
    
    000000cc <__bad_interrupt>:
      cc:	0c 94 00 00 	jmp	0	; 0x0 <__vectors>
    
    000000d0 <main>:
    
    void delayms(uint16_t millis);
    
    
    int main(void) {
      DDRB |= 1<<PB0; // set PB0 to output 
      d0:	b8 9a       	sbi	0x17, 0	; 23
      while(1) {
        PORTB &= ~(1<<PB0); // LED on 
      d2:	c0 98       	cbi	0x18, 0	; 24
        delayms(100);
      d4:	84 e6       	ldi	r24, 0x64	; 100
      d6:	90 e0       	ldi	r25, 0x00	; 0
      d8:	0e 94 74 00 	call	0xe8	; 0xe8 <delayms>
        PORTB |= 1<<PB0; // LED off 
      dc:	c0 9a       	sbi	0x18, 0	; 24
        delayms(100);
      de:	84 e6       	ldi	r24, 0x64	; 100
      e0:	90 e0       	ldi	r25, 0x00	; 0
      e2:	0e 94 74 00 	call	0xe8	; 0xe8 <delayms>
      e6:	f5 cf       	rjmp	.-22     	; 0xd2 <main+0x2>
    
    000000e8 <delayms>:
        milliseconds can be achieved.
     */
    void
    _delay_loop_2(uint16_t __count)
    {
    	__asm__ volatile (
      e8:	20 ea       	ldi	r18, 0xA0	; 160
      ea:	3f e0       	ldi	r19, 0x0F	; 15
      ec:	04 c0       	rjmp	.+8      	; 0xf6 <delayms+0xe>
      ee:	f9 01       	movw	r30, r18
      f0:	31 97       	sbiw	r30, 0x01	; 1
      f2:	f1 f7       	brne	.-4      	; 0xf0 <delayms+0x8>
    
    
    void delayms(uint16_t millis) {
      while ( millis) {
        _delay_ms(1);
        millis--;
      f4:	01 97       	sbiw	r24, 0x01	; 1
    #include <avr/interrupt.h>
    #include <util/delay.h>
    
    
    void delayms(uint16_t millis) {
      while ( millis) {
      f6:	00 97       	sbiw	r24, 0x00	; 0
      f8:	d1 f7       	brne	.-12     	; 0xee <delayms+0x6>
        _delay_ms(1);
        millis--;
      }
    }
      fa:	08 95       	ret
    
    000000fc <_exit>:
      fc:	f8 94       	cli
    
    000000fe <__stop_program>:
      fe:	ff cf       	rjmp	.-2      	; 0xfe <__stop_program>
    
  • REKLAMA
  • REKLAMA
  • #3 6167481
    benedykt02
    Poziom 10  
    no racja, hehe, numerki mi sie pomieszaly,
    bo na poczatku probowalem z WinAVR-20081205
    wyniki niestety mialem takie same :(
  • REKLAMA
  • REKLAMA
  • Pomocny post
    #5 6167576
    BoskiDialer
    Poziom 34  
    Atmega128 - domyślnie sprzedawany z zaprogramowanym fusebitem ustawiającym tryb kompatybilności z m103 (bit m103c w efuse). To powoduje, że pamięć ram jest od końca ucięta (o 256 bajtów), a więc spód stosu jest uszkodzony. Wywołanie działa ok, ale powrót powoduje błędy (brak poprawnego adresu powrotu na stosie). Musisz zmienić ten bit w fusebitach, inaczej wszystko będzie się sypało.
  • #6 6167749
    benedykt02
    Poziom 10  
    tak właśnie myślałem, ze coś ze stosem musiało być.
    dzięki wielkie :)

    teraz wszystko działa poprawnie :)
REKLAMA