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

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

[avr-gcc-list] Machine Readable Fuse Database


From: Paul \"LeoNerd\" Evans
Subject: [avr-gcc-list] Machine Readable Fuse Database
Date: Sat, 16 Jul 2016 14:33:52 +0100

I'm looking for some sort of machine-readable database (in whatever
format - XML, CSV, some custom text thing; I really don't care)
containing all the default fuse values for AVR chips (or, at least,
ATmega and ATtiny).


The reason being I've written myself a nice program for helping set
fuse values. Tell it the MCU type and values for all the fuses, and it
prints out an avrdude commandline fragment to set those:

 $ avr-fuses -mtiny84a SELFPRGEN=0 RSTDISBL=1 DWEN=1 SPIEN=0 WDTON=1 \
    EESAVE=0 BODLEVEL=DISABLED CKDIV8=1 CKOUT=1 \
    SUT_CKSEL=INTRCOSC_8MHZ_6CK_14CK_64MS_DEFAULT

 -U efuse:w:0xFE:m -U hfuse:w:0xD7:m -U lfuse:w:0xE2:m

This is great and all, but it's inconvenient to use as you have to tell
it *all* the fuse values, even the ones that are default on a chip. It
would be great if I could just

 $ avr-fuses -mtiny84a EESAVE=0

and have it Do The Right Thing.


The reason this is so, is because I'm using the "devices" XML files
that are supplied with Atmel Studio to get the fuse values from. Those
give the name, value and mapping location of every fuse, but don't
supply the default values.

I notice that the AVR libc per-part .h files do know these values, in a
way.

 $ grep FUSE_DEFAULT /usr/lib/avr/include/avr/iotn84a.h
 #define LFUSE_DEFAULT (FUSE_CKSEL0 & FUSE_CKSEL2 & FUSE_CKSEL3 & \
   FUSE_SUT0 & FUSE_CKDIV8)
 #define HFUSE_DEFAULT (FUSE_SPIEN)
 #define EFUSE_DEFAULT (0xFF)

It's not *directly* useable as it is, but a C program could read those.
So technically I could iterate all the .h files and extract default
values that way. But it feels like quite a long way around.

Does anyone know of a better source of these?

-- 
Paul "LeoNerd" Evans

address@hidden      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Attachment: pgpMymjbBW0W5.pgp
Description: OpenPGP digital signature


reply via email to

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