avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Re: Device fuses


From: Ned Konz
Subject: [avr-gcc-list] Re: Device fuses
Date: Sat, 22 Apr 2006 10:09:54 -0700


On Apr 21, 2006, at 11:18 PM, Björn Haase wrote:

"Anton Erasmus" <address@hidden> 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 ' ')

--
Ned Konz
MetaMagix embedded consulting
address@hidden






reply via email to

[Prev in Thread] Current Thread [Next in Thread]