[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] Re: Unified ELF file [was: RE: [avr-chat] Re: GUI wra
From: |
Rick Altherr |
Subject: |
Re: [avr-libc-dev] Re: Unified ELF file [was: RE: [avr-chat] Re: GUI wrapper for avrdude] |
Date: |
Thu, 30 Aug 2007 09:23:56 -0700 |
On Aug 30, 2007, at 12:41 AM, Erik Christiansen wrote:
On Thu, Aug 30, 2007 at 04:55:02PM +1000, Erik Christiansen wrote:
On Thu, Aug 30, 2007 at 07:16:24AM +0200, Joerg Wunsch wrote:
If all else fails, we could still opt for differently named input
section (lfuse, hfuse, efuse), and combine them in the linker script
into one output section. Again, that would be similar to combining
.eeprom* input sections into just one .eeprom output section right
now.
Actually, I think that's neater, not least because the magic
addresses
are not seen in the assembler source, but reside only in the linker
script, where they belong.
The attached does it more neatly, doesn't it? :-)
Erik
P.S. If there's any assembler macro mucky-stuff left to do, I'm
available. (Week after next. :-)
<fuse_demo.s>
<fuse_demo.ld>
<fuse_demo.objdump>
<fuse_demo.map>
_______________________________________________
AVR-libc-dev mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev
I posted this to avr-libc-dev just a few days ago. I'm reposting it
to avr-chat since most of the discussion about this topic is
happening here.
Having had a bit of experience with the CONFIG bits in PIC
development, I was surprised to see that the FUSE and LOCK bits in
AVR weren't able to be set in the source code. A friend and I came
up with the following solution:
- Create a header file for each device that contain:
- A define that allocates an extra ELF section for the various
fuse and lock bits
- A set of defines that describe the various bits in the fuse and
lock bits
- A define for the default value described in the datasheet
- A set of Makefile rules that:
- Extract the new ELF sections into separate hex files
- Invoke avrdude with commands that program the lock and fuse
bits with the contents of the new sections
Here is an excerpt from the ATmega8's header file for HFUSE:
/* High Fuse Byte */
#define HFUSE const unsigned char hfuse __attribute__((section
(".hfuse")))
#define BOOTRST ~_BV(0)
#define BOOTSZ0 ~_BV(1)
#define BOOTSZ1 ~_BV(2)
#define EESAVE ~_BV(3)
#define CKOPT ~_BV(4)
#define SPIEN ~_BV(5)
#define WDTON ~_BV(6)
#define RSTDISBL ~_BV(7)
#define HFUSE_DEFAULT SPIEN & BOOTSZ1 & BOOTSZ0
The Makefile rules are a bit more complex since they are entwined
with a whole set of rules to reduce the amount of setup needed for
an AVR-based project. I've attached an example project that shows
these header files and Makefile rules in use. The use of the fuse
header is in example.c where LFUSE is set. To build it, put the
files from the header.tar.gz into the same directory as the I/O
definition headers. Then, in example.tar.gz, run 'make' to build
the software and 'make program' to write it to a device. To get
rid of all the generated files, run 'make clean'.
headers.tar.gz
Description: GNU Zip compressed data
example.tar.gz
Description: GNU Zip compressed data
Currently, we only have files for the ATmega8 and ATmega16. That's
mainly because those are the only 2 devices we have used this
with. It definitely makes keeping track of things like clock
configuration and watchdog timer enable easier as well as enables a
way for them to be included in a source repository.
--
Rick Altherr
address@hidden
"He said he hadn't had a byte in three days. I had a short, so I
split it with him."
-- Slashdot signature
smime.p7s
Description: S/MIME cryptographic signature
- RE: [avr-chat] Re: GUI wrapper for avrdude, (continued)
- RE: [avr-chat] Re: GUI wrapper for avrdude, Eric Weddington, 2007/08/27
- Re: [avr-chat] Re: GUI wrapper for avrdude, Joerg Wunsch, 2007/08/28
- Re: [avr-chat] Re: GUI wrapper for avrdude, Michael Hennebry, 2007/08/28
- RE: [avr-chat] Re: GUI wrapper for avrdude, Eric Weddington, 2007/08/28
- Re: [avr-chat] Re: GUI wrapper for avrdude, Joerg Wunsch, 2007/08/29
- Unified ELF file [was: RE: [avr-chat] Re: GUI wrapper for avrdude], Eric Weddington, 2007/08/29
- Re: Unified ELF file [was: RE: [avr-chat] Re: GUI wrapper for avrdude], Erik Christiansen, 2007/08/29
- Re: Unified ELF file [was: RE: [avr-chat] Re: GUI wrapper for avrdude], Joerg Wunsch, 2007/08/30
- Re: Unified ELF file [was: RE: [avr-chat] Re: GUI wrapper for avrdude], Erik Christiansen, 2007/08/30
- Re: Unified ELF file [was: RE: [avr-chat] Re: GUI wrapper for avrdude], Erik Christiansen, 2007/08/30
- Re: [avr-libc-dev] Re: Unified ELF file [was: RE: [avr-chat] Re: GUI wrapper for avrdude],
Rick Altherr <=
- RE: [avr-libc-dev] Re: Unified ELF file [was: RE: [avr-chat] Re: GUIwrapper for avrdude], Eric Weddington, 2007/08/30
- Re: [avr-libc-dev] Re: Unified ELF file [was: RE: [avr-chat] Re: GUIwrapper for avrdude], Rick Altherr, 2007/08/30
- Re: [avr-libc-dev] Re: Unified ELF file [was: RE: [avr-chat] Re: GUIwrapper for avrdude], Joerg Wunsch, 2007/08/31
- Re: [avr-libc-dev] Unified ELF file [was: RE: [avr-chat] Re: GUI wrapper for avrdude], Rick Altherr, 2007/08/30
- RE: [avr-chat] Re: GUI wrapper for avrdude, Michael Hennebry, 2007/08/30
- RE: [avr-chat] Re: GUI wrapper for avrdude, Michael Hennebry, 2007/08/30
- Re: [avr-chat] Re: GUI wrapper for avrdude, Clemens Koller, 2007/08/26
- Re: [avr-chat] Re: GUI wrapper for avrdude, Michael Hennebry, 2007/08/27
Re: [avr-chat] Re: GUI wrapper for avrdude, Vincent Trouilliez, 2007/08/26