On Apr 23, 2006, at 2:08 PM, Anton Erasmus wrote:
On 22 Apr 2006 at 10:09, Ned Konz wrote:
On Apr 21, 2006, at 11:18 PM, Björn Haase wrote:
"Anton Erasmus" <[EMAIL PROTECTED]> wrote:
Wouldn't it be worthwhile to add a method of specifying device
fuses
in the C or assembler source file ?
I think something similar to the way the EEPROM and PROGRAM
memory is
handled.
something like:
That would not be difficult at all. One could agree on the name of
some
section that contains data for the fuses and the lock-bits. One
would do
something like:
#define SET_FUSE_BITS(F1,F2,F3,L) unsigned char fuses[4]
__attribute___
((section (".fuses"))) = {F1,F2,F3,L};
The more time-consuming thing would be to teach your favorite
programming tool
to actually use the data in the .elf file.
Not at all...
#!/bin/bash
myprogram=$1; shift
avr-objcopy -j .fuses -O binary ${myprogram} fuses.bin
avrdude -p atmega128 -U lfuse:w:m:$(od -A n -t x1 -j 0 -N 1 fuses.bin
| tr -d ' ')
avrdude -p atmega128 -U hfuse:w:m:$(od -A n -t x1 -j 1 -N 1 fuses.bin
| tr -d ' ')
avrdude -p atmega128 -U efuse:w:m:$(od -A n -t x1 -j 2 -N 1 fuses.bin
| tr -d ' ')
avrdude -p atmega128 -U lock:w:m:$(od -A n -t x1 -j 3 -N 1 fuses.bin
| tr -d ' ')
This is excellent. I think adding definitions for the various fuses
for the various device
types in the io header files + some docs on how to use it, would
make life a lot easier.
It seems that you are already using this approach. Have you defined
macros that helps
in generating the correct fuse values ?
No, it just occurred to me that it would be easy to do.
I'd enjoy seeing a good way to do it; I'd probably use C++ templates
since I'm using them for everything else (it's a great way to get
small code!).
--
Ned Konz
[EMAIL PROTECTED]
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list