AVR tool chain won't work for ATMega2560

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

 

I have built the AVR tool chain from sources on MacOSX and Sun Solaris (see below how). This used to work for ATMega8 projects. I purchased a ATMega2560 chip/board now. Replacing the the MMCU in Makefile with MMCU=atmega2560 did not do the trick. When I try to compile a little test program 

 

#define F_CPU 16000000UL  /* 16 MHz CPU clock */
#include "Global.h"
#include <util/delay.h>
#include <avr/io.h>
 

int main (void)
  {
   DDRB = 0xff;          // all outputs
   
      if ((PORTB & _BV(PB7)) > 0) PORTB &= ~_BV(PB7);
      else PORTB |= _BV(PB7);
      
      return (0);
  }

 

I get

 

...

main.c:1: error: MCU ‘atmega2560’ supported for assembler only

 

...

make: *** [toggle_led.out] Error 1

 

 

When I do "avr-gcc --target-help" I get 

 

atmega2560

avr6  - enhanced AVR core with up to 256K program memory

 

listed. However, make produces

 

avr-gcc -mmcu=atmega2560 -Wall -O2 -I /usr/local/avr/include -I./ -o toggle_led.out main.c 
unknown MCU 'atmega2560' specified
Known MCU names:
   avr2

   ...

 

a list with no avr6 or atmega2560 entry!? :-(

 

What am I doing wrong?

 

Thanks a lot,

 

 Andreas

 

**********************************************

We download http://ftp.gnu.org/gnu/binutils/...

 

    PREFIX=/usr/local/avr

    export PREFIX

    PATH=$PATH:$PREFIX/bin

    export PATH

 

    cd /usr/src

    mkdir avr

    cd avr

    scp ahoesch@192.168.1.7:/home/ahoesch/Downloads/binutils-2.24.tar.gz .

    gunzip binutils-2.24.tar.gz

    gtar xvf binutils-2.24.tar

    cd binutils-2.24

    ./configure --target=avr --program-prefix="avr-" --prefix=$PREFIX

    make

    make install

 

We download http://gcc.cybermirror.org/relea...

 

    cd /usr/src/

    gtar xvf mpfr-2.4.0.tar

    cd mpfr-2.4.0

    ./configure

    make

    make install

 

    cd /usr/src/avr

    mkdir avrgcc

    scp ahoesch@192.168.1.7:/home/ahoesch/Downloads/gcc-4.3.3.tar.bz2 .

    bunzip2 gcc-4.3.3.tar.bz2

    gtar xvf gcc-4.3.3.tar

    cd avrgcc

    ../gcc-4.3.3/configure --target=avr --prefix=/usr/local/avr --enable-languages=c --disable-libssp --disable-shared --disable-libada --disable-libssp --disable-nls --with-dwarf2 --with-gmp=/usr/local --with-mpfr=/usr/local --prefix=/usr/local/avr

    make 

    make install 

 

    pico /etc/default/login

    pico /etc/default/su

 

    PATH= ...:/usr/local/avr/bin

    SUPATH= ...:/usr/local/avr/bin

 

Relogin to get the new PATH value.

 

    which avr-gcc

 

We download http://download.savannah.gnu.org...

 

    cd /usr/src/avr

    scp ahoesch@192.168.1.7:/home/ahoesch/Downloads/avr-libc-1.8.1.tar.bz2 .

    bunzip2 avr-libc-1.8.1.tar.bz2

    gtar xvf avr-libc-1.8.1.tar

    cd avr-libc-1.8.1

    ./configure --host=avr --prefix=/usr/local/avr

    make

    make install

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

We download...

Sorry but why would you download such old and out of date code? Why not simply get:

 

http://www.atmel.com/tools/atmel...

 

That will give you a pre-built avr-gcc 4.8.1 and it most definitely works for ATmega2560.