From e6df5d13d14552faae30415491a3e0e256f2aa71 Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Tue, 27 Jun 2023 13:01:22 +0200 Subject: [PATCH] tools/psoc6/mpy-psoc6.*: Added qspi_conf to openocd program. Signed-off-by: enriquezgarc --- tools/psoc6/mpy-psoc6.cmd | 72 ++++++++++++++++----------------------- tools/psoc6/mpy-psoc6.sh | 71 ++++++++++++++++---------------------- 2 files changed, 60 insertions(+), 83 deletions(-) diff --git a/tools/psoc6/mpy-psoc6.cmd b/tools/psoc6/mpy-psoc6.cmd index 9caf268f4b008..50853da98aa67 100644 --- a/tools/psoc6/mpy-psoc6.cmd +++ b/tools/psoc6/mpy-psoc6.cmd @@ -84,42 +84,15 @@ exit /b 0 set hex_file=%~2 echo Deploying Micropython... - 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;" - -exit /b 0 - -:hw_firmware_download: - - set board=%~1 - curl.exe -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/hello-world_%board%.hex > hello-world_%board%.hex - -exit /b 0 - -:hw_firmware_clean - - set board=%~1 - del hello-world_%board%.hex - -exit /b 0 - -:flash_erase_firmware_download: - - set board=%~1 - curl.exe -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/device-erase_%board%.hex > device-erase_%board%.hex - -exit /b 0 - -:flash_erase_firmware_clean - - set board=%~1 - del device-erase_%board%.hex + 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;" exit /b 0 :mpy_firmware_download: - set board=%~1 - set version=%~2 + set fw_name=%~1 + set board=%~2 + set version=%~3 if "%version%" == "latest" ( call set sub_url=latest/download @@ -127,16 +100,17 @@ exit /b 0 call set sub_url=download/%version% ) - echo Downloading MicroPython PSoC6 port %version% for %board% board... - curl.exe -s -L https://github.com/infineon/micropython/releases/%sub_url%/mpy-psoc6_%board%.hex > mpy-psoc6_%board%.hex + echo Downloading %fw_name% %version% for %board% board... + curl.exe -s -L https://github.com/infineon/micropython/releases/%sub_url%/%fw_name%_%board%.hex > %fw_name%_%board%.hex exit /b 0 :mpy_firmware_clean - set board=%~1 - echo Cleaning up micropython hex files... - del mpy-psoc6_%board%.hex + set fw_name=%~1 + set board=%~2 + echo Cleaning up %fw_name% hex files... + del %fw_name%_%board%.hex exit /b 0 @@ -150,6 +124,18 @@ exit /b 0 exit /b 0 +:openocd_board_conf_download + + set board=%~1 + echo Downloading openocd %board% configuration... + cd openocd + mkdir board + cd board + curl.exe -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/qspi_config_%board%.cfg > qspi_config.cfg + cd ../.. + +exit /b 0 + :openocd_uninstall_clean echo Cleaning up openOCD installation package... @@ -190,8 +176,9 @@ exit /b 0 Rem Download flashing tool and firmware call :openocd_download_install - call :hw_firmware_download %board% - call :mpy_firmware_download %board% %mpy_firmware_version% + call :openocd_board_conf_download %board% + call :mpy_firmware_download hello-world %board% v0.3.0 + call :mpy_firmware_download mpy-psoc6 %board% %mpy_firmware_version% if not [%~3]==[\q] ( echo: @@ -206,8 +193,8 @@ exit /b 0 echo Device firmware deployment completed. call :openocd_uninstall_clean - call :hw_firmware_clean %board% - call :mpy_firmware_clean %board% + call :mpy_firmware_clean hello-world %board% + call :mpy_firmware_clean mpy-psoc6 %board% if not [%~3]==[\q] ( echo: @@ -244,7 +231,8 @@ exit /b 0 Rem Download flashing tool and firmware call :openocd_download_install - call :flash_erase_firmware_download %board% + call :openocd_board_conf_download %board% + call :mpy_firmware_download device-erase %board% v0.3.0 if not [%~2]==[\q] ( echo: @@ -258,7 +246,7 @@ exit /b 0 echo Device firmware deployment completed. call :openocd_uninstall_clean - call :flash_erase_firmware_clean %board% + call :mpy_firmware_clean device-erase %board% if not [%~2]==[\q] ( echo: diff --git a/tools/psoc6/mpy-psoc6.sh b/tools/psoc6/mpy-psoc6.sh index 14e2e35e44ae2..dd420fddf59d6 100755 --- a/tools/psoc6/mpy-psoc6.sh +++ b/tools/psoc6/mpy-psoc6.sh @@ -50,54 +50,30 @@ function mpy_firmware_deploy { board=$1 hex_file=$2 - echo Deploying Micropython... - 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;" -} - -function hw_firmware_download { - # hello-world flashing workaround to overcome factory board flashing error. - # This flashing step will be removed when the root cause fix is available. - board=$1 - - curl -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/hello-world_${board}.hex > hello-world_${board}.hex -} - -function hw_firmware_clean { - board=$1 - - rm hello-world_${board}.hex -} - -function flash_erase_firmware_download { - board=$1 - - curl -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/device-erase_${board}.hex > device-erase_${board}.hex -} - -function flash_erase_firmware_clean { - board=$1 - - rm device-erase_${board}.hex + echo Deploying firmware... + 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;" } function mpy_firmware_download { - board=$1 - version=$2 + fw_name=$1 + board=$2 + version=$3 - echo Downloading MicroPython PSoC6 port ${version} for ${board} board... + echo Downloading ${fw_name} ${version} for ${board} board... if [ "$version" = "latest" ]; then sub_url="latest/download" else sub_url="download/${version}" fi - curl -s -L https://github.com/infineon/micropython/releases/${sub_url}/mpy-psoc6_${board}.hex > mpy-psoc6_${board}.hex + curl -s -L https://github.com/infineon/micropython/releases/${sub_url}/${fw_name}_${board}.hex > ${fw_name}_${board}.hex } function mpy_firmware_clean { - board=$1 + fw_name=$1 + board=$2 - echo Cleaning up micropython hex files... - rm mpy-psoc6_${board}.hex + echo Cleaning up ${fw_name} hex files... + rm ${fw_name}_${board}.hex } function openocd_download_install { @@ -109,6 +85,17 @@ function openocd_download_install { ./openocd/udev_rules/install_rules.sh } +function openocd_board_conf_download { + board=$1 + + echo Downloading openocd ${board} configuration... + cd openocd + mkdir board + cd board + curl -s -L https://github.com/infineon/micropython/releases/download/v0.3.0/qspi_config_${board}.cfg > qspi_config.cfg + cd ../.. +} + function openocd_uninstall_clean { echo Cleaning up openOCD installation package... rm openocd.tar.gz @@ -178,8 +165,9 @@ function mpy_device_setup { # Download flashing tool and firmware openocd_download_install - hw_firmware_download ${board} - mpy_firmware_download ${board} ${mpy_firmware_version} + openocd_board_conf_download ${board} + mpy_firmware_download hello-world ${board} v0.3.0 + mpy_firmware_download mpy-psoc6 ${board} ${mpy_firmware_version} wait_and_request_board_connect $3 @@ -189,8 +177,8 @@ function mpy_device_setup { echo Device firmware deployment completed. openocd_uninstall_clean - hw_firmware_clean ${board} - mpy_firmware_clean ${board} + mpy_firmware_clean hello-world ${board} + mpy_firmware_clean mpy-psoc6 ${board} wait_user_termination $3 } @@ -200,7 +188,8 @@ function mpy_device_erase { # Download flashing tool and firmware openocd_download_install - flash_erase_firmware_download ${board} + openocd_board_conf_download ${board} + mpy_firmware_download device-erase ${board} v0.3.0 wait_and_request_board_connect $2 @@ -208,7 +197,7 @@ function mpy_device_erase { mpy_firmware_deploy ${board} device-erase_${board}.hex openocd_uninstall_clean - flash_erase_firmware_clean ${board} + mpy_firmware_clean device-erase ${board} wait_user_termination $2 }