I've been trying to compile(using Win AVR) the atmega8 bootloader source code that is located in the bootloader folder in the arduino hardware folder.But the code fails to fit into 1Kb ,it compiles to into anything more than 1088 bytes, and hence i'm unable to make it fit into 1Kb boot section of Atmega8.(i dont want to waste more than 1Kb on the boot code )
First things to do .. 8-) uninstall 2007xxxx WINAVR, and install old 20060421 and compile again..
compiled code from 20060421 is work well but weird result if compile on 2007xxxx.
I know this after lost time for weeks to find out the problem.
I think this problem cause from new 2007xxxx WINAVR internal optimization algorithm and boot library had changed .. then it's not work for arduino bootloader sourcecode.
C:\WinAVR-20070525/bin/avr-gcc -g -Wall -Os -mmcu=atmega8 -Datmega8 -DF_CPU=16000000 -DBAUD_RATE=9600 -c -o ATmegaBOOT.o ATmegaBOOT.c
In file included from ATmegaBOOT.c:39: c:/winavr-20070525/bin/…/avr/include/avr/delay.h:36:2: warning: #warning “This file has been moved to <util/delay.h>.”
C:\WinAVR-20070525/bin/avr-gcc -g -Wall -Os -mmcu=atmega8 -Datmega8 -DF_CPU=16000000 -DBAUD_RATE=9600 -Wl,-Map,ATmegaBOOT.map,–section-start=.text=0x1800 -o AT
megaBOOT.elf ATmegaBOOT.o
C:\WinAVR-20070525/bin/avr-objdump -h -S ATmegaBOOT.elf > ATmegaBOOT.lst
C:\WinAVR-20070525/bin/avr-objcopy -j .text -j .data -O ihex ATmegaBOOT.elf ATmegaBOOT.hex
C:\WinAVR-20070525/bin/avr-objcopy -j .text -j .data -O binary ATmegaBOOT.elf ATmegaBOOT.bin
C:\WinAVR-20070525/bin/avr-objcopy -j .text -j .data -O srec ATmegaBOOT.elf ATmegaBOOT.srec
C:\WinAVR-20070525/bin/avr-gcc -S -g -Wall -Os -mmcu=atmega8 -Datmega8 -DF_CPU=16000000 -DBAUD_RATE=9600 -g1 ATmegaBOOT.c
In file included from ATmegaBOOT.c:39: c:/winavr-20070525/bin/…/avr/include/avr/delay.h:36:2: warning: #warning “This file has been moved to <util/delay.h>.”
C:\WinAVR-20070525/bin/avr-size ATmegaBOOT.hex
text data bss dec hex filename
0 1088 0 1088 440 ATmegaBOOT.hex
Well, This is how I realized that the hex file was 1088 bytes.
The only change I made was changing the start address from 1c00 to 1800 in the make file in order to get the bootloader compiled (with 1c00, it was giving a compilation error)
@worapoht, Can you please point me to the right avr-gcc download on net. I’ll try using it once.