[En-Nut-Discussion] Dev on Debian

Olaf Rempel olaf.rempel at freenet.de
Tue Aug 5 23:43:13 CEST 2003


Hi,

> Drop me a note if it is working for you.
I think the problem is not (or not only) the binutils/gcc/avr-libc combo.

As a test I modified the app/simple.c:
#include <avr/io.h>
int main(void)
{
    for(;;);
}

and it´s Makefile (so it´s no longer use the nut-libarys):
#LIBS =  $(LIBDIR)/nutinit.o -lnutos -lnutdev

the resulting binary (after a make clean && make):

coruscant ~/nut-3.2.1/app/simple # avr-objdump -b ihex -m avr -D simple.hex
...
00000000 <.sec1>:
   0:   0c 94 46 00     jmp     0x8c
   4:   0c 94 63 00     jmp     0xc6
...
  88:   0c 94 63 00     jmp     0xc6
  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
  98:   11 e0           ldi     r17, 0x01       ; 1
  9a:   a0 e0           ldi     r26, 0x00       ; 0
  9c:   b1 e0           ldi     r27, 0x01       ; 1
  9e:   e4 ed           ldi     r30, 0xD4       ; 212
  a0:   f0 e0           ldi     r31, 0x00       ; 0
  a2:   00 e0           ldi     r16, 0x00       ; 0
  a4:   0b bf           out     0x3b, r16       ; 59
  a6:   02 c0           rjmp    .+4             ; 0xac
  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
  b2:   11 e0           ldi     r17, 0x01       ; 1
  b4:   a0 e0           ldi     r26, 0x00       ; 0
  b6:   b1 e0           ldi     r27, 0x01       ; 1
  b8:   01 c0           rjmp    .+2             ; 0xbc
  ba:   1d 92           st      X+, r1
  bc:   a0 30           cpi     r26, 0x00       ; 0
  be:   b1 07           cpc     r27, r17
  c0:   e1 f7           brne    .-8             ; 0xba
  c2:   0c 94 00 00     jmp     0x0
  c6:   0c 94 00 00     jmp     0x0
  ca:   cf ef           ldi     r28, 0xFF       ; 255
  cc:   d0 e1           ldi     r29, 0x10       ; 16
  ce:   de bf           out     0x3e, r29       ; 62
  d0:   cd bf           out     0x3d, r28       ; 61
  d2:   ff cf           rjmp    .-2             ; 0xd2

jmp in address 0xc2 should be a "jmp 0xca", not "jmp 0x00".
the controller will never run the application-code.


same source-file, compiled by hand:
coruscant ~/nut-3.2.1/app/simple # avr-gcc -mmcu=atmega128 -Wall simple.c -o
simple.o
coruscant ~/nut-3.2.1/app/simple # avr-objcopy -I elf32-avr -O ihex simple.o
simple.hex
coruscant ~/nut-3.2.1/app/simple # avr-objdump -b ihex -m avr -D simple.hex
...
  c0:   e1 f7           brne    .-8             ; 0xba
  c2:   0c 94 65 00     jmp     0xca
  c6:   0c 94 00 00     jmp     0x0
  ca:   cf ef           ldi     r28, 0xFF       ; 255
...
controller can reach the application-code.


Is this the problem with the self-compiled gcc? can anybody check this?

I´ve used the snapshots from the avr-libc site and the latest cvs versions,
both worked
without problems on my gentoo-linux system.

Olaf




More information about the En-Nut-Discussion mailing list