The ELF file under usage is to be in correct format to program the device else it may end-up in unsuccessful programming. The Executable and Linkable Format (ELF) files are generated in two ways. One way to generate it through AVR Studio and the other is through some compilers like WinAVR.
The difference is when you generate it in AVR Studio you can save the file with data like EEPROM, FLASH, FUSE SETTINGS and LOCK BITS. But the same ELF file, if it is generated through compiler then it contains debugging with source code property along with all we mentioned before. The generated ELF file can be specified as input to the programming dialog so that all contents of the file is programmed in one operation.
Ensure that you are using the latest version of WinAVR and AVR Studio. There are some issues in WinAVR releases prior to 2007-01-02 and the elf file is supported only from AVR Studio 4.13 SP2 (12/2007) version.
It is important to ensure the procedure followed to generate/create the ELF file and step by step procedure involved in programming the same on to the device is correct.
ELF file generation through AVR Studio:
Prior to creating the ELF file, the FLASH and EEPROM contents must be specified and the fuses and lockbits must be configured. Specify the FLASH and EEPROM input HEX files on the Program tab.
As Flash and EEPROM are Non-Volatile memories, there will be some data previously written on it. After programming the verification process is done on matching the current data in the memory with the files you mentioned to program. It is to ensure that the file specified is correctly loaded into the device.
If there is no EEPROM File available to select, then read it from the device by clicking the "Read" button in EEPROM Frame and save it. Then while generating the ELF file select the same file as EEPROM file.
Make sure the input .hex and/or .eep files are specified in Flash and EEPROM frames of the 'Program' Tab.
Make sure the 'Program', 'Fuses' and 'LockBits' tabs are visited once and the configurations are set as per the requirements.
After following the sequence mentioned above, the 'Program' Tab is visited again to generate the ELF file in correct format. Back on the Program tab, press the "Save" to ELF button to generate the ELF file.
The generated ELF file can be specified as input to the programming dialog so that all contents of the file is programmed in one operation. Please refer to the details in AVR Studio Help in 'Programming Dialog' under section 'Program Tab' for more information on ELF file generation.
ELF file generation through Atmel Studio 6.2 :
Prior to creating the ELF file, the FLASH and EEPROM contents must be specified and the fuses and lockbits must be configured. Specify the FLASH and EEPROM input HEX files on the Device programming window under the Memory, Fuses, Lock bits.
Refer the attachment ( Atmel Studio 6.2 production file_elf file generation and programming.jpg ) to creating elf file in Atmel Studio 6.2.
Note:- Elf file generation and programming in Atmel Studio 6.2 does not support hex files which contains more than one section.
Programming of ELF file on AVR devices:
Programming the ELF file can be done in two ways either by GUI(AVR Studio IDE) or Commandline.
AVR Studio IDE(GUI):
In the Programming window specify the file name in the 'Input ELF File' edit box or browse for the file, then press 'Program'.
Atmel Studio 6.2 IDE(GUI):
Refer the attachment (Atmel Studio 6.2 production file_elf file generation and programming.jpg) to programming the elf file in Atmel Studio 6.2.
In commandline programming the STK500.exe,STK600.exe and jtagiceii.exe do programming of .elf file on the supported AVR devices. The user can go to the path of the respective tool he is using and select appropriate tools' .exe file to communicate with the device.
For the ELF file format programming on Commandline prompt please follow the command below:
Stk500.exe -dATmega64 -ipfilename.elf -pa
For more details on command line programming please refer the FAQ
1, Command line Programming --- > ( http://atmel.force.com/support/articles/en_US/FAQ/Command-Line-Programming?q=Command+Line+Programming&l=en_US&fs=Search&pn=1)
2, Commandline utility for STK500 and AVRISP mkII
---> ( http://atmel.force.com/support/articles/en_US/FAQ/Commandline-utility-for-STK500-and-AVRISP-mkII?q=Commandline+utility+for+STK500+and+AVRISP+mkII&l=en_US&fs=Search&pn=1