Update stm32CubeProg scripts

All trailing arguments will be passed to the STM32CubeProgrammer

Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
This commit is contained in:
Frederic.Pillon 2019-05-15 08:35:14 +02:00
parent 0a5abb3fe5
commit 3d52d4c03e
3 changed files with 52 additions and 46 deletions

View file

@ -22,12 +22,15 @@ usage()
echo "## 2: DFU"
echo "## file_path: file path name to be downloaded: (bin, hex)"
echo "## Options:"
echo "## For SWD: -rst"
echo "## -rst: Reset system (default)"
echo "## For Serial: <com_port> -s"
echo "## com_port: serial identifier. Ex: /dev/ttyS0"
echo "## -s: start automatically"
echo "## For DFU: none"
echo "## For SWD and DFU: no mandatory options"
echo "## For Serial: <com_port>"
echo "## com_port: serial identifier (mandatory). Ex: /dev/ttyS0"
echo "##"
echo "## Note: all trailing arguments will be passed to the $STM32CP_CLI"
echo "## They have to be valid commands for STM32 MCU"
echo "## Ex: -g: Run the code at the specified address"
echo "## -rst: Reset system"
echo "## -s: start automatically (optional)"
echo "############################################################"
exit $1
}
@ -66,28 +69,26 @@ case $1 in
0)
PORT='SWD'
MODE='mode=UR'
if [ $# -lt 3 ]; then
OPTS=-rst
else
OPTS=$3
fi;;
shift 2;;
1)
if [ $# -lt 3 ]; then
usage 3
else
PORT=$3
if [ $# -gt 3 ]; then
shift 3
OPTS="$@"
fi
shift 3
fi;;
2)
PORT='USB1';;
PORT='USB1'
shift 2;;
*)
echo "Protocol unknown!"
usage 4;;
esac
if [ $# -gt 0 ]; then
OPTS="$@"
fi
${STM32CP_CLI} -c port=${PORT} ${MODE} -q -d ${FILEPATH} ${ADDRESS} ${OPTS}
exit 0

View file

@ -21,12 +21,15 @@ usage()
echo "## 2: DFU"
echo "## file_path: file path name to be downloaded: (bin, hex)"
echo "## Options:"
echo "## For SWD: -rst"
echo "## -rst: Reset system (default)"
echo "## For Serial: <com_port> -s"
echo "## com_port: serial identifier. Ex: /dev/ttyS0"
echo "## -s: start automatically"
echo "## For DFU: none"
echo "## For SWD and DFU: no mandatory options"
echo "## For Serial: <com_port>"
echo "## com_port: serial identifier (mandatory). Ex: /dev/ttyS0"
echo "##"
echo "## Note: all trailing arguments will be passed to the $STM32CP_CLI"
echo "## They have to be valid commands for STM32 MCU"
echo "## Ex: -g: Run the code at the specified address"
echo "## -rst: Reset system"
echo "## -s: start automatically (optional)"
echo "############################################################"
exit $1
}
@ -65,28 +68,26 @@ case $1 in
0)
PORT='SWD'
MODE='mode=UR'
if [ $# -lt 3 ]; then
OPTS=-rst
else
OPTS=$3
fi;;
shift 2;;
1)
if [ $# -lt 3 ]; then
usage 3
else
PORT=$3
if [ $# -gt 3 ]; then
shift 3
OPTS="$@"
fi
shift 3
fi;;
2)
PORT='USB1';;
PORT='USB1'
shift 2;;
*)
echo "Protocol unknown!"
usage 4;;
esac
if [ $# -gt 0 ]; then
OPTS="$@"
fi
${STM32CP_CLI} -c port=${PORT} ${MODE} -q -d ${FILEPATH} ${ADDRESS} ${OPTS}
exit 0

View file

@ -39,22 +39,23 @@ goto :usage
:SWD
set PORT=SWD
set MODE=mode=UR
if "%~3"=="" (set OPTS=-rst) else (set OPTS=%3)
goto :prog
goto :opt
:SERIAL
if "%~3"=="" set ERROR=3 & goto :usage
set PORT=%~3
if "%~4"=="" goto :prog
shift
shift
shift
set OPTS=%*
goto :prog
goto :opt
:DFU
set PORT=USB1
goto :opt
:opt
shift
shift
if "%~1"=="" goto :prog
set OPTS=%*
goto :prog
:prog
@ -70,10 +71,13 @@ exit 0
echo 2: DFU
echo file_path: file path name to be downloaded: (bin, hex)
echo Options:
echo For SWD: -rst
echo -rst: Reset system (default)
echo For Serial: ^<com_port^> -s
echo com_port: serial identifier. Ex: /dev/ttyS0
echo -s: start automatically
echo For DFU: none
echo For SWD and DFU: no mandatory options
echo For Serial: ^<com_port^>
echo com_port: serial identifier (mandatory). Ex: COM15
echo.
echo Note: all trailing arguments will be passed to the %STM32CP_CLI%
echo They have to be valid commands for STM32 MCU
echo Ex: -g: Run the code at the specified address
echo -rst: Reset system
echo -s: start automatically (optional)
exit %ERROR%