Date:2011-03-07 17:49:28 (13 years 21 days ago)
Author:Werner Almesberger
Commit:271a50f3c25d29ead43cfd2730a14c5b5a479923
Message:uart/avrdude: renamed to ./avrdude (i.e., moved to the top-level)

Files: avrdude/README (1 diff)
avrdude/patches/atmega32u2.patch (1 diff)
avrdude/patches/nanonote-atusb.patch (1 diff)
avrdude/patches/nanonote-uart.patch (1 diff)
avrdude/patches/nanonote.patch (1 diff)
avrdude/patches/series (1 diff)
uart/avrdude/README (1 diff)
uart/avrdude/patches/atmega32u2.patch (1 diff)
uart/avrdude/patches/nanonote-atusb.patch (1 diff)
uart/avrdude/patches/nanonote-uart.patch (1 diff)
uart/avrdude/patches/nanonote.patch (1 diff)
uart/avrdude/patches/series (1 diff)

Change Details

avrdude/README
1# --- build instructions common for OpenWRT and Jlime -------------------------
2
3wget http://download.savannah.gnu.org/releases/avrdude/avrdude-5.10.tar.gz
4tar xfz avrdude-5.10.tar.gz
5cd avrdude-5.10
6
7quilt push -a
8
9aclocal
10automake
11
12# --- build instructions for OpenWRT ------------------------------------------
13
14./configure --prefix=/ --host=mipsel-openwrt-linux
15make
16# the joy of autocrap (we need this to generate avrdude.conf)
17./configure --prefix=/ --host=mipsel-openwrt-linux
18
19scp avrdude.conf ben:/etc/
20scp avrdude ben:/usr/bin/
21
22# --- build instructions for Jlime --------------------------------------------
23
24./configure --prefix=/ --host=mipsel-linux
25make </dev/null
26# the joy of autocrap (we need this to generate avrdude.conf)
27./configure --prefix=/ --host=mipsel-linux
28
29scp avrdude.conf jlime:/etc/
30scp avrdude jlime:/usr/bin/
avrdude/patches/atmega32u2.patch
1Index: avrdude/avrdude-5.10/avrdude.conf.in
2===================================================================
3--- avrdude.orig/avrdude-5.10/avrdude.conf.in 2011-02-11 00:33:27.000000000 -0300
4@@ -13033,6 +13033,191 @@
5   ;
6
7 #------------------------------------------------------------
8+# ATmega32U2
9+#------------------------------------------------------------
10+
11+#
12+# This is a rough adaptation of the AT90USB162 definition. May contain all
13+# sorts of errors.
14+#
15+
16+part
17+ id = "m32u2";
18+ desc = "ATmega32U2";
19+ has_jtag = no;
20+ has_debugwire = yes;
21+ signature = 0x1e 0x95 0x8a;
22+ chip_erase_delay = 9000;
23+ reset = io;
24+ pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
25+ "x x x x x x x x x x x x x x x x";
26+ chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
27+ "x x x x x x x x x x x x x x x x";
28+ pagel = 0xD7;
29+ bs2 = 0xC6;
30+
31+ timeout = 200;
32+ stabdelay = 100;
33+ cmdexedelay = 25;
34+ synchloops = 32;
35+ bytedelay = 0;
36+ pollindex = 3;
37+ pollvalue = 0x53;
38+ predelay = 1;
39+ postdelay = 1;
40+ pollmethod = 1;
41+ pp_controlstack =
42+ 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
43+ 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
44+ 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
45+ 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
46+ hventerstabdelay = 100;
47+ progmodedelay = 0;
48+ latchcycles = 5;
49+ togglevtg = 1;
50+ poweroffdelay = 15;
51+ resetdelayms = 1;
52+ resetdelayus = 0;
53+ hvleavestabdelay = 15;
54+ chiperasepulsewidth = 0;
55+ chiperasepolltimeout = 10;
56+ programfusepulsewidth = 0;
57+ programfusepolltimeout = 5;
58+ programlockpulsewidth = 0;
59+ programlockpolltimeout = 5;
60+
61+ memory "eeprom"
62+ paged = no; /* leave this "no" */
63+ page_size = 4; /* for parallel programming */
64+ size = 1024;
65+ num_pages = 256;
66+ min_write_delay = 9000;
67+ max_write_delay = 9000;
68+ readback_p1 = 0x00;
69+ readback_p2 = 0x00;
70+ read = " 1 0 1 0 0 0 0 0",
71+ " 0 0 0 0 a11 a10 a9 a8",
72+ " a7 a6 a5 a4 a3 a2 a1 a0",
73+ " o o o o o o o o";
74+
75+ write = " 1 1 0 0 0 0 0 0",
76+ " 0 0 0 0 a11 a10 a9 a8",
77+ " a7 a6 a5 a4 a3 a2 a1 a0",
78+ " i i i i i i i i";
79+
80+ loadpage_lo = " 1 1 0 0 0 0 0 1",
81+ " 0 0 0 0 0 0 0 0",
82+ " 0 0 0 0 0 0 a1 a0",
83+ " i i i i i i i i";
84+
85+ writepage = " 1 1 0 0 0 0 1 0",
86+ " 0 0 0 0 a11 a10 a9 a8",
87+ " a7 a6 a5 a4 a3 a2 0 0",
88+ " x x x x x x x x";
89+
90+ mode = 0x41;
91+ delay = 20;
92+ blocksize = 4;
93+ readsize = 256;
94+ ;
95+
96+ memory "flash"
97+ paged = yes;
98+ size = 32768;
99+ page_size = 128;
100+ num_pages = 256;
101+ min_write_delay = 4500;
102+ max_write_delay = 4500;
103+ readback_p1 = 0x00;
104+ readback_p2 = 0x00;
105+ read_lo = " 0 0 1 0 0 0 0 0",
106+ "a15 a14 a13 a12 a11 a10 a9 a8",
107+ " a7 a6 a5 a4 a3 a2 a1 a0",
108+ " o o o o o o o o";
109+
110+ read_hi = " 0 0 1 0 1 0 0 0",
111+ "a15 a14 a13 a12 a11 a10 a9 a8",
112+ " a7 a6 a5 a4 a3 a2 a1 a0",
113+ " o o o o o o o o";
114+
115+ loadpage_lo = " 0 1 0 0 0 0 0 0",
116+ " x x x x x x x x",
117+ " x x a5 a4 a3 a2 a1 a0",
118+ " i i i i i i i i";
119+
120+ loadpage_hi = " 0 1 0 0 1 0 0 0",
121+ " x x x x x x x x",
122+ " x x a5 a4 a3 a2 a1 a0",
123+ " i i i i i i i i";
124+
125+ writepage = " 0 1 0 0 1 1 0 0",
126+ "a15 a14 a13 a12 a11 a10 a9 a8",
127+ " a7 a6 x x x x x x",
128+ " x x x x x x x x";
129+
130+ mode = 0x41;
131+ delay = 6;
132+ blocksize = 128;
133+ readsize = 256;
134+ ;
135+
136+ memory "lfuse"
137+ size = 1;
138+ write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
139+ "x x x x x x x x i i i i i i i i";
140+
141+ read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
142+ "x x x x x x x x o o o o o o o o";
143+ min_write_delay = 9000;
144+ max_write_delay = 9000;
145+ ;
146+
147+ memory "hfuse"
148+ size = 1;
149+ write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
150+ "x x x x x x x x i i i i i i i i";
151+
152+ read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
153+ "x x x x x x x x o o o o o o o o";
154+ min_write_delay = 9000;
155+ max_write_delay = 9000;
156+ ;
157+
158+ memory "efuse"
159+ size = 1;
160+ write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
161+ "x x x x x x x x i i i i i i i i";
162+
163+ read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
164+ "x x x x x x x x o o o o o o o o";
165+ min_write_delay = 9000;
166+ max_write_delay = 9000;
167+ ;
168+
169+ memory "lock"
170+ size = 1;
171+ read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
172+ "x x x x x x x x x x o o o o o o";
173+
174+ write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
175+ "x x x x x x x x 1 1 i i i i i i";
176+ min_write_delay = 9000;
177+ max_write_delay = 9000;
178+ ;
179+
180+ memory "calibration"
181+ size = 1;
182+ read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
183+ "0 0 0 0 0 0 0 0 o o o o o o o o";
184+ ;
185+ memory "signature"
186+ size = 3;
187+ read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
188+ "x x x x x x a1 a0 o o o o o o o o";
189+ ;
190+ ;
191+
192+#------------------------------------------------------------
193 # AT90USB82
194 #------------------------------------------------------------
195 # Changes against AT90USB162 (beside IDs)
avrdude/patches/nanonote-atusb.patch
1Index: avrdude/avrdude-5.10/avrdude.conf.in
2===================================================================
3--- avrdude.orig/avrdude-5.10/avrdude.conf.in 2011-02-04 14:21:42.000000000 -0300
4@@ -615,6 +615,17 @@
5   miso = 1;
6 ;
7
8+programmer
9+ id = "nanonote_atusb";
10+ desc = "NanoNote 8:10 card adapter for ATUSB";
11+ type = nanonote;
12+ reset = 1;
13+ sck = 8;
14+ mosi = 7;
15+ miso = 6;
16+ pgmled = 2;
17+;
18+
19 @HAVE_PARPORT_BEGIN@ Inclusion of the following depends on --enable-parport
20 # Parallel port programmers.
21
avrdude/patches/nanonote-uart.patch
1Index: avrdude/avrdude-5.10/avrdude.conf.in
2===================================================================
3--- avrdude.orig/avrdude-5.10/avrdude.conf.in 2011-02-04 17:26:06.000000000 -0300
4@@ -592,6 +592,29 @@
5   type = avr910;
6 ;
7
8+#
9+# 8:10 card pin assignment:
10+#
11+# DAT1 1
12+# DAT0 2
13+# VSS -
14+# CLK - (reserved for clock output)
15+# VDD -
16+# CMD 5
17+# DAT3 7
18+# DAT2 8
19+#
20+
21+programmer
22+ id = "nanonote_uart";
23+ desc = "NanoNote UART 8:10 card";
24+ type = nanonote;
25+ reset = 8;
26+ sck = 2;
27+ mosi = 7;
28+ miso = 1;
29+;
30+
31 @HAVE_PARPORT_BEGIN@ Inclusion of the following depends on --enable-parport
32 # Parallel port programmers.
33
avrdude/patches/nanonote.patch
1Index: avrdude/avrdude-5.10/Makefile.am
2===================================================================
3--- avrdude.orig/avrdude-5.10/Makefile.am 2011-02-15 00:16:48.000000000 -0300
4@@ -111,6 +111,8 @@
5     lists.c \
6     lists.h \
7     my_ddk_hidsdi.h \
8+ nanonote.c \
9+ nanonote.h \
10     par.c \
11     par.h \
12     pgm.c \
13Index: avrdude/avrdude-5.10/config_gram.y
14===================================================================
15--- avrdude.orig/avrdude-5.10/config_gram.y 2011-02-15 00:16:48.000000000 -0300
16@@ -48,6 +48,7 @@
17 #include "avr.h"
18 #include "jtagmkI.h"
19 #include "jtagmkII.h"
20+#include "nanonote.h"
21
22 #if defined(WIN32NATIVE)
23 #define strtok_r( _s, _sep, _lasts ) \
24@@ -99,6 +100,7 @@
25 %token K_DRAGON_JTAG
26 %token K_DRAGON_PDI
27 %token K_DRAGON_PP
28+%token K_NANONOTE
29 %token K_STK500_DEVCODE
30 %token K_AVR910_DEVCODE
31 %token K_EEPROM
32@@ -551,6 +553,12 @@
33     }
34   } |
35
36+ K_TYPE TKN_EQUAL K_NANONOTE {
37+ {
38+ nanonote_initpgm(current_prog);
39+ }
40+ } |
41+
42   K_DESC TKN_EQUAL TKN_STRING {
43     strncpy(current_prog->desc, $3->value.string, PGM_DESCLEN);
44     current_prog->desc[PGM_DESCLEN-1] = 0;
45Index: avrdude/avrdude-5.10/lexer.l
46===================================================================
47--- avrdude.orig/avrdude-5.10/lexer.l 2011-02-15 00:16:48.000000000 -0300
48@@ -164,6 +164,7 @@
49 min_write_delay { yylval=NULL; return K_MIN_WRITE_DELAY; }
50 miso { yylval=NULL; return K_MISO; }
51 mosi { yylval=NULL; return K_MOSI; }
52+nanonote { yylval=NULL; return K_NANONOTE; }
53 num_banks { yylval=NULL; return K_NUM_PAGES; }
54 num_pages { yylval=NULL; return K_NUM_PAGES; }
55 nvm_base { yylval=NULL; return K_NVM_BASE; }
56Index: avrdude/avrdude-5.10/nanonote.c
57===================================================================
58--- /dev/null 1970-01-01 00:00:00.000000000 +0000
59@@ -0,0 +1,290 @@
60+/*
61+ * avrdude - A Downloader/Uploader for AVR device programmers
62+ * Copyright (C) 2000, 2001, 2002, 2003 Brian S. Dean <bsd@bsdhome.com>
63+ * Copyright (C) 2005 Michael Holzt <kju-avr@fqdn.org>
64+ * Copyright (C) 2006 Joerg Wunsch <j@uriah.heep.sax.de>
65+ *
66+ * This program is free software; you can redistribute it and/or modify
67+ * it under the terms of the GNU General Public License as published by
68+ * the Free Software Foundation; either version 2 of the License, or
69+ * (at your option) any later version.
70+ *
71+ * This program is distributed in the hope that it will be useful,
72+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
73+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
74+ * GNU General Public License for more details.
75+ *
76+ * You should have received a copy of the GNU General Public License
77+ * along with this program; if not, write to the Free Software
78+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
79+ */
80+
81+/*
82+ * Posix serial bitbanging interface for avrdude.
83+ */
84+
85+
86+#include <stdint.h>
87+#include <stdlib.h>
88+#include <stdio.h>
89+#include <unistd.h>
90+#include <string.h>
91+#include <fcntl.h>
92+#include <sys/mman.h>
93+
94+#include "avr.h"
95+#include "pgm.h"
96+#include "bitbang.h"
97+
98+
99+
100+static volatile void *mem;
101+
102+
103+#define POWER_OFF 3, 2 /* PD02, drive low to enable power */
104+#define CMD 3, 8 /* PD08, CMD */
105+#define CLK 3, 9 /* PD09, CLK */
106+#define DAT0 3, 10 /* PD10, DAT0 */
107+#define DAT1 3, 11 /* PD11, DAT1 */
108+#define DAT2 3, 12 /* PD12, DAT2 */
109+#define DAT3 3, 13 /* PD13, DAT3 */
110+
111+
112+static struct {
113+ unsigned port;
114+ unsigned bit;
115+} pin_map[] = {
116+ { 0, 0}, /* 0: not assigned */
117+ { 3, 11 }, /* 1: PD11, DAT1 */
118+ { 3, 10 }, /* 2: PD12, DAT0 */
119+ { 0, 0 }, /* 3: VSS */
120+ { 0, 0 }, /* 4: PD09, CLK (reserved) */
121+ { 0, 0 }, /* 5: VDD */
122+ { 3, 8 }, /* 6: PD08, CMD */
123+ { 3, 13 }, /* 7: PD13, DAT3 */
124+ { 3, 12 } /* 8: PD13, DAT2 */
125+};
126+
127+
128+#define BASE 0x10010000
129+
130+#define REG(off) (*(volatile uint32_t *) (mem+(off)))
131+
132+#define port_pin(port) REG(port*0x100)
133+#define port_dats(port) REG(port*0x100+0x14)
134+#define port_datc(port) REG(port*0x100+0x18)
135+#define port_func(port) REG(port*0x100+0x48)
136+#define port_dirs(port) REG(port*0x100+0x64)
137+#define port_dirc(port) REG(port*0x100+0x68)
138+
139+
140+static inline void gpio_high(unsigned port, unsigned bit)
141+{
142+ port_dats(port) = 1 << bit;
143+}
144+
145+
146+static void gpio_low(unsigned port, unsigned bit)
147+{
148+ port_datc(port) = 1 << bit;
149+}
150+
151+
152+static void gpio_set(unsigned port, unsigned bit, int value)
153+{
154+ if (value)
155+ gpio_high(port, bit);
156+ else
157+ gpio_low(port, bit);
158+}
159+
160+
161+static int gpio_get(unsigned port, unsigned bit)
162+{
163+ return (port_pin(port) >> bit) & 1;
164+}
165+
166+
167+static void gpio_output(unsigned port, unsigned bit)
168+{
169+ port_dirs(port) = 1 << bit;
170+}
171+
172+
173+static void gpio_input(unsigned port, unsigned bit)
174+{
175+ port_dirc(port) = 1 << bit;
176+}
177+
178+
179+static int nanonote_setpin(PROGRAMMER *pgm, int pin, int value)
180+{
181+ if (pin & PIN_INVERSE) {
182+ value = !value;
183+ pin &= PIN_MASK;
184+ }
185+
186+ if (pin < 1 || pin >= sizeof(pin_map)/sizeof(*pin_map))
187+ return -1;
188+ if (!pin_map[pin].port)
189+ return -1;
190+
191+#if 0
192+fprintf(stderr, "pin %d (%u, %u) = %d\n",
193+pin, pin_map[pin].port, pin_map[pin].bit, value);
194+#endif
195+ gpio_set(pin_map[pin].port, pin_map[pin].bit, value);
196+
197+ /*
198+ * We get unstable results with values <= 16 but stable results
199+ * with 17 and above.
200+ */
201+ bitbang_delay(pgm->ispdelay+20);
202+
203+ return 0;
204+}
205+
206+
207+static int nanonote_getpin(PROGRAMMER *pgm, int pin)
208+{
209+ int invert = 0;
210+ int v;
211+
212+ if (pin & PIN_INVERSE) {
213+ invert = 1;
214+ pin &= PIN_MASK;
215+ }
216+
217+ if (pin < 1 || pin >= sizeof(pin_map)/sizeof(*pin_map))
218+ return -1;
219+ if (!pin_map[pin].port)
220+ return -1;
221+
222+ gpio_input(pin_map[pin].port, pin_map[pin].bit); /* @@@ hack */
223+ v = gpio_get(pin_map[pin].port, pin_map[pin].bit);
224+#if 0
225+fprintf(stderr, "pin %d (%u, %u): %d\n",
226+pin, pin_map[pin].port, pin_map[pin].bit, v);
227+#endif
228+ return pin & PIN_INVERSE ? !v : v;
229+}
230+
231+
232+static int nanonote_highpulsepin(PROGRAMMER *pgm, int pin)
233+{
234+ return -1;
235+}
236+
237+
238+static void nanonote_display(PROGRAMMER *pgm, const char *p)
239+{
240+ /* nothing */
241+}
242+
243+
244+static void misc_high(PROGRAMMER *pgm)
245+{
246+ gpio_high(POWER_OFF);
247+ gpio_high(DAT1);
248+ gpio_high(DAT0);
249+ gpio_high(CMD);
250+ gpio_high(DAT3);
251+ gpio_high(DAT2);
252+}
253+
254+
255+static void nanonote_enable(PROGRAMMER *pgm)
256+{
257+ misc_high(pgm);
258+ /* @@@ set CLK to function and output clock */
259+}
260+
261+
262+static void nanonote_disable(PROGRAMMER *pgm)
263+{
264+ misc_high(pgm);
265+ /* @@@ set CLK to GPIO */
266+ gpio_high(CLK);
267+}
268+
269+
270+static void nanonote_powerup(PROGRAMMER *pgm)
271+{
272+ gpio_low(POWER_OFF);
273+}
274+
275+
276+static void nanonote_powerdown(PROGRAMMER *pgm)
277+{
278+ gpio_input(DAT0);
279+ gpio_input(CLK);
280+ gpio_input(CMD);
281+ gpio_input(DAT3);
282+ gpio_input(DAT2);
283+ gpio_input(DAT1);
284+ gpio_high(POWER_OFF);
285+}
286+
287+
288+static int nanonote_open(PROGRAMMER *pgm, char *port)
289+{
290+ bitbang_check_prerequisites(pgm);
291+
292+ pgm->fd.ifd = open("/dev/mem", O_RDWR | O_SYNC);
293+ if (pgm->fd.ifd < 0) {
294+ perror("/dev/mem");
295+ return -1;
296+ }
297+ mem = mmap(NULL, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED,
298+ pgm->fd.ifd, BASE);
299+ if (mem == MAP_FAILED) {
300+ perror("mmap");
301+ return -1;
302+ }
303+
304+ gpio_output(POWER_OFF);
305+ gpio_output(DAT0);
306+ gpio_output(CLK);
307+ gpio_output(CMD);
308+ gpio_output(DAT3);
309+ gpio_output(DAT2);
310+ gpio_output(DAT1);
311+
312+ nanonote_disable(pgm);
313+
314+ return 0;
315+}
316+
317+
318+static void nanonote_close(PROGRAMMER *pgm)
319+{
320+ if (pgm->fd.ifd != -1)
321+ close(pgm->fd.ifd);
322+}
323+
324+
325+void nanonote_initpgm(PROGRAMMER *pgm)
326+{
327+ strcpy(pgm->type, "NANONOTE");
328+
329+ pgm->rdy_led = bitbang_rdy_led;
330+ pgm->err_led = bitbang_err_led;
331+ pgm->pgm_led = bitbang_pgm_led;
332+ pgm->vfy_led = bitbang_vfy_led;
333+ pgm->initialize = bitbang_initialize;
334+ pgm->display = nanonote_display;
335+ pgm->enable = nanonote_enable;
336+ pgm->disable = nanonote_disable;
337+ pgm->powerup = nanonote_powerup;
338+ pgm->powerdown = nanonote_powerdown;
339+ pgm->program_enable = bitbang_program_enable;
340+ pgm->chip_erase = bitbang_chip_erase;
341+ pgm->cmd = bitbang_cmd;
342+ pgm->open = nanonote_open;
343+ pgm->close = nanonote_close;
344+ pgm->setpin = nanonote_setpin;
345+ pgm->getpin = nanonote_getpin;
346+ pgm->highpulsepin = nanonote_highpulsepin;
347+ pgm->read_byte = avr_read_byte_default;
348+ pgm->write_byte = avr_write_byte_default;
349+}
350Index: avrdude/avrdude-5.10/nanonote.h
351===================================================================
352--- /dev/null 1970-01-01 00:00:00.000000000 +0000
353@@ -0,0 +1,6 @@
354+#ifndef nanonote_h
355+#define nanonote_h
356+
357+void nanonote_initpgm(PROGRAMMER *pgm);
358+
359+#endif
avrdude/patches/series
1nanonote.patch
2nanonote-uart.patch
3nanonote-atusb.patch
4atmega32u2.patch
uart/avrdude/README
1# --- build instructions common for OpenWRT and Jlime -------------------------
2
3wget http://download.savannah.gnu.org/releases/avrdude/avrdude-5.10.tar.gz
4tar xfz avrdude-5.10.tar.gz
5cd avrdude-5.10
6
7quilt push -a
8
9aclocal
10automake
11
12# --- build instructions for OpenWRT ------------------------------------------
13
14./configure --prefix=/ --host=mipsel-openwrt-linux
15make
16# the joy of autocrap (we need this to generate avrdude.conf)
17./configure --prefix=/ --host=mipsel-openwrt-linux
18
19scp avrdude.conf ben:/etc/
20scp avrdude ben:/usr/bin/
21
22# --- build instructions for Jlime --------------------------------------------
23
24./configure --prefix=/ --host=mipsel-linux
25make </dev/null
26# the joy of autocrap (we need this to generate avrdude.conf)
27./configure --prefix=/ --host=mipsel-linux
28
29scp avrdude.conf jlime:/etc/
30scp avrdude jlime:/usr/bin/
uart/avrdude/patches/atmega32u2.patch
1Index: avrdude/avrdude-5.10/avrdude.conf.in
2===================================================================
3+++ avrdude/avrdude-5.10/avrdude.conf.in 2011-02-11 08:43:53.000000000 -0300
4@@ -13033,6 +13033,191 @@
5   ;
6
7 #------------------------------------------------------------
8+# ATmega32U2
9+#------------------------------------------------------------
10+
11+#
12+# This is a rough adaptation of the AT90USB162 definition. May contain all
13+# sorts of errors.
14+#
15+
16+part
17+ id = "m32u2";
18+ desc = "ATmega32U2";
19+ has_jtag = no;
20+ has_debugwire = yes;
21+ signature = 0x1e 0x95 0x8a;
22+ chip_erase_delay = 9000;
23+ reset = io;
24+ pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
25+ "x x x x x x x x x x x x x x x x";
26+ chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
27+ "x x x x x x x x x x x x x x x x";
28+ pagel = 0xD7;
29+ bs2 = 0xC6;
30+
31+ timeout = 200;
32+ stabdelay = 100;
33+ cmdexedelay = 25;
34+ synchloops = 32;
35+ bytedelay = 0;
36+ pollindex = 3;
37+ pollvalue = 0x53;
38+ predelay = 1;
39+ postdelay = 1;
40+ pollmethod = 1;
41+ pp_controlstack =
42+ 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
43+ 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
44+ 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
45+ 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
46+ hventerstabdelay = 100;
47+ progmodedelay = 0;
48+ latchcycles = 5;
49+ togglevtg = 1;
50+ poweroffdelay = 15;
51+ resetdelayms = 1;
52+ resetdelayus = 0;
53+ hvleavestabdelay = 15;
54+ chiperasepulsewidth = 0;
55+ chiperasepolltimeout = 10;
56+ programfusepulsewidth = 0;
57+ programfusepolltimeout = 5;
58+ programlockpulsewidth = 0;
59+ programlockpolltimeout = 5;
60+
61+ memory "eeprom"
62+ paged = no; /* leave this "no" */
63+ page_size = 4; /* for parallel programming */
64+ size = 1024;
65+ num_pages = 256;
66+ min_write_delay = 9000;
67+ max_write_delay = 9000;
68+ readback_p1 = 0x00;
69+ readback_p2 = 0x00;
70+ read = " 1 0 1 0 0 0 0 0",
71+ " 0 0 0 0 a11 a10 a9 a8",
72+ " a7 a6 a5 a4 a3 a2 a1 a0",
73+ " o o o o o o o o";
74+
75+ write = " 1 1 0 0 0 0 0 0",
76+ " 0 0 0 0 a11 a10 a9 a8",
77+ " a7 a6 a5 a4 a3 a2 a1 a0",
78+ " i i i i i i i i";
79+
80+ loadpage_lo = " 1 1 0 0 0 0 0 1",
81+ " 0 0 0 0 0 0 0 0",
82+ " 0 0 0 0 0 0 a1 a0",
83+ " i i i i i i i i";
84+
85+ writepage = " 1 1 0 0 0 0 1 0",
86+ " 0 0 0 0 a11 a10 a9 a8",
87+ " a7 a6 a5 a4 a3 a2 0 0",
88+ " x x x x x x x x";
89+
90+ mode = 0x41;
91+ delay = 20;
92+ blocksize = 4;
93+ readsize = 256;
94+ ;
95+
96+ memory "flash"
97+ paged = yes;
98+ size = 32768;
99+ page_size = 128;
100+ num_pages = 256;
101+ min_write_delay = 4500;
102+ max_write_delay = 4500;
103+ readback_p1 = 0x00;
104+ readback_p2 = 0x00;
105+ read_lo = " 0 0 1 0 0 0 0 0",
106+ "a15 a14 a13 a12 a11 a10 a9 a8",
107+ " a7 a6 a5 a4 a3 a2 a1 a0",
108+ " o o o o o o o o";
109+
110+ read_hi = " 0 0 1 0 1 0 0 0",
111+ "a15 a14 a13 a12 a11 a10 a9 a8",
112+ " a7 a6 a5 a4 a3 a2 a1 a0",
113+ " o o o o o o o o";
114+
115+ loadpage_lo = " 0 1 0 0 0 0 0 0",
116+ " x x x x x x x x",
117+ " x x a5 a4 a3 a2 a1 a0",
118+ " i i i i i i i i";
119+
120+ loadpage_hi = " 0 1 0 0 1 0 0 0",
121+ " x x x x x x x x",
122+ " x x a5 a4 a3 a2 a1 a0",
123+ " i i i i i i i i";
124+
125+ writepage = " 0 1 0 0 1 1 0 0",
126+ "a15 a14 a13 a12 a11 a10 a9 a8",
127+ " a7 a6 x x x x x x",
128+ " x x x x x x x x";
129+
130+ mode = 0x41;
131+ delay = 6;
132+ blocksize = 128;
133+ readsize = 256;
134+ ;
135+
136+ memory "lfuse"
137+ size = 1;
138+ write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
139+ "x x x x x x x x i i i i i i i i";
140+
141+ read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
142+ "x x x x x x x x o o o o o o o o";
143+ min_write_delay = 9000;
144+ max_write_delay = 9000;
145+ ;
146+
147+ memory "hfuse"
148+ size = 1;
149+ write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
150+ "x x x x x x x x i i i i i i i i";
151+
152+ read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
153+ "x x x x x x x x o o o o o o o o";
154+ min_write_delay = 9000;
155+ max_write_delay = 9000;
156+ ;
157+
158+ memory "efuse"
159+ size = 1;
160+ write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
161+ "x x x x x x x x i i i i i i i i";
162+
163+ read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
164+ "x x x x x x x x o o o o o o o o";
165+ min_write_delay = 9000;
166+ max_write_delay = 9000;
167+ ;
168+
169+ memory "lock"
170+ size = 1;
171+ read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
172+ "x x x x x x x x x x o o o o o o";
173+
174+ write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
175+ "x x x x x x x x 1 1 i i i i i i";
176+ min_write_delay = 9000;
177+ max_write_delay = 9000;
178+ ;
179+
180+ memory "calibration"
181+ size = 1;
182+ read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
183+ "0 0 0 0 0 0 0 0 o o o o o o o o";
184+ ;
185+ memory "signature"
186+ size = 3;
187+ read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
188+ "x x x x x x a1 a0 o o o o o o o o";
189+ ;
190+ ;
191+
192+#------------------------------------------------------------
193 # AT90USB82
194 #------------------------------------------------------------
195 # Changes against AT90USB162 (beside IDs)
uart/avrdude/patches/nanonote-atusb.patch
1Index: avrdude/avrdude-5.10/avrdude.conf.in
2===================================================================
3+++ avrdude/avrdude-5.10/avrdude.conf.in 2011-02-04 14:21:48.000000000 -0300
4@@ -615,6 +615,17 @@
5   miso = 1;
6 ;
7
8+programmer
9+ id = "nanonote_atusb";
10+ desc = "NanoNote 8:10 card adapter for ATUSB";
11+ type = nanonote;
12+ reset = 1;
13+ sck = 8;
14+ mosi = 7;
15+ miso = 6;
16+ pgmled = 2;
17+;
18+
19 @HAVE_PARPORT_BEGIN@ Inclusion of the following depends on --enable-parport
20 # Parallel port programmers.
21
uart/avrdude/patches/nanonote-uart.patch
1Index: avrdude/avrdude-5.10/avrdude.conf.in
2===================================================================
3+++ avrdude/avrdude-5.10/avrdude.conf.in 2011-02-04 17:26:07.000000000 -0300
4@@ -592,6 +592,29 @@
5   type = avr910;
6 ;
7
8+#
9+# 8:10 card pin assignment:
10+#
11+# DAT1 1
12+# DAT0 2
13+# VSS -
14+# CLK - (reserved for clock output)
15+# VDD -
16+# CMD 5
17+# DAT3 7
18+# DAT2 8
19+#
20+
21+programmer
22+ id = "nanonote_uart";
23+ desc = "NanoNote UART 8:10 card";
24+ type = nanonote;
25+ reset = 8;
26+ sck = 2;
27+ mosi = 7;
28+ miso = 1;
29+;
30+
31 @HAVE_PARPORT_BEGIN@ Inclusion of the following depends on --enable-parport
32 # Parallel port programmers.
33
uart/avrdude/patches/nanonote.patch
1Index: avrdude/avrdude-5.10/Makefile.am
2===================================================================
3+++ avrdude/avrdude-5.10/Makefile.am 2011-02-15 00:16:52.000000000 -0300
4@@ -111,6 +111,8 @@
5     lists.c \
6     lists.h \
7     my_ddk_hidsdi.h \
8+ nanonote.c \
9+ nanonote.h \
10     par.c \
11     par.h \
12     pgm.c \
13Index: avrdude/avrdude-5.10/config_gram.y
14===================================================================
15+++ avrdude/avrdude-5.10/config_gram.y 2011-02-15 00:16:52.000000000 -0300
16@@ -48,6 +48,7 @@
17 #include "avr.h"
18 #include "jtagmkI.h"
19 #include "jtagmkII.h"
20+#include "nanonote.h"
21
22 #if defined(WIN32NATIVE)
23 #define strtok_r( _s, _sep, _lasts ) \
24@@ -99,6 +100,7 @@
25 %token K_DRAGON_JTAG
26 %token K_DRAGON_PDI
27 %token K_DRAGON_PP
28+%token K_NANONOTE
29 %token K_STK500_DEVCODE
30 %token K_AVR910_DEVCODE
31 %token K_EEPROM
32@@ -551,6 +553,12 @@
33     }
34   } |
35
36+ K_TYPE TKN_EQUAL K_NANONOTE {
37+ {
38+ nanonote_initpgm(current_prog);
39+ }
40+ } |
41+
42   K_DESC TKN_EQUAL TKN_STRING {
43     strncpy(current_prog->desc, $3->value.string, PGM_DESCLEN);
44     current_prog->desc[PGM_DESCLEN-1] = 0;
45Index: avrdude/avrdude-5.10/lexer.l
46===================================================================
47+++ avrdude/avrdude-5.10/lexer.l 2011-02-15 00:16:52.000000000 -0300
48@@ -164,6 +164,7 @@
49 min_write_delay { yylval=NULL; return K_MIN_WRITE_DELAY; }
50 miso { yylval=NULL; return K_MISO; }
51 mosi { yylval=NULL; return K_MOSI; }
52+nanonote { yylval=NULL; return K_NANONOTE; }
53 num_banks { yylval=NULL; return K_NUM_PAGES; }
54 num_pages { yylval=NULL; return K_NUM_PAGES; }
55 nvm_base { yylval=NULL; return K_NVM_BASE; }
56Index: avrdude/avrdude-5.10/nanonote.c
57===================================================================
58+++ avrdude/avrdude-5.10/nanonote.c 2011-02-15 00:20:23.000000000 -0300
59@@ -0,0 +1,290 @@
60+/*
61+ * avrdude - A Downloader/Uploader for AVR device programmers
62+ * Copyright (C) 2000, 2001, 2002, 2003 Brian S. Dean <bsd@bsdhome.com>
63+ * Copyright (C) 2005 Michael Holzt <kju-avr@fqdn.org>
64+ * Copyright (C) 2006 Joerg Wunsch <j@uriah.heep.sax.de>
65+ *
66+ * This program is free software; you can redistribute it and/or modify
67+ * it under the terms of the GNU General Public License as published by
68+ * the Free Software Foundation; either version 2 of the License, or
69+ * (at your option) any later version.
70+ *
71+ * This program is distributed in the hope that it will be useful,
72+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
73+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
74+ * GNU General Public License for more details.
75+ *
76+ * You should have received a copy of the GNU General Public License
77+ * along with this program; if not, write to the Free Software
78+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
79+ */
80+
81+/*
82+ * Posix serial bitbanging interface for avrdude.
83+ */
84+
85+
86+#include <stdint.h>
87+#include <stdlib.h>
88+#include <stdio.h>
89+#include <unistd.h>
90+#include <string.h>
91+#include <fcntl.h>
92+#include <sys/mman.h>
93+
94+#include "avr.h"
95+#include "pgm.h"
96+#include "bitbang.h"
97+
98+
99+
100+static volatile void *mem;
101+
102+
103+#define POWER_OFF 3, 2 /* PD02, drive low to enable power */
104+#define CMD 3, 8 /* PD08, CMD */
105+#define CLK 3, 9 /* PD09, CLK */
106+#define DAT0 3, 10 /* PD10, DAT0 */
107+#define DAT1 3, 11 /* PD11, DAT1 */
108+#define DAT2 3, 12 /* PD12, DAT2 */
109+#define DAT3 3, 13 /* PD13, DAT3 */
110+
111+
112+static struct {
113+ unsigned port;
114+ unsigned bit;
115+} pin_map[] = {
116+ { 0, 0}, /* 0: not assigned */
117+ { 3, 11 }, /* 1: PD11, DAT1 */
118+ { 3, 10 }, /* 2: PD12, DAT0 */
119+ { 0, 0 }, /* 3: VSS */
120+ { 0, 0 }, /* 4: PD09, CLK (reserved) */
121+ { 0, 0 }, /* 5: VDD */
122+ { 3, 8 }, /* 6: PD08, CMD */
123+ { 3, 13 }, /* 7: PD13, DAT3 */
124+ { 3, 12 } /* 8: PD13, DAT2 */
125+};
126+
127+
128+#define BASE 0x10010000
129+
130+#define REG(off) (*(volatile uint32_t *) (mem+(off)))
131+
132+#define port_pin(port) REG(port*0x100)
133+#define port_dats(port) REG(port*0x100+0x14)
134+#define port_datc(port) REG(port*0x100+0x18)
135+#define port_func(port) REG(port*0x100+0x48)
136+#define port_dirs(port) REG(port*0x100+0x64)
137+#define port_dirc(port) REG(port*0x100+0x68)
138+
139+
140+static inline void gpio_high(unsigned port, unsigned bit)
141+{
142+ port_dats(port) = 1 << bit;
143+}
144+
145+
146+static void gpio_low(unsigned port, unsigned bit)
147+{
148+ port_datc(port) = 1 << bit;
149+}
150+
151+
152+static void gpio_set(unsigned port, unsigned bit, int value)
153+{
154+ if (value)
155+ gpio_high(port, bit);
156+ else
157+ gpio_low(port, bit);
158+}
159+
160+
161+static int gpio_get(unsigned port, unsigned bit)
162+{
163+ return (port_pin(port) >> bit) & 1;
164+}
165+
166+
167+static void gpio_output(unsigned port, unsigned bit)
168+{
169+ port_dirs(port) = 1 << bit;
170+}
171+
172+
173+static void gpio_input(unsigned port, unsigned bit)
174+{
175+ port_dirc(port) = 1 << bit;
176+}
177+
178+
179+static int nanonote_setpin(PROGRAMMER *pgm, int pin, int value)
180+{
181+ if (pin & PIN_INVERSE) {
182+ value = !value;
183+ pin &= PIN_MASK;
184+ }
185+
186+ if (pin < 1 || pin >= sizeof(pin_map)/sizeof(*pin_map))
187+ return -1;
188+ if (!pin_map[pin].port)
189+ return -1;
190+
191+#if 0
192+fprintf(stderr, "pin %d (%u, %u) = %d\n",
193+pin, pin_map[pin].port, pin_map[pin].bit, value);
194+#endif
195+ gpio_set(pin_map[pin].port, pin_map[pin].bit, value);
196+
197+ /*
198+ * We get unstable results with values <= 16 but stable results
199+ * with 17 and above.
200+ */
201+ bitbang_delay(pgm->ispdelay+20);
202+
203+ return 0;
204+}
205+
206+
207+static int nanonote_getpin(PROGRAMMER *pgm, int pin)
208+{
209+ int invert = 0;
210+ int v;
211+
212+ if (pin & PIN_INVERSE) {
213+ invert = 1;
214+ pin &= PIN_MASK;
215+ }
216+
217+ if (pin < 1 || pin >= sizeof(pin_map)/sizeof(*pin_map))
218+ return -1;
219+ if (!pin_map[pin].port)
220+ return -1;
221+
222+ gpio_input(pin_map[pin].port, pin_map[pin].bit); /* @@@ hack */
223+ v = gpio_get(pin_map[pin].port, pin_map[pin].bit);
224+#if 0
225+fprintf(stderr, "pin %d (%u, %u): %d\n",
226+pin, pin_map[pin].port, pin_map[pin].bit, v);
227+#endif
228+ return pin & PIN_INVERSE ? !v : v;
229+}
230+
231+
232+static int nanonote_highpulsepin(PROGRAMMER *pgm, int pin)
233+{
234+ return -1;
235+}
236+
237+
238+static void nanonote_display(PROGRAMMER *pgm, const char *p)
239+{
240+ /* nothing */
241+}
242+
243+
244+static void misc_high(PROGRAMMER *pgm)
245+{
246+ gpio_high(POWER_OFF);
247+ gpio_high(DAT1);
248+ gpio_high(DAT0);
249+ gpio_high(CMD);
250+ gpio_high(DAT3);
251+ gpio_high(DAT2);
252+}
253+
254+
255+static void nanonote_enable(PROGRAMMER *pgm)
256+{
257+ misc_high(pgm);
258+ /* @@@ set CLK to function and output clock */
259+}
260+
261+
262+static void nanonote_disable(PROGRAMMER *pgm)
263+{
264+ misc_high(pgm);
265+ /* @@@ set CLK to GPIO */
266+ gpio_high(CLK);
267+}
268+
269+
270+static void nanonote_powerup(PROGRAMMER *pgm)
271+{
272+ gpio_low(POWER_OFF);
273+}
274+
275+
276+static void nanonote_powerdown(PROGRAMMER *pgm)
277+{
278+ gpio_input(DAT0);
279+ gpio_input(CLK);
280+ gpio_input(CMD);
281+ gpio_input(DAT3);
282+ gpio_input(DAT2);
283+ gpio_input(DAT1);
284+ gpio_high(POWER_OFF);
285+}
286+
287+
288+static int nanonote_open(PROGRAMMER *pgm, char *port)
289+{
290+ bitbang_check_prerequisites(pgm);
291+
292+ pgm->fd.ifd = open("/dev/mem", O_RDWR | O_SYNC);
293+ if (pgm->fd.ifd < 0) {
294+ perror("/dev/mem");
295+ return -1;
296+ }
297+ mem = mmap(NULL, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED,
298+ pgm->fd.ifd, BASE);
299+ if (mem == MAP_FAILED) {
300+ perror("mmap");
301+ return -1;
302+ }
303+
304+ gpio_output(POWER_OFF);
305+ gpio_output(DAT0);
306+ gpio_output(CLK);
307+ gpio_output(CMD);
308+ gpio_output(DAT3);
309+ gpio_output(DAT2);
310+ gpio_output(DAT1);
311+
312+ nanonote_disable(pgm);
313+
314+ return 0;
315+}
316+
317+
318+static void nanonote_close(PROGRAMMER *pgm)
319+{
320+ if (pgm->fd.ifd != -1)
321+ close(pgm->fd.ifd);
322+}
323+
324+
325+void nanonote_initpgm(PROGRAMMER *pgm)
326+{
327+ strcpy(pgm->type, "NANONOTE");
328+
329+ pgm->rdy_led = bitbang_rdy_led;
330+ pgm->err_led = bitbang_err_led;
331+ pgm->pgm_led = bitbang_pgm_led;
332+ pgm->vfy_led = bitbang_vfy_led;
333+ pgm->initialize = bitbang_initialize;
334+ pgm->display = nanonote_display;
335+ pgm->enable = nanonote_enable;
336+ pgm->disable = nanonote_disable;
337+ pgm->powerup = nanonote_powerup;
338+ pgm->powerdown = nanonote_powerdown;
339+ pgm->program_enable = bitbang_program_enable;
340+ pgm->chip_erase = bitbang_chip_erase;
341+ pgm->cmd = bitbang_cmd;
342+ pgm->open = nanonote_open;
343+ pgm->close = nanonote_close;
344+ pgm->setpin = nanonote_setpin;
345+ pgm->getpin = nanonote_getpin;
346+ pgm->highpulsepin = nanonote_highpulsepin;
347+ pgm->read_byte = avr_read_byte_default;
348+ pgm->write_byte = avr_write_byte_default;
349+}
350Index: avrdude/avrdude-5.10/nanonote.h
351===================================================================
352+++ avrdude/avrdude-5.10/nanonote.h 2011-02-15 00:16:52.000000000 -0300
353@@ -0,0 +1,6 @@
354+#ifndef nanonote_h
355+#define nanonote_h
356+
357+void nanonote_initpgm(PROGRAMMER *pgm);
358+
359+#endif
uart/avrdude/patches/series
1nanonote.patch
2nanonote-uart.patch
3nanonote-atusb.patch
4atmega32u2.patch

Archive Download the corresponding diff file

Branches:
master



interactive