avrdude-dev
[Top][All Lists]
Advanced

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

Re: [avrdude-dev] Modify avrdude to accept new programmer?


From: Kevin Cuzner
Subject: Re: [avrdude-dev] Modify avrdude to accept new programmer?
Date: Wed, 17 Jul 2013 23:36:43 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7

Hi,

I just recently finished my own addition to avrdude.

The programmer is basically a struct with a bunch of function pointers.
When you select a programmer type, a specific "init" function is called
which populates all of the function pointers to be specific to that
programmer type. So, if you wanted to create your own programmer type,
you would need to implement the required functions for that "interface".

As for actually programming the device, avrdude seems to call the a
couple of the following functions on the programmer "interface" that I
mentioned above:

 - PROGRAMMER->initialize
 - PROGRAMMER->enable
 - PROGRAMMER->program_enable (this one I missed at first...and its
important)
 - PROGRAMMER->cmd

It also calls several more commands...I looked at the usbasp programmer
and the linuxgpio programmer and used lots of printf's to figure out
exactly what was being called. Now, in terms of exactly what gets sent
when, PROGRAMMER->cmd is the important one...avrdude will give the
commands to the programmer 4 bytes at a time along with a buffer to fill
with whatever was received through that function. The internal program
deals with loading the hex files, figuring out what type of device it is
talking to, and figuring the commands to actually send. All the
programmer object does is act as the intermediary to the hardware.

TPI has its own interface as well...if you look through some of the
other programmer types that support it, you are bound to see it
referenced somewhere.

For a demonstration of what I did to add my programmer, take a look at
the commits for May 27th, 2013 here:
https://github.com/kcuzner/avrdude/commits/master/avrdude. You can see
the process I had to go through to add a new programmer type and make it
show up in all the menus and stuff.

- Kevin Cuzner




reply via email to

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