Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2
avrdude
avrdude_butterfly_mk.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File avrdude_butterfly_mk.patch of Package avrdude
--- avrdude-5.10/avrdude.conf.in.orig 2010-01-19 11:39:11.000000000 +0100 +++ avrdude-5.10/avrdude.conf.in 2010-05-15 17:38:44.000000000 +0200 @@ -443,6 +443,19 @@ programmer desc = "Atmel AppNote AVR911 AVROSP"; 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"; --- avrdude-5.10/butterfly.c.orig 2010-01-19 11:39:11.000000000 +0100 +++ avrdude-5.10/butterfly.c 2010-05-15 17:43:05.000000000 +0200 @@ -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(PROGRAMM return; } +#define IS_BUTTERFLY_MK 0x0001 /* * initialize the AVR device and prepare it to accept commands @@ -223,26 +225,60 @@ static int butterfly_initialize(PROGRAMM * 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 || getenv("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; + butterfly_send(pgm, &c, 1); + if (mk_timeout % 10 == 0) putc('.', stderr); + butterfly_recv(pgm, &c, 1); + } while (c != 'M' && mk_timeout++ < 30); + + if ( c != 'M' && c != '?') + { + fprintf(stderr, "\nConnection FAILED.\n"); + 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 +363,7 @@ static int butterfly_initialize(PROGRAMM progname, (unsigned)buf[1]); butterfly_enter_prog_mode(pgm); + butterfly_drain(pgm, 0); return 0; } @@ -663,7 +700,7 @@ static int butterfly_read_sig_bytes(PROG void butterfly_initpgm(PROGRAMMER * pgm) { - strcpy(pgm->type, "avr910"); + strcpy(pgm->type, "butterfly"); /* * mandatory functions @@ -696,4 +733,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; } --- avrdude-5.10/config_gram.y.orig 2010-01-19 11:39:11.000000000 +0100 +++ avrdude-5.10/config_gram.y 2010-05-15 17:38:44.000000000 +0200 @@ -151,6 +151,7 @@ static int parse_cmdbits(OPCODE * op); %token K_USBASP %token K_USBTINY %token K_BUTTERFLY +%token K_BUTTERFLY_MK %token K_TYPE %token K_VCC %token K_VFYLED @@ -480,6 +481,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); --- avrdude-5.10/butterfly.h.orig 2010-01-19 11:39:11.000000000 +0100 +++ avrdude-5.10/butterfly.h 2010-05-15 17:38:44.000000000 +0200 @@ -27,6 +27,7 @@ extern "C" { #endif void butterfly_initpgm (PROGRAMMER * pgm); +void butterfly_mk_initpgm (PROGRAMMER * pgm); #ifdef __cplusplus } --- avrdude-5.10/lexer.l.orig 2010-01-19 11:39:11.000000000 +0100 +++ avrdude-5.10/lexer.l 2010-05-15 17:38:44.000000000 +0200 @@ -129,6 +129,7 @@ bs2 { yylval=NULL; return K 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; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor