File tree 3 files changed +52
-46
lines changed
3 files changed +52
-46
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,15 @@ usage()
22
22
echo " ## 2: DFU"
23
23
echo " ## file_path: file path name to be downloaded: (bin, hex)"
24
24
echo " ## Options:"
25
- echo " ## For SWD: -rst"
26
- echo " ## -rst: Reset system (default)"
27
- echo " ## For Serial: <com_port> -s"
28
- echo " ## com_port: serial identifier. Ex: /dev/ttyS0"
29
- echo " ## -s: start automatically"
30
- echo " ## For DFU: none"
25
+ echo " ## For SWD and DFU: no mandatory options"
26
+ echo " ## For Serial: <com_port>"
27
+ echo " ## com_port: serial identifier (mandatory). Ex: /dev/ttyS0"
28
+ echo " ##"
29
+ echo " ## Note: all trailing arguments will be passed to the $STM32CP_CLI "
30
+ echo " ## They have to be valid commands for STM32 MCU"
31
+ echo " ## Ex: -g: Run the code at the specified address"
32
+ echo " ## -rst: Reset system"
33
+ echo " ## -s: start automatically (optional)"
31
34
echo " ############################################################"
32
35
exit $1
33
36
}
@@ -66,28 +69,26 @@ case $1 in
66
69
0)
67
70
PORT=' SWD'
68
71
MODE=' mode=UR'
69
- if [ $# -lt 3 ]; then
70
- OPTS=-rst
71
- else
72
- OPTS=$3
73
- fi ;;
72
+ shift 2;;
74
73
1)
75
74
if [ $# -lt 3 ]; then
76
75
usage 3
77
76
else
78
77
PORT=$3
79
- if [ $# -gt 3 ]; then
80
- shift 3
81
- OPTS=" $@ "
82
- fi
78
+ shift 3
83
79
fi ;;
84
80
2)
85
- PORT=' USB1' ;;
81
+ PORT=' USB1'
82
+ shift 2;;
86
83
* )
87
84
echo " Protocol unknown!"
88
85
usage 4;;
89
86
esac
90
87
88
+ if [ $# -gt 0 ]; then
89
+ OPTS=" $@ "
90
+ fi
91
+
91
92
${STM32CP_CLI} -c port=${PORT} ${MODE} -q -d ${FILEPATH} ${ADDRESS} ${OPTS}
92
93
93
94
exit 0
Original file line number Diff line number Diff line change @@ -21,12 +21,15 @@ usage()
21
21
echo " ## 2: DFU"
22
22
echo " ## file_path: file path name to be downloaded: (bin, hex)"
23
23
echo " ## Options:"
24
- echo " ## For SWD: -rst"
25
- echo " ## -rst: Reset system (default)"
26
- echo " ## For Serial: <com_port> -s"
27
- echo " ## com_port: serial identifier. Ex: /dev/ttyS0"
28
- echo " ## -s: start automatically"
29
- echo " ## For DFU: none"
24
+ echo " ## For SWD and DFU: no mandatory options"
25
+ echo " ## For Serial: <com_port>"
26
+ echo " ## com_port: serial identifier (mandatory). Ex: /dev/ttyS0"
27
+ echo " ##"
28
+ echo " ## Note: all trailing arguments will be passed to the $STM32CP_CLI "
29
+ echo " ## They have to be valid commands for STM32 MCU"
30
+ echo " ## Ex: -g: Run the code at the specified address"
31
+ echo " ## -rst: Reset system"
32
+ echo " ## -s: start automatically (optional)"
30
33
echo " ############################################################"
31
34
exit $1
32
35
}
@@ -65,28 +68,26 @@ case $1 in
65
68
0)
66
69
PORT=' SWD'
67
70
MODE=' mode=UR'
68
- if [ $# -lt 3 ]; then
69
- OPTS=-rst
70
- else
71
- OPTS=$3
72
- fi ;;
71
+ shift 2;;
73
72
1)
74
73
if [ $# -lt 3 ]; then
75
74
usage 3
76
75
else
77
76
PORT=$3
78
- if [ $# -gt 3 ]; then
79
- shift 3
80
- OPTS=" $@ "
81
- fi
77
+ shift 3
82
78
fi ;;
83
79
2)
84
- PORT=' USB1' ;;
80
+ PORT=' USB1'
81
+ shift 2;;
85
82
* )
86
83
echo " Protocol unknown!"
87
84
usage 4;;
88
85
esac
89
86
87
+ if [ $# -gt 0 ]; then
88
+ OPTS=" $@ "
89
+ fi
90
+
90
91
${STM32CP_CLI} -c port=${PORT} ${MODE} -q -d ${FILEPATH} ${ADDRESS} ${OPTS}
91
92
92
93
exit 0
Original file line number Diff line number Diff line change @@ -39,22 +39,23 @@ goto :usage
39
39
:SWD
40
40
set PORT = SWD
41
41
set MODE = mode=UR
42
- if " %~3 " == " " (set OPTS=-rst) else (set OPTS=%3 )
43
- goto :prog
42
+ goto :opt
44
43
45
44
:SERIAL
46
45
if " %~3 " == " " set ERROR = 3 & goto :usage
47
46
set PORT = %~3
48
-
49
- if " %~4 " == " " goto :prog
50
- shift
51
47
shift
52
- shift
53
- set OPTS = %*
54
- goto :prog
48
+ goto :opt
55
49
56
50
:DFU
57
51
set PORT = USB1
52
+ goto :opt
53
+
54
+ :opt
55
+ shift
56
+ shift
57
+ if " %~1 " == " " goto :prog
58
+ set OPTS = %*
58
59
goto :prog
59
60
60
61
:prog
@@ -70,10 +71,13 @@ exit 0
70
71
echo 2: DFU
71
72
echo file_path: file path name to be downloaded: (bin, hex)
72
73
echo Options:
73
- echo For SWD: -rst
74
- echo -rst: Reset system (default)
75
- echo For Serial: ^ < com_port^ > -s
76
- echo com_port: serial identifier. Ex: /dev/ttyS0
77
- echo -s: start automatically
78
- echo For DFU: none
74
+ echo For SWD and DFU: no mandatory options
75
+ echo For Serial: ^ < com_port^ >
76
+ echo com_port: serial identifier (mandatory). Ex: COM15
77
+ echo .
78
+ echo Note: all trailing arguments will be passed to the %STM32CP_CLI%
79
+ echo They have to be valid commands for STM32 MCU
80
+ echo Ex: -g: Run the code at the specified address
81
+ echo -rst: Reset system
82
+ echo -s: start automatically (optional)
79
83
exit %ERROR%
You can’t perform that action at this time.
0 commit comments