Makefile support for <avr/fuse.h>

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have the following Makefile extension sitting on my disk for a few weeks now. Maybe it is of help for some others.

The file contains make targets to make use of the avr-libc 1.6 feature to be able to specify the fuse settings in the C code http://www.nongnu.org/avr-libc/u...

The targets are supposed to be added to an mfile generated Makefile or mfile's makefile_template. They are:

show-fuse - (non-destructive)
Shows the actual, current fuse settings of the AVR (hex values). This make target is independent of avr-libc 1.6.

cmp-fuse - (non-destructive)
Lists side-by site the actual fuse settings (read from the AVR), and the ones defined in the C code.

program-fuse - (potentially destructive)
This target attempts to programs the fuse values as defined in the C source into the AVR. All the usual things can happen when programming the fuses.

Examples:

$ make show-fuse
Current fuse values of target atmega8 at /dev/ttyS0
fuse: "fuse" memory type not defined for part "ATMEGA8"
lfuse: 0xef
hfuse: 0xd9
efuse: "efuse" memory type not defined for part "ATMEGA8"
$ make cmp-fuse
"fuse" memory type not defined for part "ATMEGA8"
"efuse" memory type not defined for part "ATMEGA8"

        Device  main.elf
fuse:
lfuse:  0xef    0xef
hfuse:  0xd9    0xd9
efuse:
$ make program-fuse
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9307
avrdude: reading input file "0xef"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xef:
avrdude: load data lfuse data from input file 0xef:
avrdude: input file 0xef contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xd9"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xd9:
avrdude: load data hfuse data from input file 0xd9:
avrdude: input file 0xd9 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

The usual warranty applies: NO WARRANTY. Use at your own risk.

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Very nice!

Would you be willing to add this to a Feature Request Tracker at the WinAVR Project?:
https://sourceforge.net/tracker/...

That way this won't get lost. I'd like to add this to the WinAVR Makefile Template if you are willing to put it in the Public Domain.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

EW wrote:
Would you be willing to add this to a Feature Request Tracker at the WinAVR Project?:
https://sourceforge.net/tracker/...

I tried, but I don't have a sourceforge account. And while creating one it occurred to me that the extensions might not be very useful for WinAVR, because I expect a Linux environment. In particular awk and a shell environment.

I'd suggest someone who has a sourceforge account and who can judge if the makefile targets can be ported to Windows should create the request.

Quote:
I'd like to add this to the WinAVR Makefile Template if you are willing to put it in the Public Domain.
Sure. I hereby place the file into the Public Domain.

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

WinAVR includes bash and gawk. So, it should still work for WinAVR. ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Arnold,
I think you have the solution for the problem I am actually facing - trying to get the fuse-bytes out of the elf-file for flashing with AVRDude....where can I find the makefile you wanted to provide in Public-domain?
thanks and best regards
Thorsten

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

where can I find the makefile you wanted to provide in Public-domain?

Arnold wrote:

The targets are supposed to be added to an mfile generated Makefile or mfile's makefile_template.

If you are on Windows and have WinAVR installed then you also have Mfile and it's template. For GNU/Linux et al I'd probably go here: http://www.sax.de/~joerg/mfile/

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

WTF? The changes were once attached to the original posting. No idea what happened to that posting.

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!
Ah - thank you very much.....will look into the mfile and change it to my needs....
thanks and best regards
Thorste