From a09ed3c2d734b574df1bfdd3f83466f990871f8d Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Mon, 26 Jun 2023 16:03:04 +0200 Subject: [PATCH 1/6] tools/psoc6/mpy-psoc6.sh: Added device-erase function. Signed-off-by: enriquezgarc --- tools/psoc6/mpy-psoc6.sh | 103 +++++++++++++++++++++++++++------------ 1 file changed, 72 insertions(+), 31 deletions(-) diff --git a/tools/psoc6/mpy-psoc6.sh b/tools/psoc6/mpy-psoc6.sh index 493c27cf0d5a..14e2e35e44ae 100755 --- a/tools/psoc6/mpy-psoc6.sh +++ b/tools/psoc6/mpy-psoc6.sh @@ -5,7 +5,6 @@ ################### function help { - echo 'Micropython PSoC6 utility script' echo 'usage: sh mpy-psoc6.sh ' echo 'The available commands are:' @@ -22,11 +21,11 @@ function help { echo ' Use this command to install the deployment tools' echo ' and MicroPython firmware binary, and deploy the' echo ' firmware on the PSoC6 device.' - echo ' usage: sh mpy-psoc6.sh device-setup [board [[version [\q]]]' + echo ' usage: sh mpy-psoc6.sh device-setup [board [[version [-q]]]' echo '' echo ' board PSoC6 prototyping kit name' echo ' version MicroPython PSoC6 firmware version' - echo ' \q Quiet. Do not prompt any user confirmation request' + echo ' -q Quiet. Do not prompt any user confirmation request' echo '' echo ' firmware-deploy Firmware deployment on MicroPython board.' echo ' Use this command to deploy an existing .hex file' @@ -36,20 +35,28 @@ function help { echo '' echo ' board PSoC6 prototyping kit name' echo ' hex_file MicroPython PSoC6 firmware .hex file' - + echo '' + echo ' device-erase Erase the external memory of the device.' + echo ' Use this command to erase the external memory if available' + echo ' for the selected board.' + echo ' Requires openocd available on the system path.' + echo ' usage: sh mpy-psoc6.sh device-erase [board [[-q]]' + echo '' + echo ' board PSoC6 prototyping kit name' + echo ' -q Quiet. Do not prompt any user confirmation request' } 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 @@ -61,8 +68,19 @@ function hw_firmware_clean { rm hello-world_${board}.hex } -function mpy_firmware_download { +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 +} +function mpy_firmware_download { board=$1 version=$2 @@ -76,7 +94,6 @@ function mpy_firmware_download { } function mpy_firmware_clean { - board=$1 echo Cleaning up micropython hex files... @@ -84,7 +101,6 @@ function mpy_firmware_clean { } function openocd_download_install { - echo Downloading openocd... curl -s -L https://github.com/Infineon/openocd/releases/download/release-v4.4.0/openocd-4.4.0.2134-linux.tar.gz > openocd.tar.gz echo Extracting openocd... @@ -94,15 +110,32 @@ function openocd_download_install { } function openocd_uninstall_clean { - echo Cleaning up openOCD installation package... rm openocd.tar.gz rm -rf openocd +} +function wait_and_request_board_connect { + if [ "$1" != "-q" ]; then + echo '' + echo Please CONNECT THE BOARD and PRESS ANY KEY to start the firmware deployment... + read user_input + echo '' + fi } -function mpy_device_setup { +function wait_user_termination { + if [ "$1" != "-q" ]; then + echo '' + echo Press any key to continue... + read user_input + echo '' + fi +} + +board="" +function select_board { board=$1 board_list=(CY8CPROTO-062-4343W) @@ -126,8 +159,12 @@ function mpy_device_setup { board=${board_list[${board_index}]} fi - + echo MicroPython PSoC6 Board :: ${board} +} + +function mpy_device_setup { + select_board $1 # Version selection mpy_firmware_version=$2 @@ -144,13 +181,7 @@ function mpy_device_setup { hw_firmware_download ${board} mpy_firmware_download ${board} ${mpy_firmware_version} - - if [ "$3" != "\q" ]; then - echo '' - echo Please CONNECT THE BOARD and PRESS ANY KEY to start the firmware deployment... - read user_input - echo '' - fi + wait_and_request_board_connect $3 # Deploy on board mpy_firmware_deploy ${board} hello-world_${board}.hex @@ -161,16 +192,28 @@ function mpy_device_setup { hw_firmware_clean ${board} mpy_firmware_clean ${board} - if [ "$3" != "\q" ]; then - echo '' - echo Press any key to continue... - read user_input - echo '' - fi + wait_user_termination $3 } -function arduino_lab_download_and_launch { +function mpy_device_erase { + select_board $1 + # Download flashing tool and firmware + openocd_download_install + flash_erase_firmware_download ${board} + + wait_and_request_board_connect $2 + + # Deploy on board + mpy_firmware_deploy ${board} device-erase_${board}.hex + + openocd_uninstall_clean + flash_erase_firmware_clean ${board} + + wait_user_termination $2 +} + +function arduino_lab_download_and_launch { echo Downloading Arduino Lab for Micropython... curl -s -L https://github.com/arduino/lab-micropython-editor/releases/download/0.5.0-alpha/Arduino.Lab.for.Micropython-linux_x64.zip > arduino-for-micropython.zip echo Extracting Arduino Lab for Micropython... @@ -180,18 +223,14 @@ function arduino_lab_download_and_launch { echo Launching Arduino Lab for Micropython... ./arduino-lab-micropython-ide cd .. - } function arduino_lab_install_package_clean { - echo Cleaning up Arduino Lab for Micropython installation package... rm arduino-for-micropython.zip - } function mpy_quick_start { - echo '################################################' echo ' Welcome to the ' echo ' __ __ _ ___ _ _ ' @@ -219,7 +258,6 @@ function mpy_quick_start { echo Press any key to exit... read user_input echo '' - } # Main script commands @@ -234,6 +272,9 @@ case $1 in "firmware-deploy") mpy_firmware_deploy $2 $3 ;; + "device-erase") + mpy_device_erase $2 $3 + ;; "help") help ;; From d902f080eb1a21ceb73c6dea8aa472e0a464ff03 Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Mon, 26 Jun 2023 17:27:17 +0200 Subject: [PATCH 2/6] tools/psoc6/mpy-psoc6.cmd: Added device-erase function. Signed-off-by: enriquezgarc --- tools/psoc6/mpy-psoc6.cmd | 80 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/tools/psoc6/mpy-psoc6.cmd b/tools/psoc6/mpy-psoc6.cmd index d18601345eaf..9caf268f4b00 100644 --- a/tools/psoc6/mpy-psoc6.cmd +++ b/tools/psoc6/mpy-psoc6.cmd @@ -4,6 +4,7 @@ setlocal if "%1"=="quick-start" goto cmd_quick_start if "%1"=="device-setup" goto cmd_device_setup if "%1"=="firmware-deploy" goto cmd_firmware_deploy +if "%1"=="device-erase" goto cmd_device_erase if "%1"=="help" goto help goto help @@ -22,6 +23,10 @@ exit /b 0 call :mpy_firmware_deploy %2 %3 exit /b 0 +:cmd_device_erase + call :mpy_device_erase %2 %3 +exit /b 0 + rem ~~~~~~~~~~~~~~~~ rem Script functions @@ -60,6 +65,15 @@ rem ~~~~~~~~~~~~~~~~ echo board PSoC6 prototyping kit name echo hex_file MicroPython PSoC6 firmware .hex file echo: + echo device-erase Erase the external memory of the device. + echo Use this command to erase the external memory if available + echo for the selected board. + echo Requires openocd available on the system path. + echo usage: mpy-psoc6.cmd device-erase [board [[\q]] + echo: + echo board PSoC6 prototyping kit name + echo \q Quiet. Do not prompt any user confirmation request + echo: exit /b 0 @@ -88,6 +102,20 @@ exit /b 0 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 + +exit /b 0 + :mpy_firmware_download: set board=%~1 @@ -190,6 +218,58 @@ exit /b 0 exit /b 0 +:mpy_device_erase + + setlocal enabledelayedexpansion + + Rem Board selection + set board=%~1 + set board_list[0]=CY8CPROTO-062-4343W + if [%board%]==[] ( + echo: + echo Supported MicroPython PSoC6 boards + echo +---------+-----------------------------------+ + echo ^| ID ^| Board ^| + echo +---------+-----------------------------------+ + echo ^| 0 ^| CY8CPROTO-062-4343W (default^) ^| + echo +---------+-----------------------------------+ + echo: + echo No user selection required. Only one choice. + set /a board_index=0 + echo: + Rem set /p/( "board_index=Please type the desired board ID. " --> Uncomment and remove preselection above when more options are available + call set board=%%board_list[!board_index!]%% + ) + echo MicroPython PSoC6 Board :: %board% + + Rem Download flashing tool and firmware + call :openocd_download_install + call :flash_erase_firmware_download %board% + + if not [%~2]==[\q] ( + echo: + echo Please CONNECT THE BOARD and PRESS ANY KEY to start the firmware deployment... + pause >nul + echo: + ) + + Rem Deploy on board + call :mpy_firmware_deploy %board% device-erase_%board%.hex + echo Device firmware deployment completed. + + call :openocd_uninstall_clean + call :flash_erase_firmware_clean %board% + + if not [%~2]==[\q] ( + echo: + echo Press any key to continue... + pause >nul + echo: + ) + +exit /b 0 + + :arduino_lab_download_and_launch echo Downloading Arduino Lab for Micropython... From 705c0dc4b13c736a3fdec22de3e344ad2507bee9 Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Tue, 27 Jun 2023 13:01:22 +0200 Subject: [PATCH 3/6] 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 9caf268f4b00..50853da98aa6 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 14e2e35e44ae..dd420fddf59d 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 } From 92e866d64761d3ddc3a220fb7a3386025a75737e Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Tue, 27 Jun 2023 13:04:18 +0200 Subject: [PATCH 4/6] .github/workflows/ports_psoc6.yml: Added openocd bsp conf download. Signed-off-by: enriquezgarc --- .github/workflows/ports_psoc6.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ports_psoc6.yml b/.github/workflows/ports_psoc6.yml index e0d966abc02b..9256465d056c 100644 --- a/.github/workflows/ports_psoc6.yml +++ b/.github/workflows/ports_psoc6.yml @@ -57,7 +57,7 @@ jobs: run: | cd tools/psoc6 cp ../../mpy-psoc6_${{ matrix.board }}_${{ needs.server-build.outputs.commit_sha }}/firmware.hex . - source mpy-psoc6.sh && openocd_download_install && mpy_firmware_deploy ${{ matrix.board }} firmware.hex + source mpy-psoc6.sh && openocd_download_install && openocd_board_conf_download ${{ matrix.board }} && mpy_firmware_deploy ${{ matrix.board }} firmware.hex cd ../.. - name: Run tests run: cd tests && ./run-tests.py --target psoc6 --device /dev/ttyACM0 -d psoc6 From 747bd1f8646525e646e0f52f57cc5f357e710d5e Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Tue, 27 Jun 2023 13:06:32 +0200 Subject: [PATCH 5/6] ports/psoc6/boards/../makefile_mtb.mk: Fixed program target. Signed-off-by: enriquezgarc --- ports/psoc6/boards/CY8CPROTO-062-4343W/makefile_mtb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/psoc6/boards/CY8CPROTO-062-4343W/makefile_mtb.mk b/ports/psoc6/boards/CY8CPROTO-062-4343W/makefile_mtb.mk index a1ed91d88148..63f266b6f712 100644 --- a/ports/psoc6/boards/CY8CPROTO-062-4343W/makefile_mtb.mk +++ b/ports/psoc6/boards/CY8CPROTO-062-4343W/makefile_mtb.mk @@ -80,7 +80,7 @@ mpy_program: $(MPY_MAIN_BUILD_DIR)/firmware.hex @: $(info ) $(info Programming using openocd ...) - $(OPENOCD_HOME)/bin/openocd -s $(OPENOCD_HOME)/scripts -s bsps/TARGET_APP_CY8CPROTO-062-4343W/config/GeneratedSource -c "source [find interface/kitprog3.cfg]; $(SERIAL_ADAPTER_CMD) ; source [find target/psoc6_2m.cfg]; psoc6 allow_efuse_program off; psoc6 sflash_restrictions 1; program $(MPY_DIR_OF_MAIN_MAKEFILE)/build/firmware.hex verify reset exit;" + $(OPENOCD_HOME)/bin/openocd -s $(OPENOCD_HOME)/scripts -s $(MPY_DIR_OF_MTB_ADAPTER_MAKEFILE)/bsps/TARGET_APP_CY8CPROTO-062-4343W/config/GeneratedSource -c "source [find interface/kitprog3.cfg]; $(SERIAL_ADAPTER_CMD) ; source [find target/psoc6_2m.cfg]; psoc6 allow_efuse_program off; psoc6 sflash_restrictions 1; program $(MPY_DIR_OF_MAIN_MAKEFILE)/build/firmware.hex verify reset exit;" $(info Programming done.) # Use this target to program multiple attached target devices From 98a032a548626b138eac66a1bf6b1ee3533652dc Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Tue, 27 Jun 2023 13:29:14 +0200 Subject: [PATCH 6/6] docs/psoc6/installation.rst: Added device-erase doc. Signed-off-by: enriquezgarc --- docs/psoc6/installation.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/psoc6/installation.rst b/docs/psoc6/installation.rst index 808f06957e19..d0f8772e152f 100644 --- a/docs/psoc6/installation.rst +++ b/docs/psoc6/installation.rst @@ -159,6 +159,31 @@ The board needs to be specified, and the path and name of the ``.hex`` file: mpy-psoc6.cmd firmware-deploy CY8CPROTO-062-4343W pathtodir/mpy-psoc6_CY8CPROTO-062-4343W.hex +Erasing the device (external) file system +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Some PSoC6™ boards include an external flash memory which is used by the MicroPython file system. This memory will not be erased when +reprogramming or erasing MicroPython firmware via ``device-setup`` or ``firmware-deploy``. +Use the ``device-erase`` command to erase of the external memory of your PSoC6™ device: + +.. tabs:: + + .. group-tab:: Linux + + .. code-block:: bash + + ./mpy-psoc6.sh device-erase + + .. group-tab:: Windows + + .. code-block:: bash + + mpy-psoc6.cmd device-erase + +.. warning:: + + This command flashes the PSoC6™ controller with a custom program to delete the external memory. Thus, MicroPython will be removed from the + microcontroller. Use any of the script commands described above to reinstall MicroPython. Getting the firmware ^^^^^^^^^^^^^^^^^^^^