Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
katte
PostPosted: Jun 24, 2009 - 11:28 AM
Rookie


Joined: Nov 23, 2007
Posts: 35


Hi all..
I've used lock.h and fuse.h for include fuse configuration in my c code.

Code:

#if defined A   
  FUSES = {
    .low = 0xFF,
    .high = (FUSE_SPIEN & FUSE_JTAGEN & FUSE_OCDEN),
    .extended = 0xFF,};
  LOCKBITS = (LB_MODE_1 & BLB0_MODE_1 & BLB1_MODE_1);
#elif defined B
  FUSES = {
    .low = 0xFF,
    .high = (FUSE_SPIEN),
    .extended = 0xFF,};
  LOCKBITS = (LB_MODE_3 & BLB0_MODE_1 & BLB1_MODE_1);
#else
...


Ok. now I want to program all with avrdure. I use a terminal string like this
Code:

avrdude -patmega644p -cavrisp2 -Pusb -e -V -u -Uflash:w:file.elf -Ueeprom:w:file.elf -Uhfuse:w:file.elf -Ulfuse:w:file.elf -Uefuse:w:file.elf -Ulock:w:file.elf


No problem for flash, eeprom and lock area, but avrdude makes error when programming fuses.
The problem is that the area in the elf file is called only fuse, but avrdude wants hfuse, lfuse and efuse.

Code:

avrdude man pages
-U memtype:op:filename[:format]
                   Perform a memory operation as indicated.  The memtype field
                   specifies the memory type to operate on.  The available
                   memory types are device-dependent, the actual configuration
                   can be viewed with the part command in terminal mode.  Typ‐
                   ically, a device’s memory configuration at least contains
                   the memory types flash and eeprom.  All memory types cur‐
                   rently known are:
                   calibration  One or more bytes of RC oscillator calibration
                                data.
                   eeprom       The EEPROM of the device.
                   efuse        The extended fuse byte.
     
             flash        The flash ROM of the device.
                   fuse         The fuse byte in devices that have only a sin‐
                                gle fuse byte.
                   hfuse        The high fuse byte.
                   lfuse        The low fuse byte.
                   lock         The lock byte.
                   signature    The three device signature bytes (device ID).


There is a workaround for this?
Or the only solution is to make a script that extract the fuse area with
Code:

avr-objdump -d -S -j.fuse file.elf
file.elf:     file format elf32-avr
Disassembly of section .fuse:
00820000 <__fuse>:
  820000:   ff 1f ff

and store single byte in variables and finally pass there to avrdude?

Thanks in advance.
 
 View user's profile Send private message  
Reply with quote Back to top
dl8dtl
PostPosted: Jun 24, 2009 - 12:12 PM
Raving lunatic


Joined: Dec 20, 2002
Posts: 7376
Location: Dresden, Germany

AVRDUDE currently does not read ELF files. You have to extract the
respective contents into e.g. an intel hex file first, using
avr-objcopy.

_________________
Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.
Please read the `General information...' article before.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
katte
PostPosted: Jun 24, 2009 - 01:38 PM
Rookie


Joined: Nov 23, 2007
Posts: 35


dl8dtl wrote:
AVRDUDE currently does not read ELF files. You have to extract the
respective contents into e.g. an intel hex file first, using
avr-objcopy.


This is not completely exact because if you pass to avrdude an elf file, avrdude program the device and recognise the correct area exept for the fuse area..
However for now I will use avr-objcopy for extract fuse information.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jun 24, 2009 - 01:53 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 71738
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

This is not completely exact because

You do know who Jörg is don't you? (maybe check the avrdude source or manual)

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
katte
PostPosted: Jun 24, 2009 - 02:06 PM
Rookie


Joined: Nov 23, 2007
Posts: 35


clawson wrote:
Quote:

This is not completely exact because

You do know who Jörg is don't you? (maybe check the avrdude source or manual)


I'm sorry, I did not want to disrespect.

But I've tryed to pass an elf file to avrdude and it works. I thought that was supported.
This is the reason for my "This is not completely exact because " sentence.
 
 View user's profile Send private message  
Reply with quote Back to top
dl8dtl
PostPosted: Jun 24, 2009 - 03:51 PM
Raving lunatic


Joined: Dec 20, 2002
Posts: 7376
Location: Dresden, Germany

> But I've tryed to pass an elf file to avrdude and it works.

It depends from your definition of "it works".

It will simply not recognize the file format at all, and fall back
to "binary", programming the plain ELF file into your flash ROM.
If the ELF file is short enough to fit, yes, it will also write
the fuse section. ;-)

I'm not sure this is what you had in mind though...

_________________
Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.
Please read the `General information...' article before.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits