]> git.droids-corp.org - aversive.git/commitdiff
prog_fuse.sh: undefined bits must be set to 1 instead of 0
authorOlivier Matz <zer0@droids-corp.org>
Fri, 17 May 2013 19:36:42 +0000 (21:36 +0200)
committerOlivier Matz <zer0@droids-corp.org>
Fri, 17 May 2013 19:36:42 +0000 (21:36 +0200)
Signed-off-by: Olivier Matz <zer0@droids-corp.org>
config/prog_fuses.sh

index 60bd6515d746c415dbb9bf29af05e622caef93b6..8db50901d71407f61e405ad8393a2f13191b7809 100755 (executable)
@@ -139,9 +139,9 @@ CANNOT_READ=0
 for f in ${FUSE_LIST}
 do
        rm -f $f 2> /dev/null
-       echo 0x00 > ${f}_new
-       ${AVRDUDE} ${DELAY} -p ${MCU} -P `echo ${AVRDUDE_PORT} | sed 's,",,g'` \
-               -c ${AVRDUDE_PROGRAMMER} -U ${f}:r:${f}:i
+       echo 0xff > ${f}_new # default for each bit is 1 (unprogrammed)
+       ${AVRDUDE} ${DELAY} -p ${MCU} -P `echo ${AVRDUDE_PORT} | \
+               sed 's,",,g'` -c ${AVRDUDE_PROGRAMMER} -U ${f}:r:${f}:i
        if [ ! -f $f ]; then
                CANNOT_READ=1
        fi
@@ -210,10 +210,11 @@ do
                1)
                        NEW_VAL=$((1 << $BIT | `cat ${FUSE}_new`))
                        printf "0x%x\n" ${NEW_VAL} > ${FUSE}_new
-                       # <<$ fix syntax coloration
                        echo "    get 1 (unprogrammed)"
                        ;;
                0)
+                       NEW_VAL=$((~(1 << $BIT) & `cat ${FUSE}_new`))
+                       printf "0x%x\n" ${NEW_VAL} > ${FUSE}_new
                        echo "    get 0 (programmed)"
                        ;;
                *)