what is LDSECTION and how do I determine it's val

I am trying to determine what the LDSECTION value should be for my MCU (atmega640). I cannot find how it is calculated, or where it is found.

this is the coorect value for the atmega168 as it is found in the makefile. LDSECTION = --section-start=.text=0x3800

any help would be greatly appreciated.

Are you trying to write a bootloader? It looks like the --section-start parameter specifies the bootloader start address.

You'll have to read the Bootloader Support sections of the ATmega640 datasheet to see where the bootloader start address should be. Multiply this address by 2 since the linker uses byte addresses but the Atmel datasheet usually specify word addresses.

For example, the ATmega168 bootloader (1024 words) starts at 0x1C00, so 0x1C00*2 ==> 0x3800.

ITS ALIVE!!! thanks a ton. I now have a atmega640 working under a atmega640 mcu!!! I knew I was looking in the right place in the data sheet I just didn't realize I had to multiply by two.