taskAVR Downloader/UploaDEr - Tasks: task #5093, Add support for reading ELF files.

 
 

You are not allowed to post comments on this tracker with your current authentification level.

task #5093: Add support for reading ELF files.

Submitted by:  Eric Weddington <arcanum>
Submitted on:  Mon 02 Jan 2006 06:13:16 PM UTC  
Votes:  10  
 
Should Start On: Mon 02 Jan 2006 07:00:00 AM UTCShould be Finished on: Mon 02 Jan 2006 07:00:00 AM UTC
Category: NonePriority: 5 - Normal
Status: DonePrivacy: Public
Percent Complete: 0%Assigned to: Colin O Flynn <c_oflynn>
Open/Closed: ClosedEffort: 0.00

Thu 01 Nov 2012 09:02:00 AM UTC, comment #4:

See also patch #7314 "detect ELF and COFF files and reject flashing them"

>> ELF file reading has finally been implemented (SVN r1056). This will become part of AVRDUDE version 6.

Rene Liebscher <rliebscher>
Project Member
Mon 07 May 2007 08:16:59 PM UTC, comment #3:

Attached (the 20070507 patch file) has a patch for the linker scripts in binutils, as well as the files for adding this feature to avrdude. The files changed a bit since my last update, most (all?) of the changes are just the libbfd_io.c and libbfd_io.h, I don't think I changed anything else... but included the patch anyway.

Check to work with Mega128 128 KB, and does work with lfuse/hfuse/efuse memory spaces.

I'd like to see this get into CVS, as it would add ELF support to avrdude.

Before doing this I'd need to (a) make sure it looks OK, and (b) add the needed libraries to the configure script, they are still hardcoded in the Makefile.am... and I'm not sure how to do the configure script!

(file #12714)

Colin O Flynn <c_oflynn>
Project MemberIn charge of this item.
Thu 03 May 2007 04:51:57 PM UTC, comment #2:

Here is a patch that makes this work with avrdude.

To use:

-Apply elfsupport.patch
-Drop libbfd_io.c and libbfd_io.h into avrdude directory
(these are updated from the ones in the .tar.gz, so don't use the old ones!)
-./configure && make && make install

You now have support in the -U option to do stuff like:

-U flash:w:main.elf

And it will write the flash from the main.elf file. I've tested it a little bit - if I write with an ELF file, I can verify it with a .hex or other "known good" file. So the same data seems to get programmed in...

I haven't tested fuses yet or other memory types, and I'd like someone to test what happens with big AVR devices. I think that will be broken perhaps....

As well - this requires -lbfd and -liberty libraries linked in. Right now I hard coded them in the Makefile.am file, as I don't know how to edit the configure file properly.

Reading from AVR to an ELF file is NOT supported yet.

(file #12678, file #12679, file #12680)

Colin O Flynn <c_oflynn>
Project MemberIn charge of this item.
Mon 19 Mar 2007 04:52:41 PM UTC, comment #1:

NOTE: Originally updated on
2007-03-12 but changes seem to have dissappeared... assume due to disk crash on Savannah.

To test with the attached:

extract anywhere. Copy avrdude.h into that folder too, that's the only avrdude file it uses yet.

make -f make_libbfdtest
cd testfile
make
cd ..
cp testfile/main.elf testavr.elf
./libfdtest

If any of the sections don't exist (check by changing the main.c in testfile
directory, remove lfuse for example) it will return size of -1.

For the curious:

[colin@colin moretest]$ ./libbfdtest
Opening testavr.elf....SUCCESS
Size of .text: 2996
Size of .eeprom: 0
Size of .lfuse: 1
Size of .hfuse: 1
Size of .efuse: 1

Some data from section .text: C 94 2A 0 C
Some data from section .lfuse: FF
Some data from section .hfuse: 2
Some data from section .efuse: A4
testavr: Section .lfuse exists.
testavr: Section .hfuse exists.
testavr: Section .efuse exists.
testavr: Section .text exists.
testavr: Section .text starts at 0 and has size 2996
testavr: Section .text being added to FLASH image.
testavr: Section .data exists.
testavr: Section .data starts at 2996 and has size 4
testavr: Section .data being added to FLASH image.
testavr: Section .bss exists.
testavr: Section .noinit exists.
testavr: Section .eeprom exists.
testavr: Section .stab exists.
testavr: Section .stabstr exists.
Closing testavr.elf....SUCCESS

(file #12214)

Colin O Flynn <c_oflynn>
Project MemberIn charge of this item.
Mon 02 Jan 2006 06:13:16 PM UTC, original submission:

Add support for reading ELF files only.

Use libbfd from the GNU Binutils project to read the various segments within an AVR ELF file.

In any AVR source code, one can do this:
const unsigned char lfuse _attribute_((section (".lfuse"))) = 0xAA;
const unsigned char hfuse _attribute_((section (".hfuse"))) = 0x55;
const unsigned char efuse _attribute_((section (".efuse"))) = 0xFF;

Which would allow fuse bytes to be embedded in the AVR ELF file, with each fuse byte within their own named segment (i.e. .lfuse, .hfuse, .efuse).

With these additions, the ELF file can be a single file that has all the data needed to program all parts of an AVR: Flash, EEPROM, and fuses. This would allow users to easily automate the AVR programming process within a production environment by having all data within one file and a simplified command line.

Eric Weddington <arcanum>
Project Member

 

Attached Files
file #12714:  20070507elfpatch.tar.gz added by c_oflynn (4kB - application/x-gzip)
file #12678:  elfsupport.patch added by c_oflynn (5kB - text/x-patch)
file #12679:  libbfd_io.h added by c_oflynn (2kB - application/octet-stream)
file #12680:  libbfd_io.c added by c_oflynn (7kB - text/x-csrc)
file #12214:  libbfd_test.c.tar.gz added by c_oflynn (43kB - application/x-gzip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rliebscher (Posted a comment)
  • -unavailable- added by petrh (gotta watch this, I submited similar patch: detecting an ELF)
  • -unavailable- added by petrh (Voted in favor of this item)
  • -unavailable- added by kc8apf
  • -unavailable- added by c_oflynn (Updated the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 10 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 12 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 01 Nov 2012 09:02:00 AM UTCrliebscherStatusNone=>Done
      Open/ClosedOpen=>Closed
    Wed 25 May 2011 08:12:39 PM UTCpetrhCarbon-Copy-=>Added -unavailable-
      Carbon-Copy-=>Added petrh
    Thu 15 Nov 2007 04:27:20 AM UTCkc8apfCarbon-Copy-=>Added kc8apf
    Mon 07 May 2007 08:16:59 PM UTCc_oflynnAttached File-=>Added 20070507elfpatch.tar.gz, #12714
      Carbon-Copy-=>Added -unavailable-
    Thu 03 May 2007 04:51:57 PM UTCc_oflynnAttached File-=>Added elfsupport.patch, #12678
      Attached File-=>Added libbfd_io.h, #12679
      Attached File-=>Added libbfd_io.c, #12680
    Mon 19 Mar 2007 04:52:41 PM UTCc_oflynnAttached File-=>Added libbfd_test.c.tar.gz, #12214
    Sun 11 Mar 2007 06:16:28 PM UTCc_oflynnAssigned toNone=>c_oflynn

    Back to the top


    Powered by Savane 3.1-cleanup