[minipro/epel7] Fix ATMEGA32 support

Lubomir Rintel lkundrak at fedoraproject.org
Fri Dec 5 08:03:06 UTC 2014


commit 91e5eb0312e6bb3b003b88408bd172f309d73938
Author: Lubomir Rintel <lkundrak at v3.sk>
Date:   Fri Dec 5 09:03:07 2014 +0100

    Fix ATMEGA32 support

 ...read-for-AVR-devices-with-one-or-two-fuse.patch |   96 ++++++++++++++++++++
 minipro.spec                                       |    6 +-
 2 files changed, 101 insertions(+), 1 deletions(-)
---
diff --git a/0001-Fix-config-read-for-AVR-devices-with-one-or-two-fuse.patch b/0001-Fix-config-read-for-AVR-devices-with-one-or-two-fuse.patch
new file mode 100644
index 0000000..b4deb15
--- /dev/null
+++ b/0001-Fix-config-read-for-AVR-devices-with-one-or-two-fuse.patch
@@ -0,0 +1,96 @@
+From 47d4e3388a1abdc2694cf8add032addd2c6f0679 Mon Sep 17 00:00:00 2001
+From: Lubomir Rintel <lkundrak at v3.sk>
+Date: Thu, 4 Dec 2014 22:54:08 +0100
+Subject: [PATCH] Fix config read for AVR devices with one or two fuses
+
+Not all families have three. Not sure if there's better way to derermine,
+but seems like protocol variant is a pretty safe, though a bit ugly, way
+to determine the family. Manually checked against the vendor utility's GUI.
+
+Tested with ATMEGA32, should fix the issue #23 too.
+---
+ fuses.c | 13 +++++++++++++
+ fuses.h |  2 ++
+ main.c  | 28 ++++++++++++++++++++++++++--
+ 3 files changed, 41 insertions(+), 2 deletions(-)
+
+diff --git a/fuses.c b/fuses.c
+index cd6136a..62589ad 100644
+--- a/fuses.c
++++ b/fuses.c
+@@ -2,6 +2,19 @@
+ #include "fuses.h"
+ 
+ fuse_decl_t avr_fuses[] = {
++	{ .name = "fuses", .minipro_cmd = 0x12, .length = 1, .offset = 0 },
++	{ .name = "lock_byte", .minipro_cmd = 0x41, .length = 1, .offset = 0 },
++	{ .name = NULL },
++};
++
++fuse_decl_t avr2_fuses[] = {
++	{ .name = "fuses_lo", .minipro_cmd = 0x12, .length = 1, .offset = 0 },
++	{ .name = "fuses_hi", .minipro_cmd = 0x12, .length = 1, .offset = 1 },
++	{ .name = "lock_byte", .minipro_cmd = 0x41, .length = 1, .offset = 0 },
++	{ .name = NULL },
++};
++
++fuse_decl_t avr3_fuses[] = {
+ 	{ .name = "fuses_lo", .minipro_cmd = 0x12, .length = 1, .offset = 0 },
+ 	{ .name = "fuses_hi", .minipro_cmd = 0x12, .length = 1, .offset = 1 },
+ 	{ .name = "fuses_ext", .minipro_cmd = 0x12, .length = 1, .offset = 2 },
+diff --git a/fuses.h b/fuses.h
+index 13b8fc4..ff574a7 100644
+--- a/fuses.h
++++ b/fuses.h
+@@ -9,6 +9,8 @@ typedef struct fuse_decl {
+ } fuse_decl_t;
+ 
+ extern fuse_decl_t avr_fuses[];
++extern fuse_decl_t avr2_fuses[];
++extern fuse_decl_t avr3_fuses[];
+ extern fuse_decl_t pic_fuses[];
+ extern fuse_decl_t pic2_fuses[];
+ 
+diff --git a/main.c b/main.c
+index 6e9a5e9..b0b1660 100644
+--- a/main.c
++++ b/main.c
+@@ -468,9 +468,33 @@ int main(int argc, char **argv) {
+ 
+ 	/* TODO: put in devices.h and remove this stub */
+ 	switch(device->protocol_id) {
++
+ 		case 0x71:
+-			device->fuses = avr_fuses;
+-			break;
++		  switch(device->variant) {
++			case 0x01:
++			case 0x21:
++			case 0x44:
++			case 0x61:
++				device->fuses = avr_fuses;
++				break;
++			case 0x00:
++			case 0x20:
++			case 0x22:
++			case 0x43:
++			case 0x85:
++				device->fuses = avr2_fuses;
++				break;
++			case 0x0a:
++			case 0x2a:
++			case 0x48:
++			case 0x49:
++			case 0x6b:
++				device->fuses = avr3_fuses;
++				break;
++			default:
++				PERROR("Unknown AVR device");
++		  }
++		  break;
+  	        case 0x10063:   //  select 2 fuses
+ 		  device->fuses=pic2_fuses;
+ 		  device->protocol_id&=0xFFFF;
+-- 
+2.1.0
+
diff --git a/minipro.spec b/minipro.spec
index 6b157b3..6010e79 100644
--- a/minipro.spec
+++ b/minipro.spec
@@ -3,7 +3,7 @@
 
 Name:           minipro
 Version:        0
-Release:        6.20141011git%{shortcommit}%{?dist}.1
+Release:        6.20141011git%{shortcommit}%{?dist}.2
 Summary:        Utility for MiniPro TL866A/TL866/CS programmer
 
 Group:          System Environment/Base
@@ -14,6 +14,7 @@ URL:            https://github.com/vdudouyt/minipro
 Source0:        https://github.com/vdudouyt/minipro/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
 Patch0:         0001-No-libusb_strerror-in-RHEL-7.patch
 Patch1:         0001-Fix-I-option-in-usage-info.patch
+Patch2:         0001-Fix-config-read-for-AVR-devices-with-one-or-two-fuse.patch
 
 BuildRequires:  pkgconfig(libusb-1.0)
 Requires:       udev
@@ -59,6 +60,9 @@ udevadm trigger --subsystem-match=usb --attr-match=idVendor=04d8 --attr-match=id
 
 
 %changelog
+* Fri Dec 05 2014 Lubomir Rintel <lkundrak at v3.sk> - 0-6.20141011git6a561be.2
+- Fix ATMEGA32 support
+
 * Sat Oct 11 2014 Lubomir Rintel <lkundrak at v3.sk> - 0-6.20141011git6a561be.1
 - Rebase to a later upstream snapshot
 - Drop upstreamed patches


More information about the scm-commits mailing list