Skip to content

Commit 1e04218

Browse files
jaenrig-ifxactions-user
authored andcommitted
tools/psoc6/mpy-psoc6.*: Added qspi_conf to openocd program.
Signed-off-by: enriquezgarc <[email protected]>
1 parent ee44e03 commit 1e04218

File tree

2 files changed

+60
-83
lines changed

2 files changed

+60
-83
lines changed

tools/psoc6/mpy-psoc6.cmd

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -84,59 +84,33 @@ exit /b 0
8484
set hex_file=%~2
8585

8686
echo Deploying Micropython...
87-
openocd.exe -s openocd\scripts -c "source [find interface/kitprog3.cfg]; ; source [find target/psoc6_2m.cfg]; psoc6 allow_efuse_program off; psoc6 sflash_restrictions 1; program %hex_file% verify reset exit;"
88-
89-
exit /b 0
90-
91-
:hw_firmware_download:
92-
93-
set board=%~1
94-
curl.exe -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/hello-world_%board%.hex > hello-world_%board%.hex
95-
96-
exit /b 0
97-
98-
:hw_firmware_clean
99-
100-
set board=%~1
101-
del hello-world_%board%.hex
102-
103-
exit /b 0
104-
105-
:flash_erase_firmware_download:
106-
107-
set board=%~1
108-
curl.exe -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/device-erase_%board%.hex > device-erase_%board%.hex
109-
110-
exit /b 0
111-
112-
:flash_erase_firmware_clean
113-
114-
set board=%~1
115-
del device-erase_%board%.hex
87+
openocd.exe -s openocd\scripts -s openocd\board -c "source [find interface/kitprog3.cfg]; ; source [find target/psoc6_2m.cfg]; psoc6 allow_efuse_program off; psoc6 sflash_restrictions 1; program %hex_file% verify reset exit;"
11688

11789
exit /b 0
11890

11991
:mpy_firmware_download:
12092

121-
set board=%~1
122-
set version=%~2
93+
set fw_name=%~1
94+
set board=%~2
95+
set version=%~3
12396

12497
if "%version%" == "latest" (
12598
call set sub_url=latest/download
12699
) else (
127100
call set sub_url=download/%version%
128101
)
129102

130-
echo Downloading MicroPython PSoC6 port %version% for %board% board...
131-
curl.exe -s -L https://github.com/infineon/micropython/releases/%sub_url%/mpy-psoc6_%board%.hex > mpy-psoc6_%board%.hex
103+
echo Downloading %fw_name% %version% for %board% board...
104+
curl.exe -s -L https://github.com/infineon/micropython/releases/%sub_url%/%fw_name%_%board%.hex > %fw_name%_%board%.hex
132105

133106
exit /b 0
134107

135108
:mpy_firmware_clean
136109

137-
set board=%~1
138-
echo Cleaning up micropython hex files...
139-
del mpy-psoc6_%board%.hex
110+
set fw_name=%~1
111+
set board=%~2
112+
echo Cleaning up %fw_name% hex files...
113+
del %fw_name%_%board%.hex
140114

141115
exit /b 0
142116

@@ -150,6 +124,18 @@ exit /b 0
150124

151125
exit /b 0
152126

127+
:openocd_board_conf_download
128+
129+
set board=%~1
130+
echo Downloading openocd %board% configuration...
131+
cd openocd
132+
mkdir board
133+
cd board
134+
curl.exe -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/qspi_config_%board%.cfg > qspi_config.cfg
135+
cd ../..
136+
137+
exit /b 0
138+
153139
:openocd_uninstall_clean
154140

155141
echo Cleaning up openOCD installation package...
@@ -190,8 +176,9 @@ exit /b 0
190176

191177
Rem Download flashing tool and firmware
192178
call :openocd_download_install
193-
call :hw_firmware_download %board%
194-
call :mpy_firmware_download %board% %mpy_firmware_version%
179+
call :openocd_board_conf_download %board%
180+
call :mpy_firmware_download hello-world %board% v0.3.0
181+
call :mpy_firmware_download mpy-psoc6 %board% %mpy_firmware_version%
195182

196183
if not [%~3]==[\q] (
197184
echo:
@@ -206,8 +193,8 @@ exit /b 0
206193
echo Device firmware deployment completed.
207194

208195
call :openocd_uninstall_clean
209-
call :hw_firmware_clean %board%
210-
call :mpy_firmware_clean %board%
196+
call :mpy_firmware_clean hello-world %board%
197+
call :mpy_firmware_clean mpy-psoc6 %board%
211198

212199
if not [%~3]==[\q] (
213200
echo:
@@ -244,7 +231,8 @@ exit /b 0
244231

245232
Rem Download flashing tool and firmware
246233
call :openocd_download_install
247-
call :flash_erase_firmware_download %board%
234+
call :openocd_board_conf_download %board%
235+
call :mpy_firmware_download device-erase %board% v0.3.0
248236

249237
if not [%~2]==[\q] (
250238
echo:
@@ -258,7 +246,7 @@ exit /b 0
258246
echo Device firmware deployment completed.
259247

260248
call :openocd_uninstall_clean
261-
call :flash_erase_firmware_clean %board%
249+
call :mpy_firmware_clean device-erase %board%
262250

263251
if not [%~2]==[\q] (
264252
echo:

tools/psoc6/mpy-psoc6.sh

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -50,54 +50,30 @@ function mpy_firmware_deploy {
5050
board=$1
5151
hex_file=$2
5252

53-
echo Deploying Micropython...
54-
openocd -s openocd\scripts -c "source [find interface/kitprog3.cfg]; ; source [find target/psoc6_2m.cfg]; psoc6 allow_efuse_program off; psoc6 sflash_restrictions 1; program ${hex_file} verify reset exit;"
55-
}
56-
57-
function hw_firmware_download {
58-
# hello-world flashing workaround to overcome factory board flashing error.
59-
# This flashing step will be removed when the root cause fix is available.
60-
board=$1
61-
62-
curl -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/hello-world_${board}.hex > hello-world_${board}.hex
63-
}
64-
65-
function hw_firmware_clean {
66-
board=$1
67-
68-
rm hello-world_${board}.hex
69-
}
70-
71-
function flash_erase_firmware_download {
72-
board=$1
73-
74-
curl -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/device-erase_${board}.hex > device-erase_${board}.hex
75-
}
76-
77-
function flash_erase_firmware_clean {
78-
board=$1
79-
80-
rm device-erase_${board}.hex
53+
echo Deploying firmware...
54+
openocd -s openocd\scripts -s openocd/board -c "source [find interface/kitprog3.cfg]; ; source [find target/psoc6_2m.cfg]; psoc6 allow_efuse_program off; psoc6 sflash_restrictions 1; program ${hex_file} verify reset exit;"
8155
}
8256

8357
function mpy_firmware_download {
84-
board=$1
85-
version=$2
58+
fw_name=$1
59+
board=$2
60+
version=$3
8661

87-
echo Downloading MicroPython PSoC6 port ${version} for ${board} board...
62+
echo Downloading ${fw_name} ${version} for ${board} board...
8863
if [ "$version" = "latest" ]; then
8964
sub_url="latest/download"
9065
else
9166
sub_url="download/${version}"
9267
fi
93-
curl -s -L https://github.com/infineon/micropython/releases/${sub_url}/mpy-psoc6_${board}.hex > mpy-psoc6_${board}.hex
68+
curl -s -L https://github.com/infineon/micropython/releases/${sub_url}/${fw_name}_${board}.hex > ${fw_name}_${board}.hex
9469
}
9570

9671
function mpy_firmware_clean {
97-
board=$1
72+
fw_name=$1
73+
board=$2
9874

99-
echo Cleaning up micropython hex files...
100-
rm mpy-psoc6_${board}.hex
75+
echo Cleaning up ${fw_name} hex files...
76+
rm ${fw_name}_${board}.hex
10177
}
10278

10379
function openocd_download_install {
@@ -109,6 +85,17 @@ function openocd_download_install {
10985
./openocd/udev_rules/install_rules.sh
11086
}
11187

88+
function openocd_board_conf_download {
89+
board=$1
90+
91+
echo Downloading openocd ${board} configuration...
92+
cd openocd
93+
mkdir board
94+
cd board
95+
curl -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/qspi_config_${board}.cfg > qspi_config.cfg
96+
cd ../..
97+
}
98+
11299
function openocd_uninstall_clean {
113100
echo Cleaning up openOCD installation package...
114101
rm openocd.tar.gz
@@ -178,8 +165,9 @@ function mpy_device_setup {
178165

179166
# Download flashing tool and firmware
180167
openocd_download_install
181-
hw_firmware_download ${board}
182-
mpy_firmware_download ${board} ${mpy_firmware_version}
168+
openocd_board_conf_download ${board}
169+
mpy_firmware_download hello-world ${board} v0.3.0
170+
mpy_firmware_download mpy-psoc6 ${board} ${mpy_firmware_version}
183171

184172
wait_and_request_board_connect $3
185173

@@ -189,8 +177,8 @@ function mpy_device_setup {
189177
echo Device firmware deployment completed.
190178

191179
openocd_uninstall_clean
192-
hw_firmware_clean ${board}
193-
mpy_firmware_clean ${board}
180+
mpy_firmware_clean hello-world ${board}
181+
mpy_firmware_clean mpy-psoc6 ${board}
194182

195183
wait_user_termination $3
196184
}
@@ -200,15 +188,16 @@ function mpy_device_erase {
200188

201189
# Download flashing tool and firmware
202190
openocd_download_install
203-
flash_erase_firmware_download ${board}
191+
openocd_board_conf_download ${board}
192+
mpy_firmware_download device-erase ${board} v0.3.0
204193

205194
wait_and_request_board_connect $2
206195

207196
# Deploy on board
208197
mpy_firmware_deploy ${board} device-erase_${board}.hex
209198

210199
openocd_uninstall_clean
211-
flash_erase_firmware_clean ${board}
200+
mpy_firmware_clean device-erase ${board}
212201

213202
wait_user_termination $2
214203
}

0 commit comments

Comments
 (0)