#!/bin/sh set -e badusage () { odyssey || true echo >&2 'usage: odyssey-train [|all] operation [filename]' echo >&2 exit 1 } which=$1 tpps="train-pic-prog-select -i${TRAIN_PPWDATA_SEL_BIT-0}" case "$which" in all) $tpps 0-55 whichconfig=all echo "Selected $which" ;; [0-9]|[0-9][0-9]) $tpps $which whichconfig=single echo "Selected #$which" ;; comb-*) $tpps ${which#comb-} whichconfig=all echo "Trying $which" ;; *) badusage ;; esac shift echo operation=$1 case "$operation" in check|write|update|read|verify|erase|blankcheck) chiptype=PIC18F458 ;; init|test) chiptype='' ;; *) badusage ;; esac export HOME=/etc/odyssey exec odyssey -f $whichconfig $chiptype "$@"