Build: Update PSoC6 documentation

- updated docs for psoc62, psoc64 and psoc64_1m platforms

Signed-off-by: Andrei Narkevitch <ainh@cypress.com>
Change-Id: I9f0c290bdb916ca799bc2cf374006d21f424f3be
diff --git a/docs/user_guides/tfm_build_instruction.rst b/docs/user_guides/tfm_build_instruction.rst
index 1d465b3..3a8fa58 100644
--- a/docs/user_guides/tfm_build_instruction.rst
+++ b/docs/user_guides/tfm_build_instruction.rst
@@ -35,18 +35,18 @@
             ``-DTARGET_PLATFORM=MUSCA_B1``
           - Cortex-M33 SSE-200 subsystem for MPS3 (AN524)
             ``-DTARGET_PLATFORM=AN524``
-          - Cypress PSoC 62 platform
+          - Cypress PSoC62 platform
             refer to target platform name in
-            :doc:`Cypress PSoC 6 platform specifics
-            </platform/ext/target/psoc62/cypress_psoc_6_spec>`.
-          - Cypress PSoC 64 platforms
+            :doc:`Cypress PSoC62 platform specifics
+            </platform/ext/target/cypress/psoc62/cypress_psoc62_spec>`.
+          - Cypress PSoC64 platforms
             refer to target platform name in
-            :doc:`Cypress PSoC 6 platform specifics
-            </platform/ext/target/psoc64/cypress_psoc_6_spec>`.
-          - Cypress PSoC 64 1MB platform
+            :doc:`Cypress PSoC64 platform specifics
+            </platform/ext/target/cypress/psoc64/cypress_psoc64_spec>`.
+          - Cypress PSoC64 1MB platform
             refer to target platform name in
-            :doc:`Cypress PSoC 6 platform specifics
-            </platform/ext/target/psoc64_1m/cypress_psoc_6_spec>`.
+            :doc:`Cypress PSoC64 1M platform specifics
+            </platform/ext/target/cypress/psoc64_1m/cypress_psoc64_1m_spec>`.
 
    * - -DCOMPILER=<compiler name>
      - Specifies the compiler toolchain
@@ -119,14 +119,14 @@
     cmake ../ -G"Unix Makefiles" -DTARGET_PLATFORM=AN521 -DCOMPILER=ARMCLANG
     cmake --build ./ -- install
 
-Build steps for Cypress PSoC 6 platform:
+Build steps for Cypress PSoC6 platforms:
 ========================================
-Please see build steps in :doc:`Cypress PSoC 62 platform specifics
-</platform/ext/target/psoc62/cypress_psoc_6_spec>` or
-:doc:`Cypress PSoC 64 platform specifics
-</platform/ext/target/psoc64/cypress_psoc_6_spec>` or
-:doc:`Cypress PSoC 64 1MB platform specifics
-</platform/ext/target/psoc64_1m/cypress_psoc_6_spec>`.
+Please see build steps in :doc:`Cypress PSoC62 platform specifics
+</platform/ext/target/cypress/psoc62/cypress_psoc62_spec>` or
+:doc:`Cypress PSoC64 platform specifics
+</platform/ext/target/cypress/psoc64/cypress_psoc64_spec>` or
+:doc:`Cypress PSoC64 1MB platform specifics
+</platform/ext/target/cypress/psoc64_1m/cypress_psoc64_1m_spec>`.
 
 Regression Tests for the AN521 target platform
 ==============================================
diff --git a/platform/ext/target/cypress/psoc62/cypress_psoc_6_spec.rst b/platform/ext/target/cypress/psoc62/cypress_psoc62_spec.rst
similarity index 87%
rename from platform/ext/target/cypress/psoc62/cypress_psoc_6_spec.rst
rename to platform/ext/target/cypress/psoc62/cypress_psoc62_spec.rst
index 284ac74..f9219f5 100644
--- a/platform/ext/target/cypress/psoc62/cypress_psoc_6_spec.rst
+++ b/platform/ext/target/cypress/psoc62/cypress_psoc62_spec.rst
@@ -1,9 +1,9 @@
 ########################
-Cypress PSoC 6 Specifics
+Cypress PSoC62 Specifics
 ########################
 
 ******************************************
-Building Multi-Core TF-M on Cypress PSoC 6
+Building Multi-Core TF-M on Cypress PSoC62
 ******************************************
 
 Please make sure you have all required software installed as explained in the
@@ -81,7 +81,12 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigCoreIPC.cmake` -DTARGET_PLATFORM=psoc62 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" \
+          -DPROJ_CONFIG=`readlink \
+          -f ../configs/ConfigCoreIPC.cmake` \
+          -DTARGET_PLATFORM=psoc62 \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -97,7 +102,12 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigRegressionIPC.cmake` -DTARGET_PLATFORM=psoc62 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" \
+          -DPROJ_CONFIG=`readlink \
+          -f ../configs/ConfigRegressionIPC.cmake` \
+          -DTARGET_PLATFORM=psoc62 \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -137,7 +147,7 @@
         -DPSA_API_TEST_ATTESTATION=1 \
         -DTARGET_PLATFORM=psoc62 \
         -DCOMPILER=ARMCLANG \
-        -DCMAKE_BUILD_TYPE=Debug
+        -DCMAKE_BUILD_TYPE=Release
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -153,7 +163,12 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigCoreIPCTfmLevel2.cmake` -DTARGET_PLATFORM=psoc62 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" \
+          -DPROJ_CONFIG=`readlink \
+          -f ../configs/ConfigCoreIPCTfmLevel2.cmake` \
+          -DTARGET_PLATFORM=psoc62 \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -169,7 +184,12 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigRegressionIPCTfmLevel2.cmake` -DTARGET_PLATFORM=psoc62 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" \
+          -DPROJ_CONFIG=`readlink \
+          -f ../configs/ConfigRegressionIPCTfmLevel2.cmake` \
+          -DTARGET_PLATFORM=psoc62 \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -209,7 +229,7 @@
         -DPSA_API_TEST_SECURE_STORAGE=1 \
         -DTARGET_PLATFORM=psoc62 \
         -DCOMPILER=ARMCLANG \
-        -DCMAKE_BUILD_TYPE=Debug
+        -DCMAKE_BUILD_TYPE=Release
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -240,7 +260,7 @@
 Note that the ``0x10020000`` in the command above must match the start address
 of the secure primary image specified in the file::
 
-    platform/ext/target/psoc62/partition/flash_layout.h
+    platform/ext/target/cypress/psoc62/partition/flash_layout.h
 
 so be sure to change it if you change that file.
 
diff --git a/platform/ext/target/cypress/psoc64/cypress_psoc_6_spec.rst b/platform/ext/target/cypress/psoc64/cypress_psoc64_spec.rst
similarity index 71%
rename from platform/ext/target/cypress/psoc64/cypress_psoc_6_spec.rst
rename to platform/ext/target/cypress/psoc64/cypress_psoc64_spec.rst
index 8b498b2..dda8dc1 100644
--- a/platform/ext/target/cypress/psoc64/cypress_psoc_6_spec.rst
+++ b/platform/ext/target/cypress/psoc64/cypress_psoc64_spec.rst
@@ -1,26 +1,46 @@
 ########################
-Cypress PSoC 6 Specifics
+Cypress PSoC64 Specifics
 ########################
 
-******************************************
-Building Multi-Core TF-M on Cypress PSoC 6
-******************************************
+*************
+Prerequisites
+*************
+
+PSoC64 must first be provisioned with SecureBoot firmware and a provisioning packet
+containing policy and secure keys. Please refer to the guide at
+https://www.cypress.com/documentation/software-and-drivers/psoc-64-secure-mcu-secure-boot-sdk-user-guide
 
 Please make sure you have all required software installed as explained in the
 :doc:`software requirements </docs/user_guides/tfm_sw_requirement>`.
 
-Please install CySecureTools with (requires Python3.7):
-
-.. code-block:: bash
-
-    pip install cysecuretools
-
-For more details please refer to
-`CySecureTools <https://pypi.org/project/cysecuretools>`_ page.
-
 Please also make sure that all the source code are fetched by following
 :doc:`general building instruction </docs/user_guides/tfm_build_instruction>`.
 
+Install CySecureTools. The exact command to use depends on what version of
+python you are running (which can be determined with "python3 --version").
+
+If you have python 3.7, use
+
+.. code-block:: bash
+
+    pip install cysecuretools==1.0.0
+
+If you have python 3.6.8, use
+
+.. code-block:: bash
+
+    pip3 install --ignore-requires-python git+https://github.com/cypresssemiconductorco/cysecuretools@v1.0.0
+
+For more details please refer to
+`CySecureTools <https://pypi.org/project/cysecuretools/1.0.0/>`_ page.
+
+Install OpenOCD with PSoC6 support. It can be obtained from the Cypress
+Programmer, download it from:
+https://www.cypress.com/products/psoc-programming-solutions
+
+******************************************
+Building Multi-Core TF-M on Cypress PSoC64
+******************************************
 
 Configuring the build
 =====================
@@ -86,7 +106,12 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigCoreIPC.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink \
+          -f ../configs/ConfigCoreIPC.cmake` \
+          -DTARGET_PLATFORM=psoc64 \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release \
+          ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -102,7 +127,11 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigRegressionIPC.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink \
+          -f ../configs/ConfigRegressionIPC.cmake` \
+          -DTARGET_PLATFORM=psoc64 \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -142,7 +171,7 @@
         -DPSA_API_TEST_ATTESTATION=1 \
         -DTARGET_PLATFORM=psoc64 \
         -DCOMPILER=ARMCLANG \
-        -DCMAKE_BUILD_TYPE=Debug
+        -DCMAKE_BUILD_TYPE=Release
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -158,7 +187,12 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigCoreIPCTfmLevel2.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" \
+          -DPROJ_CONFIG=`readlink -f ../configs/ConfigCoreIPCTfmLevel2.cmake` \
+          -DTARGET_PLATFORM=psoc64 \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release \
+          ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -174,7 +208,13 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigRegressionIPCTfmLevel2.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" \
+          -DPROJ_CONFIG=`readlink \
+          -f ../configs/ConfigRegressionIPCTfmLevel2.cmake` \
+          -DTARGET_PLATFORM=psoc64 \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release \
+          ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -214,7 +254,7 @@
         -DPSA_API_TEST_SECURE_STORAGE=1 \
         -DTARGET_PLATFORM=psoc64 \
         -DCOMPILER=ARMCLANG \
-        -DCMAKE_BUILD_TYPE=Debug
+        -DCMAKE_BUILD_TYPE=Release
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -240,10 +280,10 @@
     fromelf --i32 --output=<build folder>/tfm_ns.hex <build folder>/app/tfm_ns.axf
 
 Copy secure keys used in the board provisioning process to
-platform/ext/target/psoc64/security/keys:
+platform/ext/target/cypress/psoc64/security/keys:
 
-MCUBOOT_CM0P_KEY.json - private OEM key for signing CM0P image
-USERAPP_CM4_KEY.json  - private OEM key for signing CM4 image
+-MCUBOOT_CM0P_KEY_PRIV.pem - private OEM key for signing CM0P image
+-USERAPP_CM4_KEY_PRIV.pem  - private OEM key for signing CM4 image
 
 Note: provisioned board in SECURE claimed state is required, otherwise refer to
 Cypress documentation for details on the provisioning process.
@@ -252,26 +292,38 @@
 
 .. code-block:: bash
 
-    ./platform/ext/target/psoc64/security/sign.py \
+    ./platform/ext/target/cypress/psoc64/security/sign.py \
       -s <build folder>/tfm_s.hex \
       -n <build folder>/tfm_ns.hex \
-      -p platform/ext/target/psoc6/security/policy_dual_stage_CM0p_CM4.json
+      -p platform/ext/target/cypress/psoc64/security/policy_dual_stage_CM0p_CM4_debug_2M.json
+
+Note: each image can be signed individually, for example:
+
+.. code-block:: bash
+
+    ./platform/ext/target/cypress/psoc64/security/sign.py \
+      -n <build folder>/tfm_ns.hex \
+      -p platform/ext/target/cypress/psoc64/security/policy_dual_stage_CM0p_CM4_debug_2M.json
+
+.. code-block:: bash
+
+    ./platform/ext/target/cypress/psoc64/security/sign.py \
+      -s <build folder>/tfm_s.hex \
+      -p platform/ext/target/cypress/psoc64/security/policy_dual_stage_CM0p_CM4_debug_2M.json
 
 **********************
 Programming the Device
 **********************
 
 After building and signing, the TFM images must be programmed into flash
-memory on the PSoC 6 device.
-
-There are two methods to program psoc6 device.
+memory on the PSoC64 device. There are two methods to program it.
 
 DAPLink mode
 ============
 
 Using KitProg3 mode button, switch it to DAPLink mode.
 Mode LED should start blinking rapidly and depending on the host computer
-settings DAPLINK will be mounted as a media storage device. 
+settings DAPLINK will be mounted as a media storage device.
 Otherwise, mount it manually.
 
 Copy tfm hex files one by one to the DAPLINK device:
@@ -292,20 +344,23 @@
 
 .. code-block:: bash
 
+    OPENOCD_PATH=<cyprogrammer dir>/openocd
+    BUILD_DIR=<build folder>
+
     ${OPENOCD_PATH}/bin/openocd \
             -s ${OPENOCD_PATH}/scripts \
             -f interface/kitprog3.cfg \
             -c "set ENABLE_ACQUIRE 0" \
-            -f target/psoc6_secure.cfg \
-            -c "init; reset init; flash write_image erase <build folder>/tfm_s.hex" \
+            -f target/psoc6_2m_secure.cfg \
+            -c "init; reset init; flash write_image erase ${BUILD_DIR}/tfm_s.hex" \
             -c "resume; reset; exit"
 
     ${OPENOCD_PATH}/bin/openocd \
             -s ${OPENOCD_PATH}/scripts \
             -f interface/kitprog3.cfg \
             -c "set ENABLE_ACQUIRE 0" \
-            -f target/psoc6_secure.cfg \
-            -c "init; reset init; flash write_image erase <build folder>/tfm_ns.hex" \
+            -f target/psoc6_2m_secure.cfg \
+            -c "init; reset init; flash write_image erase ${BUILD_DIR}/tfm_ns.hex" \
             -c "resume; reset; exit"
 
 Optionally, erase SST partition:
@@ -315,15 +370,15 @@
     ${OPENOCD_PATH}/bin/openocd \
             -s ${OPENOCD_PATH}/scripts \
             -f interface/kitprog3.cfg \
-            -f target/psoc6_secure.cfg \
+            -f target/psoc6_2m_secure.cfg \
             -c "init; reset init" \
-            -c "flash erase_address 0x100c0000 0x10000" \
+            -c "flash erase_address 0x101c0000 0x10000" \
             -c "shutdown"
 
-Note that the ``0x100C0000`` in the command above must match the SST start
+Note that the ``0x101C0000`` in the command above must match the SST start
 address of the secure primary image specified in the file:
 
-    platform/ext/target/psoc64/partition/flash_layout.h
+    platform/ext/target/cypress/psoc64/partition/flash_layout.h
 
 so be sure to change it if you change that file.
 
diff --git a/platform/ext/target/cypress/psoc64/cypress_psoc_6_spec.rst b/platform/ext/target/cypress/psoc64_1m/cypress_psoc64_1m_spec.rst
similarity index 69%
copy from platform/ext/target/cypress/psoc64/cypress_psoc_6_spec.rst
copy to platform/ext/target/cypress/psoc64_1m/cypress_psoc64_1m_spec.rst
index 8b498b2..de262ac 100644
--- a/platform/ext/target/cypress/psoc64/cypress_psoc_6_spec.rst
+++ b/platform/ext/target/cypress/psoc64_1m/cypress_psoc64_1m_spec.rst
@@ -1,26 +1,46 @@
-########################
-Cypress PSoC 6 Specifics
-########################
+############################
+Cypress PSoC64 1MB Specifics
+############################
 
-******************************************
-Building Multi-Core TF-M on Cypress PSoC 6
-******************************************
+*************
+Prerequisites
+*************
+
+PSoC64 must first be provisioned with SecureBoot firmware and a provisioning packet
+containing policy and secure keys. Please refer to the guide at
+https://www.cypress.com/documentation/software-and-drivers/psoc-64-secure-mcu-secure-boot-sdk-user-guide
 
 Please make sure you have all required software installed as explained in the
 :doc:`software requirements </docs/user_guides/tfm_sw_requirement>`.
 
-Please install CySecureTools with (requires Python3.7):
-
-.. code-block:: bash
-
-    pip install cysecuretools
-
-For more details please refer to
-`CySecureTools <https://pypi.org/project/cysecuretools>`_ page.
-
 Please also make sure that all the source code are fetched by following
 :doc:`general building instruction </docs/user_guides/tfm_build_instruction>`.
 
+Install CySecureTools. The exact command to use depends on what version of
+python you are running (which can be determined with "python3 --version").
+
+If you have python 3.7, use
+
+.. code-block:: bash
+
+    pip install cysecuretools==1.0.0
+
+If you have python 3.6.8, use
+
+.. code-block:: bash
+
+    pip3 install --ignore-requires-python git+https://github.com/cypresssemiconductorco/cysecuretools@v1.0.0
+
+For more details please refer to
+`CySecureTools <https://pypi.org/project/cysecuretools/1.0.0/>`_ page.
+
+Install OpenOCD with PSoC6 support. It can be obtained from the Cypress
+Programmer, download it from:
+https://www.cypress.com/products/psoc-programming-solutions
+
+**********************************************
+Building Multi-Core TF-M on Cypress PSoC64 1MB
+**********************************************
 
 Configuring the build
 =====================
@@ -53,8 +73,8 @@
            - IPC model with PSA API test suite in Isolation Level 2
              ``ConfigPsaApiTestIPCTfmLevel2.cmake``
 
-   * - -DTARGET_PLATFORM=psoc64
-     - Specifies target platform name ``psoc64``
+   * - -DTARGET_PLATFORM=psoc64_1m
+     - Specifies target platform name ``psoc64_1m``
 
    * - -DCOMPILER=<compiler name>
      - Specifies the compiler toolchain
@@ -70,6 +90,9 @@
          - ``Debug``
          - ``Release``
 
+         Note: due to the limited Flash memory space, in some combinations of
+         compilers and build configurations, Debug image may not fit into the
+         availabe space.
 
 Build Instructions
 ==================
@@ -86,7 +109,12 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigCoreIPC.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink \
+          -f ../configs/ConfigCoreIPC.cmake` \
+          -DTARGET_PLATFORM=psoc64_1m \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release \
+          ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -102,7 +130,11 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigRegressionIPC.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink \
+          -f ../configs/ConfigRegressionIPC.cmake` \
+          -DTARGET_PLATFORM=psoc64_1m \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -140,9 +172,9 @@
         -DPROJ_CONFIG=`readlink -f ../configs/ConfigPsaApiTestIPC.cmake` \
         -DPSA_API_TEST_BUILD_PATH=../psa-arch-tests/api-tests/BUILD_ATT.GNUARM
         -DPSA_API_TEST_ATTESTATION=1 \
-        -DTARGET_PLATFORM=psoc64 \
+        -DTARGET_PLATFORM=psoc64_1m \
         -DCOMPILER=ARMCLANG \
-        -DCMAKE_BUILD_TYPE=Debug
+        -DCMAKE_BUILD_TYPE=Release
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -158,7 +190,12 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigCoreIPCTfmLevel2.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" \
+          -DPROJ_CONFIG=`readlink -f ../configs/ConfigCoreIPCTfmLevel2.cmake` \
+          -DTARGET_PLATFORM=psoc64_1m \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release \
+          ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -174,7 +211,13 @@
 
     mkdir <build folder>
     pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigRegressionIPCTfmLevel2.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
+    cmake -G"Unix Makefiles" \
+          -DPROJ_CONFIG=`readlink \
+          -f ../configs/ConfigRegressionIPCTfmLevel2.cmake` \
+          -DTARGET_PLATFORM=psoc64_1m \
+          -DCOMPILER=ARMCLANG \
+          -DCMAKE_BUILD_TYPE=Release \
+          ../
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -212,9 +255,9 @@
         -DPROJ_CONFIG=`readlink -f ../configs/ConfigPsaApiTestIPCTfmLevel2.cmake` \
         -DPSA_API_TEST_BUILD_PATH=../psa-arch-tests/api-tests/BUILD_PS.GNUARM
         -DPSA_API_TEST_SECURE_STORAGE=1 \
-        -DTARGET_PLATFORM=psoc64 \
+        -DTARGET_PLATFORM=psoc64_1m \
         -DCOMPILER=ARMCLANG \
-        -DCMAKE_BUILD_TYPE=Debug
+        -DCMAKE_BUILD_TYPE=Release
     popd
     cmake --build <build folder> -- -j VERBOSE=1
 
@@ -240,10 +283,10 @@
     fromelf --i32 --output=<build folder>/tfm_ns.hex <build folder>/app/tfm_ns.axf
 
 Copy secure keys used in the board provisioning process to
-platform/ext/target/psoc64/security/keys:
+platform/ext/target/cypress/psoc64_1m/security/keys:
 
-MCUBOOT_CM0P_KEY.json - private OEM key for signing CM0P image
-USERAPP_CM4_KEY.json  - private OEM key for signing CM4 image
+-MCUBOOT_CM0P_KEY_PRIV.pem - private OEM key for signing CM0P image
+-USERAPP_CM4_KEY_PRIV.pem  - private OEM key for signing CM4 image
 
 Note: provisioned board in SECURE claimed state is required, otherwise refer to
 Cypress documentation for details on the provisioning process.
@@ -252,26 +295,38 @@
 
 .. code-block:: bash
 
-    ./platform/ext/target/psoc64/security/sign.py \
+    ./platform/ext/target/cypress/psoc64_1m/security/sign.py \
       -s <build folder>/tfm_s.hex \
       -n <build folder>/tfm_ns.hex \
-      -p platform/ext/target/psoc6/security/policy_dual_stage_CM0p_CM4.json
+      -p platform/ext/target/cypress/psoc64_1m/security/policy_dual_stage_CM0p_CM4.json
+
+Note: each image can be signed individually, for example:
+
+.. code-block:: bash
+
+    ./platform/ext/target/cypress/psoc64_1m/security/sign.py \
+      -n <build folder>/tfm_ns.hex \
+      -p platform/ext/target/cypress/psoc64_1m/security/policy_dual_stage_CM0p_CM4.json
+
+.. code-block:: bash
+
+    ./platform/ext/target/cypress/psoc64_1m/security/sign.py \
+      -s <build folder>/tfm_s.hex \
+      -p platform/ext/target/cypress/psoc64_1m/security/policy_dual_stage_CM0p_CM4.json
 
 **********************
 Programming the Device
 **********************
 
 After building and signing, the TFM images must be programmed into flash
-memory on the PSoC 6 device.
-
-There are two methods to program psoc6 device.
+memory on the PSoC64 device. There are two methods to program it.
 
 DAPLink mode
 ============
 
 Using KitProg3 mode button, switch it to DAPLink mode.
 Mode LED should start blinking rapidly and depending on the host computer
-settings DAPLINK will be mounted as a media storage device. 
+settings DAPLINK will be mounted as a media storage device.
 Otherwise, mount it manually.
 
 Copy tfm hex files one by one to the DAPLINK device:
@@ -292,20 +347,25 @@
 
 .. code-block:: bash
 
+    OPENOCD_PATH=<cyprogrammer dir>/openocd
+    BUILD_DIR=<build folder>
+
     ${OPENOCD_PATH}/bin/openocd \
             -s ${OPENOCD_PATH}/scripts \
             -f interface/kitprog3.cfg \
+            -c "set FLASH_RESTRICTION_SIZE 0xD0000" \
             -c "set ENABLE_ACQUIRE 0" \
             -f target/psoc6_secure.cfg \
-            -c "init; reset init; flash write_image erase <build folder>/tfm_s.hex" \
+            -c "init; reset init; flash write_image erase ${BUILD_DIR}/tfm_s.hex" \
             -c "resume; reset; exit"
 
     ${OPENOCD_PATH}/bin/openocd \
             -s ${OPENOCD_PATH}/scripts \
             -f interface/kitprog3.cfg \
+            -c "set FLASH_RESTRICTION_SIZE 0xD0000" \
             -c "set ENABLE_ACQUIRE 0" \
             -f target/psoc6_secure.cfg \
-            -c "init; reset init; flash write_image erase <build folder>/tfm_ns.hex" \
+            -c "init; reset init; flash write_image erase ${BUILD_DIR}/tfm_ns.hex" \
             -c "resume; reset; exit"
 
 Optionally, erase SST partition:
@@ -315,6 +375,7 @@
     ${OPENOCD_PATH}/bin/openocd \
             -s ${OPENOCD_PATH}/scripts \
             -f interface/kitprog3.cfg \
+            -c "set FLASH_RESTRICTION_SIZE 0xD0000" \
             -f target/psoc6_secure.cfg \
             -c "init; reset init" \
             -c "flash erase_address 0x100c0000 0x10000" \
@@ -323,7 +384,7 @@
 Note that the ``0x100C0000`` in the command above must match the SST start
 address of the secure primary image specified in the file:
 
-    platform/ext/target/psoc64/partition/flash_layout.h
+    platform/ext/target/cypress/psoc64_1m/partition/flash_layout.h
 
 so be sure to change it if you change that file.
 
diff --git a/platform/ext/target/cypress/psoc64_1m/cypress_psoc_6_spec.rst b/platform/ext/target/cypress/psoc64_1m/cypress_psoc_6_spec.rst
deleted file mode 100644
index 8b498b2..0000000
--- a/platform/ext/target/cypress/psoc64_1m/cypress_psoc_6_spec.rst
+++ /dev/null
@@ -1,332 +0,0 @@
-########################
-Cypress PSoC 6 Specifics
-########################
-
-******************************************
-Building Multi-Core TF-M on Cypress PSoC 6
-******************************************
-
-Please make sure you have all required software installed as explained in the
-:doc:`software requirements </docs/user_guides/tfm_sw_requirement>`.
-
-Please install CySecureTools with (requires Python3.7):
-
-.. code-block:: bash
-
-    pip install cysecuretools
-
-For more details please refer to
-`CySecureTools <https://pypi.org/project/cysecuretools>`_ page.
-
-Please also make sure that all the source code are fetched by following
-:doc:`general building instruction </docs/user_guides/tfm_build_instruction>`.
-
-
-Configuring the build
-=====================
-
-The build configuration for TF-M is provided to the build system using command
-line arguments:
-
-.. list-table::
-   :widths: 20 80
-
-   * - -DPROJ_CONFIG=<file>
-     - Specifies the way the application is built.
-
-       | <file> is the absolute path to configurations file
-         named as ``Config<APP_NAME>.cmake``.
-       | e.g. On Linux:
-         ``-DPROJ_CONFIG=`readlink -f ../configs/ConfigRegressionIPC.cmake```
-       | Supported configurations files
-
-           - IPC model without regression test suites in Isolation Level 1
-             ``ConfigCoreIPC.cmake``
-           - IPC model with regression test suites in Isolation Level 1
-             ``ConfigRegressionIPC.cmake``
-           - IPC model with PSA API test suite in Isolation Level 1
-             ``ConfigPsaApiTestIPC.cmake``
-           - IPC model without regression test suites in Isolation Level 2
-             ``ConfigCoreIPCTfmLevel2.cmake``
-           - IPC model with regression test suites in Isolation Level 2
-             ``ConfigRegressionIPCTfmLevel2.cmake``
-           - IPC model with PSA API test suite in Isolation Level 2
-             ``ConfigPsaApiTestIPCTfmLevel2.cmake``
-
-   * - -DTARGET_PLATFORM=psoc64
-     - Specifies target platform name ``psoc64``
-
-   * - -DCOMPILER=<compiler name>
-     - Specifies the compiler toolchain
-       The possible values are:
-
-         - ``ARMCLANG``
-         - ``GNUARM``
-
-   * - -DCMAKE_BUILD_TYPE=<build type>
-     - Configures debugging support.
-       The possible values are:
-
-         - ``Debug``
-         - ``Release``
-
-
-Build Instructions
-==================
-
-The following instructions build multi-core TF-M without regression test suites
-in Isolation Level 1 on Linux.
-Both the compiler and the debugging type can be changed to other configurations
-listed above.
-
-.. code-block:: bash
-
-    cd <TF-M base folder>
-    cd <trusted-firmware-m folder>
-
-    mkdir <build folder>
-    pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigCoreIPC.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
-    popd
-    cmake --build <build folder> -- -j VERBOSE=1
-
-The following instructions build multi-core TF-M with regression test suites
-in Isolation Level 1 on Linux.
-Both the compiler and the debugging type can be changed to other configurations
-listed above.
-
-.. code-block:: bash
-
-    cd <TF-M base folder>
-    cd <trusted-firmware-m folder>
-
-    mkdir <build folder>
-    pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigRegressionIPC.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
-    popd
-    cmake --build <build folder> -- -j VERBOSE=1
-
-The following instructions build multi-core TF-M with PSA API test suite for
-the attestation service in Isolation Level 1 on Linux.
-Both the compiler and the debugging type can be changed to other configurations
-listed above.
-
-.. list-table::
-   :widths: 20 80
-
-   * - -DPSA_API_TEST_BUILD_PATH=<path> (optional)
-     - Specifies the path to the PSA API build directory
-
-         - ``${TFM_ROOT_DIR}/../psa-arch-tests/api-tests/BUILD`` (default)
-
-   * - -D<PSA_API_TEST_xxx>=1 (choose exactly one)
-     - Specifies the service to support
-       The possible values are:
-
-         - ``PSA_API_TEST_ATTESTATION``
-         - ``PSA_API_TEST_CRYPTO``
-         - ``PSA_API_TEST_SECURE_STORAGE``
-         - ``PSA_API_TEST_INTERNAL_TRUSTED_STORAGE``
-
-.. code-block:: bash
-
-    cd <TF-M base folder>
-    cd <trusted-firmware-m folder>
-
-    mkdir <build folder>
-    pushd <build folder>
-    cmake ../ \
-        -G"Unix Makefiles" \
-        -DPROJ_CONFIG=`readlink -f ../configs/ConfigPsaApiTestIPC.cmake` \
-        -DPSA_API_TEST_BUILD_PATH=../psa-arch-tests/api-tests/BUILD_ATT.GNUARM
-        -DPSA_API_TEST_ATTESTATION=1 \
-        -DTARGET_PLATFORM=psoc64 \
-        -DCOMPILER=ARMCLANG \
-        -DCMAKE_BUILD_TYPE=Debug
-    popd
-    cmake --build <build folder> -- -j VERBOSE=1
-
-The following instructions build multi-core TF-M without regression test suites
-in Isolation Level 2 on Linux.
-Both the compiler and the debugging type can be changed to other configurations
-listed above.
-
-.. code-block:: bash
-
-    cd <TF-M base folder>
-    cd <trusted-firmware-m folder>
-
-    mkdir <build folder>
-    pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigCoreIPCTfmLevel2.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
-    popd
-    cmake --build <build folder> -- -j VERBOSE=1
-
-The following instructions build multi-core TF-M with regression test suites
-in Isolation Level 2 on Linux.
-Both the compiler and the debugging type can be changed to other configurations
-listed above.
-
-.. code-block:: bash
-
-    cd <TF-M base folder>
-    cd <trusted-firmware-m folder>
-
-    mkdir <build folder>
-    pushd <build folder>
-    cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigRegressionIPCTfmLevel2.cmake` -DTARGET_PLATFORM=psoc64 -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug ../
-    popd
-    cmake --build <build folder> -- -j VERBOSE=1
-
-The following instructions build multi-core TF-M with PSA API test suite for
-the protected storage service in Isolation Level 2 on Linux.
-Both the compiler and the debugging type can be changed to other configurations
-listed above.
-
-.. list-table::
-   :widths: 20 80
-
-   * - -DPSA_API_TEST_BUILD_PATH=<path> (optional)
-     - Specifies the path to the PSA API build directory
-
-         - ``${TFM_ROOT_DIR}/../psa-arch-tests/api-tests/BUILD`` (default)
-
-   * - -D<PSA_API_TEST_xxx>=1 (choose exactly one)
-     - Specifies the service to support
-       The possible values are:
-
-         - ``PSA_API_TEST_ATTESTATION``
-         - ``PSA_API_TEST_CRYPTO``
-         - ``PSA_API_TEST_SECURE_STORAGE``
-         - ``PSA_API_TEST_INTERNAL_TRUSTED_STORAGE``
-
-.. code-block:: bash
-
-    cd <TF-M base folder>
-    cd <trusted-firmware-m folder>
-
-    mkdir <build folder>
-    pushd <build folder>
-    cmake ../ \
-        -G"Unix Makefiles" \
-        -DPROJ_CONFIG=`readlink -f ../configs/ConfigPsaApiTestIPCTfmLevel2.cmake` \
-        -DPSA_API_TEST_BUILD_PATH=../psa-arch-tests/api-tests/BUILD_PS.GNUARM
-        -DPSA_API_TEST_SECURE_STORAGE=1 \
-        -DTARGET_PLATFORM=psoc64 \
-        -DCOMPILER=ARMCLANG \
-        -DCMAKE_BUILD_TYPE=Debug
-    popd
-    cmake --build <build folder> -- -j VERBOSE=1
-
-**********************
-Signing the images
-**********************
-
-First, convert tfm_s.axf and tfm_ns.axf images to hex format. This also places
-resulting files one folder level up.
-
-GNUARM build:
-
-.. code-block:: bash
-
-    arm-none-eabi-objcopy -O ihex <build folder>/secure_fw/tfm_s.axf <build folder>/tfm_s.hex
-    arm-none-eabi-objcopy -O ihex <build folder>/app/tfm_ns.axf <build folder>/tfm_ns.hex
-
-ARMCLANG build:
-
-.. code-block:: bash
-
-    fromelf --i32 --output=<build folder>/tfm_s.hex <build folder>/secure_fw/tfm_s.axf
-    fromelf --i32 --output=<build folder>/tfm_ns.hex <build folder>/app/tfm_ns.axf
-
-Copy secure keys used in the board provisioning process to
-platform/ext/target/psoc64/security/keys:
-
-MCUBOOT_CM0P_KEY.json - private OEM key for signing CM0P image
-USERAPP_CM4_KEY.json  - private OEM key for signing CM4 image
-
-Note: provisioned board in SECURE claimed state is required, otherwise refer to
-Cypress documentation for details on the provisioning process.
-
-Sign the images (sign.py overwrites unsigned files with signed ones):
-
-.. code-block:: bash
-
-    ./platform/ext/target/psoc64/security/sign.py \
-      -s <build folder>/tfm_s.hex \
-      -n <build folder>/tfm_ns.hex \
-      -p platform/ext/target/psoc6/security/policy_dual_stage_CM0p_CM4.json
-
-**********************
-Programming the Device
-**********************
-
-After building and signing, the TFM images must be programmed into flash
-memory on the PSoC 6 device.
-
-There are two methods to program psoc6 device.
-
-DAPLink mode
-============
-
-Using KitProg3 mode button, switch it to DAPLink mode.
-Mode LED should start blinking rapidly and depending on the host computer
-settings DAPLINK will be mounted as a media storage device. 
-Otherwise, mount it manually.
-
-Copy tfm hex files one by one to the DAPLINK device:
-
-.. code-block:: bash
-
-    cp <build folder>/tfm_ns.hex <mount point>/DAPLINK/; sync
-    cp <build folder>/tfm_s.hex <mount point>/DAPLINK/; sync
-
-OpenOCD v.2.2
-=============
-
-Using KitProg3 mode button, switch to KitProg3 CMSIS-DAP BULK mode.
-Status LED should be ON and not blinking.
-To program the signed tfm_s image to the device with openocd (assuming
-OPENOCD_PATH is pointing at the openocd installation directory) run the
-following commands:
-
-.. code-block:: bash
-
-    ${OPENOCD_PATH}/bin/openocd \
-            -s ${OPENOCD_PATH}/scripts \
-            -f interface/kitprog3.cfg \
-            -c "set ENABLE_ACQUIRE 0" \
-            -f target/psoc6_secure.cfg \
-            -c "init; reset init; flash write_image erase <build folder>/tfm_s.hex" \
-            -c "resume; reset; exit"
-
-    ${OPENOCD_PATH}/bin/openocd \
-            -s ${OPENOCD_PATH}/scripts \
-            -f interface/kitprog3.cfg \
-            -c "set ENABLE_ACQUIRE 0" \
-            -f target/psoc6_secure.cfg \
-            -c "init; reset init; flash write_image erase <build folder>/tfm_ns.hex" \
-            -c "resume; reset; exit"
-
-Optionally, erase SST partition:
-
-.. code-block:: bash
-
-    ${OPENOCD_PATH}/bin/openocd \
-            -s ${OPENOCD_PATH}/scripts \
-            -f interface/kitprog3.cfg \
-            -f target/psoc6_secure.cfg \
-            -c "init; reset init" \
-            -c "flash erase_address 0x100c0000 0x10000" \
-            -c "shutdown"
-
-Note that the ``0x100C0000`` in the command above must match the SST start
-address of the secure primary image specified in the file:
-
-    platform/ext/target/psoc64/partition/flash_layout.h
-
-so be sure to change it if you change that file.
-
-*Copyright (c) 2017-2019, Arm Limited. All rights reserved.*
-
-*Copyright (c) 2019, Cypress Semiconductor Corporation. All rights reserved.*