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

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

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


From: Blake Leverett
Subject: Re: [avr-gcc-list] stumped by my ATmega48 (again)
Date: Fri, 5 Oct 2007 05:41:49 -0600
User-agent: KMail/1.9.7

What version of GCC are you using?  Where did it come from?  And was the 
toolchain compiled with the latest patches?  The Mega48 needs a toolchain 
with the latest patches.

Also, you could create a listing file to see what the compiler is doing.

Blake


On Thursday 04 October 2007, address@hidden wrote:
> 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






reply via email to

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