@@ -50,54 +50,30 @@ function mpy_firmware_deploy {
5050 board=$1
5151 hex_file=$2
5252
53- echo Deploying Micropython...
54- openocd -s openocd\s cripts -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\s cripts -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
8357function 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
9671function 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
10379function 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+
11299function 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