[RESOLVED!] Modify adaboot for ATmega1284P

Hi, I just got 2 Atmega128P as samples from Atmel.
I was wondering if ADABOOT can be adapted for the 1284P since it already support the 644P (used by Sanguino project).

I tried to modify latest ADABootLoaderR3_9D15 myself, basically I added || defined(__AVR_ATmega1284P__) in the same #elif of 644P except for the signature section.
However isn't working (no led flashes) :frowning:

I figured out that maybe the problem was "simply" the different LDSECTION value in the Makefile that needs to be changed for the 1284P.
So, as the datasheet say, for a boot size of 1024 words (2kbytes) the boot reset address is 0xFC00 then the LDSECTION will be LDSECTION = --section-start=.text=0x1F800 (0xFC00 x 2 = 0x1F800)
The value of 1F800 is even confirmed calculating it starting from the flash size (128k = 131072 bytes - 2048 bytes = 129024 bytes = 0x1F800)
However using 0x1F800 give me this error:

Max:Yrouel$ make atmega1284p
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-gcc -g -Wall -O2 -mmcu=atmega1284p -DF_CPU=16000000L   '-DMAX_TIME_COUNT=F_CPU>>6' '-DBAUD_RATE=57600' '-DADABOOT=4' '-DWATCHDOG_MODS'   -c -o ATmegaBOOT_168.o ATmegaBOOT_168.c
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-gcc -g -Wall -O2 -mmcu=atmega1284p -DF_CPU=16000000L   '-DMAX_TIME_COUNT=F_CPU>>6' '-DBAUD_RATE=57600' '-DADABOOT=4' '-DWATCHDOG_MODS' -Wl,--section-start=.text=0x1F800 -o ADABoot_1284p.elf ATmegaBOOT_168.o 
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld: address 0x2000e of ADABoot_1284p.elf section .text is not within region text
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld: address 0x2000e of ADABoot_1284p.elf section .text is not within region text
make: *** [ADABoot_1284p.elf] Error 1
rm ATmegaBOOT_168.o

Here the files I'm using:
Makefile
Modified source (diff with the original)

RESOLVED: I modified the optimization from -O2 to -Os and NO ERRORS! and now the bootloader is working (led flashes correctly) :smiley:

Did I understand right? You got the 1284p fully working with IDE?

If so, please repost links.... they don't ork any more....

Please!

Thank you!
ChrisS

How did you get the sample from them i have had no luck.