Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc2b8d22

Browse files
committed
feat(stm32CubeProg): add offset option
Fixes#57Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parentb1c2d2c commitc2b8d22

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

‎stm32CubeProg.sh‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/sh -
22
set -o nounset# Treat unset variables as an error
3+
# set -o xtrace # Print command traces before executing command.
34

45
STM32CP_CLI=
56
ADDRESS=0x8000000
@@ -13,7 +14,7 @@ OPTS=""
1314
usage() {
1415
echo"############################################################"
1516
echo"##"
16-
echo"##$(basename"$0") <protocol> <file_path> [OPTIONS]"
17+
echo"##$(basename"$0") <protocol> <file_path><offset>[OPTIONS]"
1718
echo"##"
1819
echo"## protocol:"
1920
echo"## 0: SWD"
@@ -22,6 +23,7 @@ usage() {
2223
echo"## Note: prefix it by 1 to erase all sectors."
2324
echo"## Ex: 10 erase all sectors using SWD interface."
2425
echo"## file_path: file path name to be downloaded: (bin, hex)"
26+
echo"## offset: offset to add to$ADDRESS"
2527
echo"## Options:"
2628
echo"## For SWD and DFU: no mandatory options"
2729
echo"## For Serial: <com_port>"
@@ -92,14 +94,17 @@ case "${UNAME_OS}" in
9294
;;
9395
esac
9496

95-
if [$#-lt2 ];then
97+
if [$#-lt3 ];then
9698
echo"Not enough arguments!"
9799
usage 2
98100
fi
99101

100102
# Parse options
101103
PROTOCOL=$1
102104
FILEPATH=$2
105+
OFFSET=$3
106+
ADDRESS=$(printf"0x%x"$((ADDRESS+ OFFSET)))
107+
103108
# Protocol $1
104109
# 1x: Erase all sectors
105110
if ["$1"-ge 10 ];then
@@ -114,19 +119,19 @@ case $PROTOCOL in
114119
0)
115120
PORT="SWD"
116121
MODE="mode=UR"
117-
shift2
122+
shift3
118123
;;
119124
1)
120-
if [$#-lt3 ];then
125+
if [$#-lt4 ];then
121126
usage 3
122127
else
123-
PORT=$3
124-
shift3
128+
PORT=$4
129+
shift4
125130
fi
126131
;;
127132
2)
128133
PORT="USB1"
129-
shift2
134+
shift3
130135
;;
131136
*)
132137
echo"Protocol unknown!"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp