avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] stumped by my ATmega48 (again)


From: joe
Subject: [avr-gcc-list] stumped by my ATmega48 (again)
Date: Thu, 4 Oct 2007 22:25:15 -0600

Hi all,

I thought I was getting the hang of this Atmel programming, but after
dusting things off a bit, I'm stumped again.  I have a demo program
from Matthew MacClary at Oregon State that toggles all output pins
every three seconds.  Pin 15 is hooked up to an LED on my breadboard,
and when I install his prebuilt .hex file, the LED lights right up and
does its thing.

But when I build the same source and then install my hex file, the LED
never lights up.

To try to isolate the problem, I reduced the main program to just this:

        DDRB = 0xff;
        DDRC = 0x7f; /* PORTC has only 7 pins */
        DDRD = 0xff;

        PORTB = 0xff;
        PORTC = 0x7f;
        PORTD = 0xff;
        return 0;               /* PATCH for testing!  */

I believe this should set all output pins high.  But again, when I
build and install this, nothing; the LED doesn't light up.  Then I
tried setting all ports to 0x00, but that didn't work either.

I'm really stumped here -- such a trivial program shouldn't depend on
any libraries or whatnot.  And I'm pretty sure the compiler itself
works, because I successfully built a number of much more complex
Orangutan programs a while back.  I'm using the same compile command
that Matthew suggests in his comments:

$ avr-gcc -g -Wall -pedantic -Os -mmcu=atmega48 -c -o main.o main.c
$ avr-gcc -I -g -Wall -pedantic -Os -mmcu=atmega48 -Wl,-Map,main.map -o
main.elf main.o
$ avr-objcopy -j .text -j .data -O ihex main.elf main.hex

..but I get a smaller .hex file than he supplied.  Clearly something's
different with my setup, but what would cause such a simple program to
fail?

Thanks,
- Joe

--
Joe Strout -- address@hidden
Strout Custom Solutions, LLC





reply via email to

[Prev in Thread] Current Thread [Next in Thread]