Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions stm32CubeProg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ERASE=
# Optional for Serial
RTS=
DTR=
PARITY=EVEN
# Mandatory for DFU
VID=
PID=
Expand All @@ -42,6 +43,7 @@ usage() {
Optional:
-r, --rts <low/high> polarity of RTS signal ('low' by default)
-d, --dtr <low/high> polarity of DTR signal
--parity <none/even/odd> parity bit configuration ('even' by default)

Specific options for DFU protocol:
Mandatory:
Expand Down Expand Up @@ -123,7 +125,7 @@ if [ -n "${GNU_GETOPT}" ]; then
exit 1
fi
else
if ! options=$(getopt -a -o a:hi:m:ef:o:c:r:s:d:v:p: --long address:,help,interface:,mode:,erase,file:,start:,offset:,com:,rts:,dtr:,vid:,pid: -- "$@"); then
if ! options=$(getopt -a -o a:hi:m:ef:o:c:r:s:d:v:p: --long address:,help,interface:,mode:,erase,file:,start:,offset:,com:,rts:,dtr:,vid:,pid:,parity: -- "$@"); then
echo "Terminating..." >&2
exit 1
fi
Expand Down Expand Up @@ -185,6 +187,10 @@ while true; do
PID=$2
shift 2
;;
--parity)
PARITY=$(echo "$2" | tr '[:lower:]' '[:upper:]')
shift 2
;;
--)
shift
break
Expand Down Expand Up @@ -240,7 +246,11 @@ case "${INTERFACE}" in
exit 1
fi
fi
${STM32CP_CLI} --connect port="${PORT}" "${RTS}" "${DTR}" "${ERASE}" --quietMode --download "${FILEPATH}" "${ADDRESS}" --start "${START}"
if [ "$PARITY" != "NONE" ] && [ "$PARITY" != "EVEN" ] && [ "$PARITY" != "ODD" ]; then
echo "Wrong parity value waiting none, even or odd instead of ${PARITY}" >&2
exit 1
fi
${STM32CP_CLI} --connect port="${PORT}" P="${PARITY}" "${RTS}" "${DTR}" "${ERASE}" --quietMode --download "${FILEPATH}" "${ADDRESS}" --start "${START}"
;;
jlink)
${STM32CP_CLI} --connect port=JLINK ap=0 "${ERASE}" --quietMode --download "${FILEPATH}" "${ADDRESS}" --start "${START}"
Expand Down