Arduino Forum

Forum 2005-2010 (read only) => Software => Development => Topic started by: sonictj on Jul 06, 2009, 07:33 am

Title: what is LDSECTION and how do I determine it's val
Post by: sonictj on Jul 06, 2009, 07:33 am
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.
Title: Re: what is LDSECTION and how do I determine it's val
Post by: RuggedCircuits on Jul 06, 2009, 09:07 am
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.
Title: Re: what is LDSECTION and how do I determine it's val
Post by: sonictj on Jul 06, 2009, 10:52 am
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.