Submitted by Juergen Weigert:
patch #7056: adding support for mikrokopter bootloader to butterfly * butterfly.c: Add some specific logic to handle the mikrokopter.de butterfly bootloader. * butterfly.h: Add one related function declaration. * config_gram.y: Add butterfly_mk keyword. * lexer.l: (Ditto.) * avrdude.conf.in: Add entry for butterfly_mk. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@991 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
e31e284adb
commit
185a54d5aa
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Juergen Weigert:
|
||||
patch #7056: adding support for mikrokopter bootloader to butterfly
|
||||
* butterfly.c: Add some specific logic to handle the
|
||||
mikrokopter.de butterfly bootloader.
|
||||
* butterfly.h: Add one related function declaration.
|
||||
* config_gram.y: Add butterfly_mk keyword.
|
||||
* lexer.l: (Ditto.)
|
||||
* avrdude.conf.in: Add entry for butterfly_mk.
|
||||
|
||||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Stefan Tomanek:
|
||||
|
|
1
NEWS
1
NEWS
|
@ -17,6 +17,7 @@ Current:
|
|||
and parallel ones)
|
||||
- FT2232 (and relatives) based programmers (MPSSE bitbang mode)
|
||||
- Wiring environment (http://wiring.org.co/)
|
||||
- butterfly-style bootloader of the Mikrokopter.de device
|
||||
|
||||
* Bugfixes
|
||||
|
||||
|
|
|
@ -552,6 +552,19 @@ programmer
|
|||
type = butterfly;
|
||||
;
|
||||
|
||||
# suggested in http://forum.mikrokopter.de/topic-post48317.html
|
||||
programmer
|
||||
id = "mkbutterfly";
|
||||
desc = "Mikrokopter.de Butterfly";
|
||||
type = butterfly_mk;
|
||||
;
|
||||
|
||||
programmer
|
||||
id = "butterfly_mk";
|
||||
desc = "Mikrokopter.de Butterfly";
|
||||
type = butterfly_mk;
|
||||
;
|
||||
|
||||
programmer
|
||||
id = "jtagmkI";
|
||||
desc = "Atmel JTAG ICE (mkI)";
|
||||
|
|
82
butterfly.c
82
butterfly.c
|
@ -43,6 +43,7 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "avr.h"
|
||||
|
@ -205,6 +206,7 @@ static void butterfly_powerdown(PROGRAMMER * pgm)
|
|||
return;
|
||||
}
|
||||
|
||||
#define IS_BUTTERFLY_MK 0x0001
|
||||
|
||||
/*
|
||||
* initialize the AVR device and prepare it to accept commands
|
||||
|
@ -223,26 +225,61 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
|||
* for plain avr109 bootloaders but does not harm there either.
|
||||
*/
|
||||
fprintf(stderr, "Connecting to programmer: ");
|
||||
do {
|
||||
putc('.', stderr);
|
||||
butterfly_send(pgm, "\033", 1);
|
||||
butterfly_drain(pgm, 0);
|
||||
butterfly_send(pgm, "S", 1);
|
||||
butterfly_recv(pgm, &c, 1);
|
||||
if (c != '?') {
|
||||
putc('\n', stderr);
|
||||
/*
|
||||
* Got a useful response, continue getting the programmer
|
||||
* identifier. Programmer returns exactly 7 chars _without_
|
||||
* the null.
|
||||
*/
|
||||
id[0] = c;
|
||||
butterfly_recv(pgm, &id[1], sizeof(id)-2);
|
||||
id[sizeof(id)-1] = '\0';
|
||||
if (pgm->flag & IS_BUTTERFLY_MK)
|
||||
{
|
||||
char mk_reset_cmd[6] = {"#aR@S\r"};
|
||||
unsigned char mk_timeout = 0;
|
||||
|
||||
putc('.', stderr);
|
||||
butterfly_send(pgm, mk_reset_cmd, sizeof(mk_reset_cmd));
|
||||
usleep(20000);
|
||||
|
||||
do
|
||||
{
|
||||
c = 27;
|
||||
butterfly_send(pgm, &c, 1);
|
||||
usleep(20000);
|
||||
c = 0xaa;
|
||||
usleep(80000);
|
||||
butterfly_send(pgm, &c, 1);
|
||||
if (mk_timeout % 10 == 0) putc('.', stderr);
|
||||
} while (mk_timeout++ < 10);
|
||||
|
||||
butterfly_recv(pgm, &c, 1);
|
||||
if ( c != 'M' && c != '?')
|
||||
{
|
||||
fprintf(stderr, "\nConnection FAILED.");
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
id[0] = 'M'; id[1] = 'K'; id[2] = '2'; id[3] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
do {
|
||||
putc('.', stderr);
|
||||
butterfly_send(pgm, "\033", 1);
|
||||
butterfly_drain(pgm, 0);
|
||||
butterfly_send(pgm, "S", 1);
|
||||
butterfly_recv(pgm, &c, 1);
|
||||
if (c != '?') {
|
||||
putc('\n', stderr);
|
||||
/*
|
||||
* Got a useful response, continue getting the programmer
|
||||
* identifier. Programmer returns exactly 7 chars _without_
|
||||
* the null.
|
||||
*/
|
||||
id[0] = c;
|
||||
butterfly_recv(pgm, &id[1], sizeof(id)-2);
|
||||
id[sizeof(id)-1] = '\0';
|
||||
}
|
||||
} while (c == '?');
|
||||
}
|
||||
} while (c == '?');
|
||||
|
||||
/* Get the HW and SW versions to see if the programmer is present. */
|
||||
butterfly_drain(pgm, 0);
|
||||
|
||||
butterfly_send(pgm, "V", 1);
|
||||
butterfly_recv(pgm, sw, sizeof(sw));
|
||||
|
@ -327,6 +364,7 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
|||
progname, (unsigned)buf[1]);
|
||||
|
||||
butterfly_enter_prog_mode(pgm);
|
||||
butterfly_drain(pgm, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -665,7 +703,7 @@ static int butterfly_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
|
|||
|
||||
void butterfly_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
strcpy(pgm->type, "avr910");
|
||||
strcpy(pgm->type, "butterfly");
|
||||
|
||||
/*
|
||||
* mandatory functions
|
||||
|
@ -698,4 +736,12 @@ void butterfly_initpgm(PROGRAMMER * pgm)
|
|||
|
||||
pgm->setup = butterfly_setup;
|
||||
pgm->teardown = butterfly_teardown;
|
||||
pgm->flag = 0;
|
||||
}
|
||||
|
||||
void butterfly_mk_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
butterfly_initpgm(pgm);
|
||||
strcpy(pgm->type, "butterfly_mk");
|
||||
pgm->flag = IS_BUTTERFLY_MK;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
void butterfly_initpgm (PROGRAMMER * pgm);
|
||||
void butterfly_mk_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -161,6 +161,7 @@ static int parse_cmdbits(OPCODE * op);
|
|||
%token K_USBVENDOR
|
||||
%token K_USBVID
|
||||
%token K_BUTTERFLY
|
||||
%token K_BUTTERFLY_MK
|
||||
%token K_TYPE
|
||||
%token K_VCC
|
||||
%token K_VFYLED
|
||||
|
@ -508,6 +509,12 @@ prog_parm :
|
|||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_BUTTERFLY_MK {
|
||||
{
|
||||
butterfly_mk_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_JTAG_MKI {
|
||||
{
|
||||
jtagmkI_initpgm(current_prog);
|
||||
|
|
1
lexer.l
1
lexer.l
|
@ -130,6 +130,7 @@ bs2 { yylval=NULL; return K_BS2; }
|
|||
buff { yylval=NULL; return K_BUFF; }
|
||||
buspirate { yylval=NULL; return K_BUSPIRATE; }
|
||||
butterfly { yylval=NULL; return K_BUTTERFLY; }
|
||||
butterfly_mk { yylval=NULL; return K_BUTTERFLY_MK; }
|
||||
chip_erase_delay { yylval=NULL; return K_CHIP_ERASE_DELAY; }
|
||||
desc { yylval=NULL; return K_DESC; }
|
||||
default_parallel { yylval=NULL; return K_DEFAULT_PARALLEL; }
|
||||
|
|
Loading…
Reference in New Issue