Commit 53176ee5 authored by bsam's avatar bsam
Browse files

AVRDUDE - AVR Downloader/UploaDEr - is a program for updating the

flash, eeprom, and fuse bit memories of Atmel AVR microcontrollers.
It operates with several programmers including STK500 and most
directly connect parallel port style programmers.

WWW: http://www.nongnu.org/avrdude/

PR:		218234
Submitted by:	bsdports@kyle-evans.net
parent 615379d5
......@@ -99,6 +99,7 @@
SUBDIR += apr2
SUBDIR += arcanist
SUBDIR += arduino
SUBDIR += arduino-avrdude
SUBDIR += arduino-builder
SUBDIR += arduino-core
SUBDIR += arduino-ctags
......
# $FreeBSD$
PORTNAME= avrdude
PORTVERSION= 6.3
CATEGORIES= devel
MASTER_SITES= SAVANNAH/avrdude
PKGNAMEPREFIX= arduino-
MAINTAINER= bsdports@kyle-evans.net
COMMENT= Program for programming the on-chip memory of Atmel AVR Arduino CPUs
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/COPYING
LIB_DEPENDS= libftdi1.so:devel/libftdi1
GNU_CONFIGURE= yes
USES= libtool localbase readline
USE_LDCONFIG= yes
INSTALL_TARGET= install-strip
MAKE_JOBS_UNSAFE= yes
MAKE_ENV+= PKGNAMEPREFIX=${PKGNAMEPREFIX}
CONFIGURE_ARGS+= --disable-shared --disable-static
PLIST_FILES= bin/arduino-avrdude \
etc/arduino-avrdude.conf \
man/man1/arduino-avrdude.1.gz
post-patch:
@${REINPLACE_CMD} -e 's|-lusb-1.0|-lusb|g' ${WRKSRC}/configure
post-configure:
@${MV} ${WRKSRC}/${PORTNAME}.1 ${WRKSRC}/${PKGNAMEPREFIX}${PORTNAME}.1
@${MV} ${WRKSRC}/${PORTNAME}.conf ${WRKSRC}/${PKGNAMEPREFIX}${PORTNAME}.conf
post-install:
@${RM} ${STAGEDIR}${PREFIX}/include/lib${PORTNAME}.h
@${RM} ${STAGEDIR}${PREFIX}/lib/lib${PORTNAME}.a
.include <bsd.port.mk>
TIMESTAMP = 1490880510
SHA256 (avrdude-6.3.tar.gz) = 0f9f731b6394ca7795b88359689a7fa1fba818c6e1d962513eb28da670e0a196
SIZE (avrdude-6.3.tar.gz) = 909744
--- Makefile.in.orig 2017-03-30 13:30:41 UTC
+++ Makefile.in
@@ -115,7 +115,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-bin_PROGRAMS = avrdude$(EXEEXT)
+bin_PROGRAMS = $(PKGNAMEPREFIX)avrdude$(EXEEXT)
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -540,7 +540,7 @@ EXTRA_DIST = \
ChangeLog-2011 \
ChangeLog-2012 \
ChangeLog-2013 \
- avrdude.1 \
+ $(PKGNAMEPREFIX)avrdude.1 \
avrdude.spec \
bootstrap
@@ -664,8 +664,8 @@ avrdude_SOURCES = \
term.c \
term.h
-man_MANS = avrdude.1
-sysconf_DATA = avrdude.conf
+man_MANS = $(PKGNAMEPREFIX)avrdude.1
+sysconf_DATA = $(PKGNAMEPREFIX)avrdude.conf
ACLOCAL_AMFLAGS = -I m4
all: $(BUILT_SOURCES) ac_cfg.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -823,8 +823,8 @@ clean-binPROGRAMS:
echo " rm -f" $$list; \
rm -f $$list
-avrdude$(EXEEXT): $(avrdude_OBJECTS) $(avrdude_DEPENDENCIES) $(EXTRA_avrdude_DEPENDENCIES)
- @rm -f avrdude$(EXEEXT)
+$(PKGNAMEPREFIX)avrdude$(EXEEXT): $(avrdude_OBJECTS) $(avrdude_DEPENDENCIES) $(EXTRA_avrdude_DEPENDENCIES)
+ @rm -f $(PKGNAMEPREFIX)avrdude$(EXEEXT)
$(AM_V_CCLD)$(avrdude_LINK) $(avrdude_OBJECTS) $(avrdude_LDADD) $(LIBS)
mostlyclean-compile:
@@ -2490,14 +2490,14 @@ dist-hook:
install-exec-local: backup-avrdude-conf
distclean-local:
- rm -f avrdude.conf
+ rm -f $(PKGNAMEPREFIX)avrdude.conf
# This will get run before the config file is installed.
backup-avrdude-conf:
- @echo "Backing up avrdude.conf in ${DESTDIR}${sysconfdir}"
- @if test -e ${DESTDIR}${sysconfdir}/avrdude.conf; then \
- cp -pR ${DESTDIR}${sysconfdir}/avrdude.conf \
- ${DESTDIR}${sysconfdir}/avrdude.conf.bak; \
+ @echo "Backing up ${PKGNAMEPREFIX}avrdude.conf in ${DESTDIR}${sysconfdir}"
+ @if test -e ${DESTDIR}${sysconfdir}/$(PKGNAMEPREFIX)avrdude.conf; then \
+ cp -pR ${DESTDIR}${sysconfdir}/$(PKGNAMEPREFIX)avrdude.conf \
+ ${DESTDIR}${sysconfdir}/$(PKGNAMEPREFIX)avrdude.conf.bak; \
fi
# Tell versions [3.59,3.63) of GNU make to not export all variables.
--- avr.c.orig 2017-03-30 13:30:41 UTC
+++ avr.c
@@ -1058,7 +1058,40 @@ int avr_signature(PROGRAMMER * pgm, AVRPART * p)
return 0;
}
+uint8_t get_fuse_bitmask(AVRMEM * m) {
+ uint8_t bitmask_r = 0;
+ uint8_t bitmask_w = 0;
+ int i, j;
+ if (m->size > 1) {
+ // not a fuse, compare bytes directly
+ return 0xFF;
+ }
+
+ for (i=0; i<AVR_OP_MAX; i++) {
+ if (m->op[i] && i == AVR_OP_READ) {
+ for (j=7; j>=0; j--) {
+ bitmask_r |= (m->op[i]->bit[j].type != AVR_CMDBIT_IGNORE) << j;
+ }
+ }
+ if (m->op[i] && i == AVR_OP_WRITE) {
+ for (j=7; j>=0; j--) {
+ bitmask_w |= (m->op[i]->bit[j].type != AVR_CMDBIT_VALUE &&
+ m->op[i]->bit[j].type != AVR_CMDBIT_IGNORE) << j;
+ }
+ }
+ }
+ return bitmask_r & bitmask_w;
+}
+
+int compare_memory_masked(AVRMEM * m, unsigned char buf1, unsigned char buf2) {
+ uint8_t bitmask = 0xFF;
+ if(m) {
+ bitmask = get_fuse_bitmask(m);
+ }
+ return ((buf1 & bitmask) != (buf2 & bitmask));
+}
+
/*
* Verify the memory buffer of p with that of v. The byte range of v,
* may be a subset of p. The byte range of p should cover the whole
@@ -1104,11 +1137,18 @@ int avr_verify(AVRPART * p, AVRPART * v, char * memtyp
for (i=0; i<size; i++) {
if ((b->tags[i] & TAG_ALLOCATED) != 0 &&
buf1[i] != buf2[i]) {
- avrdude_message(MSG_INFO, "%s: verification error, first mismatch at byte 0x%04x\n"
- "%s0x%02x != 0x%02x\n",
- progname, i,
- progbuf, buf1[i], buf2[i]);
- return -1;
+ if(compare_memory_masked(a , buf1[i], buf2[i])) {
+ avrdude_message(MSG_INFO, "%s: verification error, first mismatch at byte 0x%04x\n"
+ "%s0x%02x != 0x%02x\n",
+ progname, i,
+ progbuf, buf1[i], buf2[i]);
+ return -1;
+ } else {
+ avrdude_message(MSG_INFO, "%s: WARNING: invalid value for unused bits in fuse \"%s\", should be set to 1 according to datasheet\n"
+ "This behaviour is deprecated and will result in an error in future version\n"
+ "You probably want to use 0x%02x instead of 0x%02x (double check with your datasheet first).\n",
+ progname, memtype, buf1[i], buf2[i]);
+ }
}
}
--- avrdude.conf.in.orig 2017-03-30 13:30:41 UTC
+++ avrdude.conf.in
@@ -874,6 +874,24 @@ programmer
usbpid = 0x0c9f;
;
+ programmer
+ id = "arduinoisp";
+ desc = "Arduino ISP Programmer";
+ type = "usbtiny";
+ connection_type = usb;
+ usbvid = 0x2341;
+ usbpid = 0x0049;
+;
+
+ programmer
+ id = "arduinoisporg";
+ desc = "Arduino ISP Programmer";
+ type = "usbtiny";
+ connection_type = usb;
+ usbvid = 0x2A03;
+ usbpid = 0x0049;
+;
+
programmer
id = "butterfly";
desc = "Atmel Butterfly Development Board";
@@ -6530,6 +6548,11 @@ part
"x x x x x x x x i i i i i i i i";
;
+ memory "efuse"
+ size = 0;
+ ;
+
+
memory "lock"
size = 1;
min_write_delay = 2000;
@@ -9747,7 +9770,7 @@ part
avr910_devcode = 0x20;
signature = 0x1e 0x93 0x0b;
reset = io;
- chip_erase_delay = 4500;
+ chip_erase_delay = 400000;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
"x x x x x x x x x x x x x x x x";
@@ -9792,8 +9815,8 @@ part
size = 512;
paged = no;
page_size = 4;
- min_write_delay = 4000;
- max_write_delay = 4500;
+ min_write_delay = 30000;
+ max_write_delay = 30000;
readback_p1 = 0xff;
readback_p2 = 0xff;
read = "1 0 1 0 0 0 0 0 0 0 0 x x x x a8",
@@ -9813,7 +9836,7 @@ part
" x x x x x x x x";
mode = 0x41;
- delay = 6;
+ delay = 12;
blocksize = 4;
readsize = 256;
;
--- bitbang.c.orig 2017-03-30 13:30:41 UTC
+++ bitbang.c
@@ -331,7 +331,7 @@ int bitbang_cmd(PROGRAMMER * pgm, const unsigned char
res[i] = bitbang_txrx(pgm, cmd[i]);
}
- if(verbose >= 2)
+ if(verbose > 4)
{
avrdude_message(MSG_NOTICE2, "bitbang_cmd(): [ ");
for(i = 0; i < 4; i++)
--- libavrdude.h.orig 2017-03-30 13:30:41 UTC
+++ libavrdude.h
@@ -337,6 +337,8 @@ typedef void (*walk_avrparts_cb)(const char *name, con
void *cookie);
void walk_avrparts(LISTID avrparts, walk_avrparts_cb cb, void *cookie);
void sort_avrparts(LISTID avrparts);
+uint8_t get_fuse_bitmask(AVRMEM * m);
+int compare_memory_masked(AVRMEM * m, unsigned char buf1, unsigned char buf2);
#ifdef __cplusplus
}
#endif
--- main.c.orig 2017-03-30 13:30:41 UTC
+++ main.c
@@ -1264,8 +1264,10 @@ int main(int argc, char * argv [])
}
}
+ AVRMEM * m;
+ m = avr_locate_mem(p, "fuse");
/* Now check what fuses are against what they should be */
- if (safemodeafter_fuse != safemode_fuse) {
+ if (compare_memory_masked(m, safemodeafter_fuse, safemode_fuse)) {
fuses_updated = 1;
avrdude_message(MSG_INFO, "%s: safemode: fuse changed! Was %x, and is now %x\n",
progname, safemode_fuse, safemodeafter_fuse);
@@ -1293,7 +1295,8 @@ int main(int argc, char * argv [])
}
/* Now check what fuses are against what they should be */
- if (safemodeafter_lfuse != safemode_lfuse) {
+ m = avr_locate_mem(p, "lfuse");
+ if (compare_memory_masked(m, safemodeafter_lfuse, safemode_lfuse)) {
fuses_updated = 1;
avrdude_message(MSG_INFO, "%s: safemode: lfuse changed! Was %x, and is now %x\n",
progname, safemode_lfuse, safemodeafter_lfuse);
@@ -1321,7 +1324,8 @@ int main(int argc, char * argv [])
}
/* Now check what fuses are against what they should be */
- if (safemodeafter_hfuse != safemode_hfuse) {
+ m = avr_locate_mem(p, "hfuse");
+ if (compare_memory_masked(m, safemodeafter_hfuse, safemode_hfuse)) {
fuses_updated = 1;
avrdude_message(MSG_INFO, "%s: safemode: hfuse changed! Was %x, and is now %x\n",
progname, safemode_hfuse, safemodeafter_hfuse);
@@ -1346,7 +1350,8 @@ int main(int argc, char * argv [])
}
/* Now check what fuses are against what they should be */
- if (safemodeafter_efuse != safemode_efuse) {
+ m = avr_locate_mem(p, "efuse");
+ if (compare_memory_masked(m, safemodeafter_efuse, safemode_efuse)) {
fuses_updated = 1;
avrdude_message(MSG_INFO, "%s: safemode: efuse changed! Was %x, and is now %x\n",
progname, safemode_efuse, safemodeafter_efuse);
AVRDUDE - AVR Downloader/UploaDEr - is a program for updating the
flash, eeprom, and fuse bit memories of Atmel AVR microcontrollers.
It operates with several programmers including STK500 and most
directly connect parallel port style programmers.
WWW: http://www.nongnu.org/avrdude/
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment