Infineon: Add PSoC63, PSoC61 platforms, update hw crypto acceleration, allow build on CM4 build

Release notes:
1. Added platforms PSoC63, PSoC61
2. Added possibility to build MCUBootApp for CM4 core and BlinkyApp for CM0p
3. Updated cy-mbedtls-acceleration package to support mbedtls-3.0
4. Change CY_SMIF_SYSCLK_HFCLK_DIVIDER to achieve increased SMIF clock source
5. Improved memory map configuration in json files
6. Added optional performance measurement macros
7. Improved usage of FIH types in security critical code branches
8. Updated documentation
9. Improved MISRAa nd CERT-C compliance
10. Switch to latest mtb-pdl-cat1 3.0.0
11. Fixed minor bugs
diff --git a/boot/cypress/BlinkyApp/BlinkyApp.md b/boot/cypress/BlinkyApp/BlinkyApp.md
index f3f20da..4586a2c 100644
--- a/boot/cypress/BlinkyApp/BlinkyApp.md
+++ b/boot/cypress/BlinkyApp/BlinkyApp.md
@@ -1,18 +1,18 @@
-## Blinking LED test application for MCUBootApp bootloading application
+## Blinking LED test application for MCUBootApp bootloader application
 
 ### Description
 
-Implements a simple Blinky LED application to demonstrate the MCUBootApp bootloading application operation for the boot and upgrade processes.
+Implements a simple Blinky LED application to demonstrate the MCUBootApp bootloader application operation for the boot and upgrade processes.
 
 It is validated and started by MCUBootApp, which is running on the CM0p core of PSoC™ 6 devices, or CM33 core for the CYW20829 device.
 
 Functionality:
 
 * Blinks red LED with 2 different rates, depending on the image type - BOOT or UPGRADE.
-* Prints debug info and the appplication version to the terminal at baud rate 115200.
+* Prints debug info and the application version to the terminal at baud rate 115200.
 * Manages the watchdog-timer start in MCUBootApp as one of the confirmation mechanisms.
 * Sets a special bit in flash to confirm that the image is operable (UPGRADE image).
-* Can be built for boot slot or UPGRADE slot of the bootloader.
+* Can be built for BOOT slot or UPGRADE slot of the bootloader.
 * Can be used to evaluate `swap` and `overwrite only` upgrade modes.
 
 ### Hardware limitations
@@ -28,17 +28,17 @@
 
 `FLASH_MAP` `make` parameter is used to provide an input file for pre-build action. Refer to `MCUBootApp.md` for details.
 
-The result of pre-build script is auto-generated `flashmap.mk` file with a set of makefile flags:
+The result of the pre-build script is an auto-generated `flashmap.mk` file with a set of makefile flags:
 
-`PRIMARY_IMG_START` - start address of primary image in flash, this value is defined in the JSON flash map as the `"value"` field of the address section for `"application_#"`.
+`PRIMARY_IMG_START` - start address of the primary image in flash, this value is defined in the JSON flash map as the `"value"` field of the address section for `"application_#"`.
 
-`SECONDARY_IMG_START`- start address of secondary image in flash, this value is defined in the JSON flash map as the `"upgrade_address"` field of the `"address"` section for `"application_#"`.
+`SECONDARY_IMG_START`- start address of the secondary image in flash, this value is defined in the JSON flash map as the `"upgrade_address"` field of the `"address"` section for `"application_#"`.
 
 `SLOT_SIZE` - slot size for the primary and the secondary images, this value is taken from `"value"` field of `"size"` section of `"application_#"` from JSON file.
 
-`BOOTLOADER_SIZE` - size of Bootloader application, this value is defined in the JSON flash map as the `"size"` field of the address section for `"bootloader"`.
+`BOOTLOADER_SIZE` - size of the Bootloader application, this value is defined in the JSON flash map as the `"size"` field of the address section for `"bootloader"`.
 
-`USE_EXTERNAL_FLASH` - is set to 1 if flash map with `_smif` suffix is chosen.
+`USE_EXTERNAL_FLASH` - is set to 1 if a flash map with the `_smif` suffix is chosen.
 
 `USE_XIP` - is set to 1 if the "external_flash" section with "mode": "XIP" is present in the flash map file.
 
@@ -47,7 +47,7 @@
 `SLOT_SIZE ?= 0x40200` - for slot located in external flash of PsoC™ 6 kits
 `SLOT_SIZE ?= 0x20000` - for slot located in external flash of CYW20829 kits
 
-The pre-build action also calls the GCC preprocessor, which replaces the defines to particular values in `BlinkyApp_template.ld`.
+During pre-build action, the GCC preprocessor is used to generate the target linker script from a template `BlinkyApp_template.ld`.
 
 **Important (PSoC™ 6)**: ensure that the RAM areas of CM4-based BlinkyApp and CM0p-based MCUBootApp bootloader do not overlap.
 
@@ -55,60 +55,78 @@
 
 ### Building an application
 
+Toolchain is set by default in `toolchains.mk` file, depending on `COMPILER` makefile variable. MCUBoot is currently support only `GCC_ARM` as compiler. Toolchain path can be redefined, by setting `TOOLCHAIN_PATH` build flag to desired toolchain path. Below is an example on how to set toolchain path from **ModusToolbox™ IDE 3.0**:
+
+    make clean app APP_NAME=MCUBootApp PLATFORM=PSOC_062_2M BUILDCFG=Debug FLASH_MAP=platforms/cy_flash_pal/flash_psoc6/flashmap/psoc6_swap_single.json TOOLCHAIN_PATH=c:/Users/$(USERNAME)/ModusToolbox/tools_3.0/gcc
+
 The supported platforms:
 
 * PSOC_062_2M
 * PSOC_062_1M
 * PSOC_062_512K
+* PSOC_063_1M
 * CYW20829
 
-The root directory for build is **boot/cypress.**
+The root directory is boot/cypress.
+Since BlinkyApp built for BOOT or UPGRADE slot has its own folder BlinkyApp/out/boot or BlinkyApp/out/upgrade consider using following jobs to clear build folder before build.
 
-**Single-image**
-
-The following command will build BlinkyApp as a regular HEX file for the primary (BOOT) slot to be used in single image case with `swap` upgrade type of Bootloader:
-
-    make app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=BOOT FLASH_MAP=cy_flash_pal/flash_psoc6/flashmap/psoc62_swap_single.json IMG_ID=1
-
-To build an image for the secondary (UPGRADE) slot to be used in single image case with `swap` upgrade type of Bootloader:
-
-    make app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=cy_flash_pal/flash_psoc6/flashmap/psoc62_swap_single.json IMG_ID=1
-
-To build an image for the secondary (UPGRADE) slot to be used in single image case with `overwrite` upgrade type of Bootloader:
-
-    make app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=cy_flash_pal/flash_psoc6/flashmap/psoc62_overwrite_single.json IMG_ID=1
-
-**Multi-image**
-
-`BlinkyApp` can be built in multi-image bootloader configuration for PSoC™ 6 chips only.
-
-To obtain the appropriate hex files to use with multi-image MCUBootApp, makefile flag `IMG_ID` is used.
-
-`IMG_ID` flag value should correspond to `application_#` number of JSON file used for build. For example to build `BlinkyApp` for UPGRADE slot of second image following command is used:
-
-    make app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=cy_flash_pal/flash_psoc6/flashmap/psoc62_overwrite_single.json IMG_ID=2
-
-When this option is omitted, `IMG_ID=1` is assumed.
+The root directory for is **boot/cypress.**   
+Since BlinkyApp built for BOOT or UPGRADE slot has its own folder `BlinkyApp/out/boot` or `BlinkyApp/out/upgrade` consider using following jobs to clear build folder before build:   
+ - **clean_boot** - to clean the BOOT image directory
+ - **clean_upgrade** - to clean the UPGRADE image directory.   
+ 
+These jobs also remove auto-generated files 'flashmap.mk' and 'cy_flash_map.h', which is required to eliminate possible errors.   
 
 **Upgrade mode dependency**
 
-`MCUBootApp` can upgrade an image either by overwriting the image from a secondary slot to a primary slot or by swapping the two images.
+`MCUBootApp` can upgrade an image either by overwriting the image from a secondary slot to a primary slot or by swapping the two images.  
+To build `BlinkyApp` for different upgrade modes choose flash map JSON file with the corresponding suffix - either `_swap_` or `_overwrite_`.  
+But hold in the mind, that `MCUBootApp` and `BlinkyApp` should use the same flash map file!  
+For example: to building `MCUBootApp` and `BlinkyApp` in the 'single overwride' mode use the flash map file:   
+`FLASH_MAP=platforms/cy_flash_pal/flash_psoc6/flashmap/psoc6_overwrite_single.json`  
 
-To build `BlinkyApp` for different upgrade mode choose flash map JSON file with the corresponding suffix - either _swap_ or _overwrite_.
+**Single-image**
+
+The following command will build BlinkyApp as a regular HEX file for the primary (BOOT) slot to be used in a single image case with `swap` upgrade type of Bootloader:
+
+    make clean_boot app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=BOOT FLASH_MAP=platforms/cy_flash_pal/flash_psoc6/flashmap/psoc6_swap_single.json IMG_ID=1
+
+To build an image for the secondary (UPGRADE) slot to be used in a single image case with `swap` upgrade type of Bootloader:
+
+    make clean_upgrade app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=platforms/cy_flash_pal/flash_psoc6/flashmap/psoc6_swap_single.json IMG_ID=1
+
+To build an image for the secondary (UPGRADE) slot to be used in a single image case with `overwrite` upgrade type of Bootloader:
+
+    make clean_upgrade app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=platforms/cy_flash_pal/flash_psoc6/flashmap/psoc6_overwrite_single.json IMG_ID=1
+
+**Multi-image**
+
+**NOTE!** `MCUBootApp` should be build with multi-image support as well. Refer to the appropriated section of [MCUBootApp.md](../MCUBootApp/MCUBootApp.md).   
+
+`BlinkyApp` can be built in multi-image bootloader configuration for PSoC™ 6 chips only.
+
+To obtain the appropriate hex files to use with multi-image MCUBootApp, the makefile flag `IMG_ID` is used.
+
+`IMG_ID` flag value should correspond to the `application_#` number of JSON flash map file used for the build. For example, to build `BlinkyApp` for the UPGRADE slot of the second image following command is used:
+
+    make clean_upgrade app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=platforms/cy_flash_pal/flash_psoc6/flashmap/psoc6_overwrite_single.json IMG_ID=2
+
+When this option is omitted, `IMG_ID=1` is assumed.    
 
 **Upgrade image for external memory (PSoC™ 6)**
+__NOTE__: Not supported with `PSoC™ 063` kits.
 
 To prepare MCUBootApp for work with external memory, refer to [ExternalMemory.md](../MCUBootApp/ExternalMemory.md).
 
-To build a `BlinkyApp` upgrade image for external memory to be used in single image configuration with overwrite upgrade mode, use command:
+To build a `BlinkyApp` upgrade image for external memory to be used in a single image configuration with overwrite upgrade mode, use the command:
 
-    make app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=cy_flash_pal/flash_psoc6/flashmap/psoc62_overwrite_single_smif.json IMG_ID=1
+    make clean_upgrade app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=platforms/cy_flash_pal/flash_psoc6/flashmap/psoc6_overwrite_single_smif.json IMG_ID=1
 
 `ERASED_VALUE` defines the memory cell contents in the erased state. It is `0x00` for PSoC™ 6 internal flash and `0xff` for S25FL512S. For `CYW20289` default value is `0xff` since it only uses an external flash.
 
-In multi-image configuration, an upgrade image for the second application is built using command:
+In the multi-image configuration, an upgrade image for the second application is built using the command:
 
-    make app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=cy_flash_pal/flash_psoc6/flashmap/psoc62_overwrite_multi_smif.json IMG_ID=2
+    make clean_upgrade app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=platforms/cy_flash_pal/flash_psoc6/flashmap/psoc6_overwrite_multi_smif.json IMG_ID=2
 
 **Encrypted upgrade image**
 
@@ -116,11 +134,11 @@
 
 To obtain an encrypted upgrade image of BlinkyApp, pass extra flag `ENC_IMG=1` in the command line, for example:
 
-    make app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=cy_flash_pal/flash_psoc6/flashmap/psoc62_overwrite_single_smif.json IMG_ID=1 ENC_IMG=1
+    make clean_upgrade app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=UPGRADE FLASH_MAP=platforms/cy_flash_pal/flash_psoc6/flashmap/psoc6_overwrite_single.json IMG_ID=1 ENC_IMG=1
 
-This also suggests that the user has already placed a corresponding *.pem key in the \keys folder. The key variables are defined in root Makefile as SIGN_KEY_FILE and ENC_KEY_FILE
+This also suggests that the user has already placed a corresponding *.pem key in the \keys folder. The key variables are defined in the root Makefile as SIGN_KEY_FILE and ENC_KEY_FILE
 
-Refer to [CYW20829.md](../platforms/CYW20829/CYW20829.md) for details of encrypted image build for the CYW20289 platfrom.
+Refer to [CYW20829.md](../platforms/CYW20829.md) for details of encrypted image build for the CYW20289 platfrom.
 
 ### Complete build flags description
 - `BUILDCFG` - The configuration type
@@ -137,16 +155,16 @@
 - `SLOT_SIZE` - The size of the primary/secondary slot of MCUBootApp. This app will be used with
     - 0x%VALUE%
 - `IMG_TYPE` - The slot of MCUBootApp, for which the image is being built.
-    - `BOOT` (default) - A build image for the primary (BOOT) slot.
-    - `UPGRADE` - A build image for the secondary (UPGRADE) slot.
+    - `BOOT (default)` - to build an image for the primary (BOOT) slot.
+    - `UPGRADE` - to build an image for the secondary (UPGRADE) slot.
 - `ERASED_VALUE` - Define memory cell contents in the erased state.
     - `0x0` - Internal memory.
     - `0xff` - External memory.
-- `TOOLCHAIN_PATH` - The path to the GCC compiler to use for build.
+- `TOOLCHAIN_PATH` - The path to the GCC compiler to use for the build.
     - Example: TOOLCHAIN_PATH=/home/user/ModusToolbox/tools_2.4/gcc
     - Example: TOOLCHAIN_PATH=C:/ModusToolbox/tools_2.4/gcc
 
-Flags set by pre-build action.
+Flags are set by pre-build action. Result of pre-build can be found in autogenerated file `BlinkyApp/flashmap.mk`.   
 
 - `USE_OVERWRITE` - Define the Upgrade mode type of `MCUBootApp` to use with this app.
     - `1` - For Overwrite mode.
@@ -168,7 +186,7 @@
 
 ### How to program an application
 
-BlinkyApp firmware can be programmed in different ways. The following instructions assume the usage of one of Cypress development kits, for example `CY8CPROTO_062_4343W`.
+BlinkyApp firmware can be programmed in different ways. The following instructions assume the usage of one of Cypress development kits, for example, `CY8CPROTO_062_4343W`.
 
 1. Direct usage of OpenOCD.
 
@@ -176,13 +194,13 @@
 
 The OpenOCD package is supplied with ModusToolbox™ IDE and can be found in the ModusToolbox™ installation folder `ModusToolbox/tools_2.4/openocd`.
 
-Open the terminal application and execute the following command after substitution of the `PATH_TO_APPLICATION.hex` and `OPENOCD` paths:
+Open the terminal application and execute the following command after substitution of the `PATH_TO_APPLICATION.hex` and `OPENOCD_PATH` paths:
 
-        export OPENOCD=/Applications/ModusToolbox/tools_2.4/openocd 
+        export OPENOCD_PATH=/Applications/ModusToolbox/tools_2.4/openocd 
 
-        ${OPENOCD}/bin/openocd -s ${OPENOCD}/scripts \
-                            -f ${OPENOCD}/scripts/interface/kitprog3.cfg \
-                            -f ${OPENOCD}/scripts/target/psoc6_2m.cfg \
+        ${OPENOCD_PATH}/bin/openocd -s ${OPENOCD_PATH}/scripts \
+                            -f ${OPENOCD_PATH}/scripts/interface/kitprog3.cfg \
+                            -f ${OPENOCD_PATH}/scripts/target/psoc6_2m.cfg \
                             -c "init; reset init; program PATH_TO_APPLICATION.hex" \
                             -c "resume; reset; exit" 
 
@@ -240,8 +258,8 @@
     [BlinkyApp] UART initialized 
     [BlinkyApp] Retarget I/O set to 115200 baudrate 
     [BlinkyApp] Red led blinks with 1 sec period
-    [BlinkyApp] Update watchdog timer started in MCUBootApp to mark sucessful start of user app
-    [BlinkyApp] Turn off watchdog timer
+    [BlinkyApp] Update watchdog timer started in MCUBootApp to mark the successful start of the user app
+    [BlinkyApp] Turn off the watchdog timer
 
 When the user application is programmed in the upgrade slot and the upgrade procedure was successful:
 
@@ -252,7 +270,7 @@
     [BlinkyApp] UART initialized 
     [BlinkyApp] Retarget I/O set to 115200 baudrate 
     [BlinkyApp] Red led blinks with 0.25 sec period
-    [BlinkyApp] Update watchdog timer started in MCUBootApp to mark sucessful start of user app
-    [BlinkyApp] Turn off watchdog timer
-    [BlinkyApp] Try to set img_ok to confirm upgrade image
+    [BlinkyApp] Update watchdog timer started in MCUBootApp to mark the successful start of the user app
+    [BlinkyApp] Turn off the watchdog timer
+    [BlinkyApp] Try to set img_ok to confirm the upgrade image
     [BlinkyApp] SWAP Status : Image OK was set at 0x10027fe8.
diff --git a/boot/cypress/BlinkyApp/BlinkyApp.mk b/boot/cypress/BlinkyApp/BlinkyApp.mk
index d06cd99..18cbfcf 100644
--- a/boot/cypress/BlinkyApp/BlinkyApp.mk
+++ b/boot/cypress/BlinkyApp/BlinkyApp.mk
@@ -41,21 +41,24 @@
 
 ifneq ($(FLASH_MAP), )
 $(CUR_APP_PATH)/flashmap.mk:
-	$(PYTHON_PATH) scripts/flashmap.py -p $(PLATFORM) -i $(FLASH_MAP) -o $(PRJ_DIR)/cy_flash_pal/cy_flash_map.h -d $(IMG_ID) > $(CUR_APP_PATH)/flashmap.mk
+	$(PYTHON_PATH) scripts/flashmap.py -p $(PLATFORM) -m -i $(FLASH_MAP) -o $(PRJ_DIR)/platforms/cy_flash_pal/cy_flash_map.h -d $(IMG_ID) > $(CUR_APP_PATH)/flashmap.mk
 include $(CUR_APP_PATH)/flashmap.mk
 DEFINES_APP := -DCY_FLASH_MAP_JSON
 endif
 
 # TODO: optimize here and in MCUBootApp.mk
 # Output folder
-OUT := $(APP_NAME)/out
+ifeq ($(IMG_ID), 1)
+        OUT := $(APP_NAME)/out
+else
+        OUT := $(APP_NAME)/out.id$(IMG_ID)
+endif
+
 # Output folder to contain build artifacts
 OUT_TARGET := $(OUT)/$(PLATFORM)
 
 OUT_CFG := $(OUT_TARGET)/$(BUILDCFG)
 
-BOOTLOADER_SIZE ?= $(PLATFORM_BOOTLOADER_SIZE)
-
 # Set build directory for BOOT and UPGRADE images
 ifeq ($(IMG_TYPE), UPGRADE)
 	OUT_CFG := $(OUT_CFG)/upgrade
@@ -112,18 +115,48 @@
 DEFINES_APP += -DUSER_APP_START=$(USER_APP_START)
 DEFINES_APP += -DPRIMARY_IMG_START=$(PRIMARY_IMG_START)
 DEFINES_APP += -DUSER_APP_SIZE=$(SLOT_SIZE)
+DEFINES_APP += -DAPP_$(APP_CORE)
 DEFINES_APP += $(PLATFORM_DEFINES_APP)
 
+#Use default led if no command line parameter added
+ifeq ($(LED_PORT), )
+DEFINES_APP += -DLED_PORT=$(LED_PORT_DEFAULT)
+else
+DEFINES_APP += -DLED_PORT=GPIO_PRT$(LED_PORT)
+endif
+
+ifeq ($(LED_PIN), )
+DEFINES_APP += -DLED_PIN=$(LED_PIN_DEFAULT)
+else
+DEFINES_APP += -DLED_PIN=$(LED_PIN)
+endif
+
+#Use default UART if no command line parameter added
+ifeq ($(UART_TX), )
+DEFINES_APP += -DCY_DEBUG_UART_TX=$(UART_TX_DEFAULT)
+else
+DEFINES_APP += -DCY_DEBUG_UART_TX=$(UART_TX)
+endif
+
+ifeq ($(UART_RX), )
+DEFINES_APP += -DCY_DEBUG_UART_RX=$(UART_RX_DEFAULT)
+else
+DEFINES_APP += -DCY_DEBUG_UART_RX=$(UART_RX)
+endif
+
 ifeq ($(USE_XIP), 1)
 DEFINES_APP += -DUSE_XIP
+DEFINES_APP += -DCY_BOOT_USE_EXTERNAL_FLASH
 LD_SUFFIX = _xip
 endif
 
 # Add version metadata to image
 ifneq ($(IMG_VER), )
 IMG_VER_ARG = -v "$(IMG_VER)"
+DEFINES_APP += -DIMG_VER_MSG=\"$(IMG_VER)\"
 else
-IMG_VER_ARG = $(PLATFORM_DEFAULT_IMG_VER_ARG)
+IMG_VER_ARG = -v "$(PLATFORM_DEFAULT_IMG_VER_ARG)"
+DEFINES_APP += -DIMG_VER_MSG=\"$(PLATFORM_DEFAULT_IMG_VER_ARG)\"
 $(info WARNING - setting platform default version number, to set custom value - pass IMG_VER=x.x.x argument to make command)
 endif
 
@@ -137,13 +170,6 @@
 # Collect Test Application sources
 SOURCES_APP_SRC := $(wildcard $(CUR_APP_PATH)/*.c)
 
-# Include confirmation flag setting (img_ok) implementation
-ifeq ($(IMG_TYPE), UPGRADE)
-ifeq ($(USE_OVERWRITE), 0)
-SOURCES_APP_SRC += $(PRJ_DIR)/platforms/$(FAMILY)/img_confirm/set_img_ok.c
-endif
-endif
-
 # Set offset for secondary image
 ifeq ($(IMG_TYPE), UPGRADE)
 HEADER_OFFSET := $(SECONDARY_IMG_START)
@@ -168,6 +194,14 @@
 INCLUDE_DIRS_APP += $(addprefix -I, $(PRJ_DIR)/../bootutil/include/bootutil)
 # +++
 
+# Include confirmation flag setting (img_ok) implementation
+ifeq ($(IMG_TYPE), UPGRADE)
+ifeq ($(USE_OVERWRITE), 0)
+SOURCES_APP_SRC += $(PRJ_DIR)/platforms/img_confirm/$(FAMILY)/set_img_ok.c
+INCLUDE_DIRS_APP += $(addprefix -I, $(PRJ_DIR)/platforms/img_confirm)
+endif
+endif
+
 # Overwite path to linker script if custom is required, otherwise default from BSP is used
 ifeq ($(COMPILER), GCC_ARM)
 LINKER_SCRIPT := $(CUR_APP_PATH)/linker/$(APP_NAME).ld
@@ -183,6 +217,17 @@
 UPGRADE_TYPE := --overwrite-only
 endif
 
+ifeq ($(BOOT_RECORD_SW_TYPE), )
+	ifeq ($(IMG_TYPE), BOOT)
+		BOOT_RECORD_IMG_TYPE_STR = B_Blinky$(IMG_ID)
+	else
+		BOOT_RECORD_IMG_TYPE_STR = U_Blinky$(IMG_ID)
+	endif
+	BOOT_RECORD := --boot-record $(BOOT_RECORD_IMG_TYPE_STR)
+else
+	BOOT_RECORD := --boot-record $(BOOT_RECORD_SW_TYPE)
+endif
+
 SIGN_ARGS := $(PLATFORM_SIGN_ARGS) $(IMG_VER_ARG) $(IMG_DEPS_ARG)
 
 # Set parameters needed for signing
@@ -204,51 +249,68 @@
 # Print debug information about all settings used and/or set in this file
 ifeq ($(VERBOSE), 1)
 $(info #### BlinkyApp.mk ####)
+$(info APP_CORE <-- $(APP_CORE))
 $(info APP_NAME <-- $(APP_NAME))
-$(info ASM_FILES_APP <-> $(ASM_FILES_APP))
+$(info ASM_FILES_APP --> $(ASM_FILES_APP))
 $(info ASM_FILES_STARTUP <-- $(ASM_FILES_STARTUP))
+$(info BOOT_RECORD --> $(BOOT_RECORD))
+$(info BOOT_RECORD_IMG_TYPE_STR <-- $(BOOT_RECORD_IMG_TYPE_STR))
+$(info BOOT_RECORD_SW_TYPE <-- $(BOOT_RECORD_SW_TYPE))
 $(info BUILDCFG <-- $(BUILDCFG))
-$(info CC <-- $(CC))
-$(info CFLAGS <-- $(CFLAGS))
 $(info COMPILER <-> $(COMPILER))
 $(info CONFIRM <-- $(CONFIRM))
-$(info CORE <-- $(CORE))
 $(info CURDIR <-- $(CURDIR))
 $(info CUR_APP_PATH <-- $(CUR_APP_PATH))
-$(info DEFINES_APP <-> $(DEFINES_APP))
+$(info DEFINES_APP --> $(DEFINES_APP))
 $(info ENC_IMG --> $(ENC_IMG))
 $(info ERASED_VALUE <-> $(ERASED_VALUE))
+$(info FAMILY <-- $(FAMILY))
+$(info FLASH_MAP <-- $(FLASH_MAP))
+$(info HEADER_OFFSET --> $(HEADER_OFFSET))
+$(info IMG_DEPS_ARG <-- $(IMG_DEPS_ARG))
+$(info IMG_DEPS_ID <-- $(IMG_DEPS_ID))
+$(info IMG_DEPS_VER <-- $(IMG_DEPS_VER))
+$(info IMG_ID <-> $(IMG_ID))
 $(info IMG_TYPE <-> $(IMG_TYPE))
-$(info INCLUDE_DIRS <-- $(INCLUDE_DIRS))
-$(info INCLUDE_DIRS_APP <-> $(INCLUDE_DIRS_APP))
-$(info LINKER_SCRIPT <-> $(LINKER_SCRIPT))
+$(info IMG_VER <-- $(IMG_VER))
+$(info IMG_VER_ARG <-- $(IMG_VER_ARG))
+$(info INCLUDE_DIRS_APP --> $(INCLUDE_DIRS_APP))
+$(info LED_PIN <-- $(LED_PIN))
+$(info LED_PIN_DEFAULT <-- $(LED_PIN_DEFAULT))
+$(info LED_PORT <-- $(LED_PORT))
+$(info LED_PORT_DEFAULT <-- $(LED_PORT_DEFAULT))
+$(info LINKER_SCRIPT --> $(LINKER_SCRIPT))
 $(info OUT <-> $(OUT))
 $(info OUT_CFG <-> $(OUT_CFG))
 $(info OUT_TARGET <-> $(OUT_TARGET))
 $(info PLATFORM <-- $(PLATFORM))
 $(info PLATFORM_DEFAULT_ERASED_VALUE <-- $(PLATFORM_DEFAULT_ERASED_VALUE))
+$(info PLATFORM_DEFAULT_IMG_VER_ARG <-- $(PLATFORM_DEFAULT_IMG_VER_ARG))
 $(info PLATFORM_DEFAULT_RAM_SIZE <-- $(PLATFORM_DEFAULT_RAM_SIZE))
 $(info PLATFORM_DEFAULT_RAM_START <-- $(PLATFORM_DEFAULT_RAM_START))
-$(info PLATFORM_DEFAULT_SLOT_SIZE <-- $(PLATFORM_DEFAULT_SLOT_SIZE))
-$(info PLATFORM_DEFAULT_USER_APP_START <-- $(PLATFORM_DEFAULT_USER_APP_START))
-$(info PLATFORM_DEFAULT_PRIMARY_IMG_START <-- $(PLATFORM_DEFAULT_PRIMARY_IMG_START))
 $(info PLATFORM_DEFAULT_USE_OVERWRITE <-- $(PLATFORM_DEFAULT_USE_OVERWRITE))
 $(info PLATFORM_DEFINES_APP <-- $(PLATFORM_DEFINES_APP))
 $(info PLATFORM_INCLUDE_DIRS_FLASH <-- $(PLATFORM_INCLUDE_DIRS_FLASH))
 $(info PLATFORM_SIGN_ARGS <-- $(PLATFORM_SIGN_ARGS))
 $(info PLATFORM_SOURCES_FLASH <-- $(PLATFORM_SOURCES_FLASH))
+$(info PLATFORM_USER_APP_START <-- $(PLATFORM_USER_APP_START))
+$(info PRIMARY_IMG_START <-- $(PRIMARY_IMG_START))
 $(info PRJ_DIR <-- $(PRJ_DIR))
-$(info IMG_VER_ARG <-- $(IMG_VER_ARG))
-$(info IMG_DEPS_ARG <-- $(IMG_DEPS_ARG))
+$(info PYTHON_PATH <-- $(PYTHON_PATH))
+$(info SECONDARY_IMG_START <-- $(SECONDARY_IMG_START))
 $(info SIGN_ARGS <-> $(SIGN_ARGS))
-$(info SLOT_SIZE <-> $(SLOT_SIZE))
-$(info SOURCES_APP <-> $(SOURCES_APP))
+$(info SLOT_SIZE <-- $(SLOT_SIZE))
+$(info SOURCES_APP --> $(SOURCES_APP))
 $(info SOURCES_APP_SRC <-> $(SOURCES_APP_SRC))
+$(info UART_RX <-- $(UART_RX))
+$(info UART_RX_DEFAULT <-- $(UART_RX_DEFAULT))
+$(info UART_TX <-- $(UART_TX))
+$(info UART_TX_DEFAULT <-- $(UART_TX_DEFAULT))
 $(info UPGRADE_SUFFIX --> $(UPGRADE_SUFFIX))
 $(info UPGRADE_TYPE --> $(UPGRADE_TYPE))
 $(info USER_APP_RAM_SIZE <-> $(USER_APP_RAM_SIZE))
 $(info USER_APP_RAM_START <-> $(USER_APP_RAM_START))
 $(info USER_APP_START <-> $(USER_APP_START))
-$(info PRIMARY_IMG_START <-> $(PRIMARY_IMG_START))
 $(info USE_OVERWRITE <-> $(USE_OVERWRITE))
+$(info USE_XIP <-- $(USE_XIP))
 endif
diff --git a/boot/cypress/BlinkyApp/libs.mk b/boot/cypress/BlinkyApp/libs.mk
index 08fc130..ff8637b 100644
--- a/boot/cypress/BlinkyApp/libs.mk
+++ b/boot/cypress/BlinkyApp/libs.mk
@@ -32,23 +32,36 @@
 
 # Collect source files for Retarget-io
 ifneq ($(PLATFORM), CYW20829)
+ifeq ($(APP_CORE), CM0P)
+SOURCES_RETARGET_IO := $(wildcard $(THIS_APP_PATH)/retarget_io_pdl/*.c)
+endif
+ifneq ($(APP_CORE), CM0P)
 SOURCES_RETARGET_IO := $(wildcard $(CUR_LIBS_PATH)/retarget-io/*.c)
 endif
+endif
 SOURCES_WATCHDOG := $(wildcard $(CUR_LIBS_PATH)/watchdog/*.c)
 
 # Collect source files for HAL
 ifneq ($(PLATFORM), CYW20829)
+ifneq ($(APP_CORE), CM0P)
 SOURCES_HAL_BLINKY := $(wildcard $(CUR_LIBS_PATH)/mtb-hal-cat1/source/*.c)
 SOURCES_HAL_BLINKY += $(wildcard $(CUR_LIBS_PATH)/mtb-hal-cat1/COMPONENT_CAT1A/source/triggers/*.c)
 SOURCES_HAL_BLINKY += $(wildcard $(CUR_LIBS_PATH)/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/*.c)
 endif
+endif
 
 # Retarget-io related include directories
+ifeq ($(APP_CORE), CM0P)
+INCLUDE_DIRS_RETARGET_IO := $(THIS_APP_PATH)/retarget_io_pdl
+endif
+ifneq ($(APP_CORE), CM0P)
 INCLUDE_DIRS_RETARGET_IO := $(CUR_LIBS_PATH)/retarget-io
+endif
 INCLUDE_DIRS_WATCHDOG := $(CUR_LIBS_PATH)/watchdog
 
 # Collect dirrectories containing headers for PSOC6 HAL
 ifneq ($(PLATFORM), CYW20829)
+ifneq ($(APP_CORE), CM0P)
 INCLUDE_DIRS_HAL_BLINKY := $(CUR_LIBS_PATH)/mtb-hal-cat1/COMPONENT_CAT1A
 INCLUDE_DIRS_HAL_BLINKY := $(CUR_LIBS_PATH)/mtb-hal-cat1/COMPONENT_CAT1A/include
 INCLUDE_DIRS_HAL_BLINKY += $(CUR_LIBS_PATH)/mtb-hal-cat1/include
@@ -56,6 +69,7 @@
 INCLUDE_DIRS_HAL_BLINKY += $(CUR_LIBS_PATH)/mtb-hal-cat1/COMPONENT_CAT1A/include/pin_packages
 INCLUDE_DIRS_HAL_BLINKY += $(CUR_LIBS_PATH)/mtb-hal-cat1/COMPONENT_CAT1A/include/triggers
 endif
+endif
 
 # Collected source files for libraries
 SOURCES_LIBS += $(SOURCES_WATCHDOG)
@@ -75,6 +89,7 @@
 # Print debug information about all settings used and/or set in this file
 ifeq ($(VERBOSE), 1)
 $(info #### libs.mk ####)
+$(info APP_CORE <-- $(APP_CORE))
 $(info CUR_LIBS_PATH <-- $(CUR_LIBS_PATH))
 $(info INCLUDE_DIRS_HAL_BLINKY <-> $(INCLUDE_DIRS_HAL_BLINKY))
 $(info INCLUDE_DIRS_LIBS --> $(INCLUDE_DIRS_LIBS))
@@ -86,4 +101,5 @@
 $(info SOURCES_LIBS --> $(SOURCES_LIBS))
 $(info SOURCES_RETARGET_IO <-> $(SOURCES_RETARGET_IO))
 $(info SOURCES_WATCHDOG <-> $(SOURCES_WATCHDOG))
+$(info THIS_APP_PATH <-- $(THIS_APP_PATH))
 endif
diff --git a/boot/cypress/BlinkyApp/linker/BlinkyApp_CM0P_template.ld b/boot/cypress/BlinkyApp/linker/BlinkyApp_CM0P_template.ld
new file mode 100644
index 0000000..b7044a7
--- /dev/null
+++ b/boot/cypress/BlinkyApp/linker/BlinkyApp_CM0P_template.ld
@@ -0,0 +1,347 @@
+/***************************************************************************//**
+* \file cy8c6xxa_cm0plus.ld
+* \version 2.91
+*
+* Linker file for the GNU C compiler.
+*
+* The main purpose of the linker script is to describe how the sections in the
+* input files should be mapped into the output file, and to control the memory
+* layout of the output file.
+*
+* \note The entry point location is fixed and starts at 0x100E0000. The valid
+* application image should be placed there.
+*
+* \note The linker files included with the PDL template projects must be generic
+* and handle all common use cases. Your project may not use every section
+* defined in the linker files. In that case you may see warnings during the
+* build process. In your project, you can simply comment out or remove the
+* relevant code in the linker file.
+*
+********************************************************************************
+* \copyright
+* Copyright 2016-2022 Cypress Semiconductor Corporation (an Infineon company) or
+* an affiliate of Cypress Semiconductor Corporation
+* SPDX-License-Identifier: Apache-2.0
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*******************************************************************************/
+#include <main.h>
+
+OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
+SEARCH_DIR(.)
+GROUP(-lgcc -lc -lnosys)
+ENTRY(Reset_Handler)
+
+/* The size of the stack section at the end of CM0+ SRAM */
+STACK_SIZE = 0x1000;
+
+/* The size of the MCU boot header area at the start of FLASH */
+BOOT_HEADER_SIZE = 0x400;
+
+/* Force symbol to be entered in the output file as an undefined symbol. Doing
+* this may, for example, trigger linking of additional modules from standard
+* libraries. You may list several symbols for each EXTERN, and you may use
+* EXTERN multiple times. This command has the same effect as the -u command-line
+* option.
+*/
+EXTERN(Reset_Handler)
+
+/* The MEMORY section below describes the location and size of blocks of memory in the target.
+* Use this section to specify the memory regions available for allocation.
+*/
+MEMORY
+{
+    /* The ram and flash regions control RAM and flash memory allocation for the CM0+ core.
+     */
+    ram               (rwx)   : ORIGIN = USER_APP_RAM_START, LENGTH = USER_APP_RAM_SIZE
+    flash             (rx)    : ORIGIN = USER_APP_START, LENGTH = USER_APP_SIZE
+
+    /* This is a 32K flash region used for EEPROM emulation. This region can also be used as the general purpose flash.
+     * You can assign sections to this memory region for only one of the cores.
+     * Note some middleware (e.g. BLE, Emulated EEPROM) can place their data into this memory region.
+     * Therefore, repurposing this memory region will prevent such middleware from operation.
+     */
+    em_eeprom         (rx)    : ORIGIN = 0x14000000, LENGTH = 0x8000       /*  32 KB */
+
+    /* The following regions define device specific memory regions and must not be changed. */
+    xip               (rx)    : ORIGIN = 0x18000000, LENGTH = 0x8000000    /* 128 MB */
+}
+
+/* Library configurations */
+GROUP(libgcc.a libc.a libm.a libnosys.a)
+
+/* Linker script to place sections and symbol values. Should be used together
+ * with other linker script that defines memory regions FLASH and RAM.
+ * It references following symbols, which must be defined in code:
+ *   Reset_Handler : Entry of reset handler
+ *
+ * It defines following symbols, which code can use without definition:
+ *   __exidx_start
+ *   __exidx_end
+ *   __copy_table_start__
+ *   __copy_table_end__
+ *   __zero_table_start__
+ *   __zero_table_end__
+ *   __etext
+ *   __data_start__
+ *   __preinit_array_start
+ *   __preinit_array_end
+ *   __init_array_start
+ *   __init_array_end
+ *   __fini_array_start
+ *   __fini_array_end
+ *   __data_end__
+ *   __bss_start__
+ *   __bss_end__
+ *   __end__
+ *   end
+ *   __HeapLimit
+ *   __StackLimit
+ *   __StackTop
+ *   __stack
+ *   __Vectors_End
+ *   __Vectors_Size
+ */
+
+
+SECTIONS
+{
+    /* Cortex-M0+ application flash area */
+    .text ORIGIN(flash) + BOOT_HEADER_SIZE :
+    {
+        /* Cortex-M0+ flash vector table */
+        . = ALIGN(4);
+        __Vectors = . ;
+        KEEP(*(.vectors))
+        . = ALIGN(4);
+        __Vectors_End = .;
+        __Vectors_Size = __Vectors_End - __Vectors;
+        __end__ = .;
+
+        . = ALIGN(4);
+        *(.text*)
+
+        KEEP(*(.init))
+        KEEP(*(.fini))
+
+        /* .ctors */
+        *crtbegin.o(.ctors)
+        *crtbegin?.o(.ctors)
+        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+        *(SORT(.ctors.*))
+        *(.ctors)
+
+        /* .dtors */
+        *crtbegin.o(.dtors)
+        *crtbegin?.o(.dtors)
+        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+        *(SORT(.dtors.*))
+        *(.dtors)
+
+        /* Read-only code (constants). */
+        *(.rodata .rodata.* .constdata .constdata.* .conststring .conststring.*)
+
+        KEEP(*(.eh_frame*))
+    } > flash
+
+
+    .ARM.extab :
+    {
+        *(.ARM.extab* .gnu.linkonce.armextab.*)
+    } > flash
+
+    __exidx_start = .;
+
+    .ARM.exidx :
+    {
+        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+    } > flash
+    __exidx_end = .;
+
+
+    /* To copy multiple ROM to RAM sections,
+     * uncomment .copy.table section and,
+     * define __STARTUP_COPY_MULTIPLE in startup_psoc6_02_cm0plus.S */
+    .copy.table :
+    {
+        . = ALIGN(4);
+        __copy_table_start__ = .;
+
+        /* Copy interrupt vectors from flash to RAM */
+        LONG (__Vectors)                                    /* From */
+        LONG (__ram_vectors_start__)                        /* To   */
+        LONG (__Vectors_End - __Vectors)                    /* Size */
+
+        /* Copy data section to RAM */
+        LONG (__etext)                                      /* From */
+        LONG (__data_start__)                               /* To   */
+        LONG (__data_end__ - __data_start__)                /* Size */
+
+        __copy_table_end__ = .;
+    } > flash
+
+
+    /* To clear multiple BSS sections,
+     * uncomment .zero.table section and,
+     * define __STARTUP_COPY_MULTIPLE in startup_psoc6_02_cm0plus.S */
+    .zero.table :
+    {
+        . = ALIGN(4);
+        __zero_table_start__ = .;
+        LONG (__bss_start__)
+        LONG (__bss_end__ - __bss_start__)
+        __zero_table_end__ = .;
+    } > flash
+
+    __etext =  . ;
+
+
+    .ramVectors (NOLOAD) : ALIGN(8)
+    {
+        __ram_vectors_start__ = .;
+        KEEP(*(.ram_vectors))
+        __ram_vectors_end__   = .;
+    } > ram
+
+
+    .data __ram_vectors_end__ :
+    {
+        . = ALIGN(4);
+        __data_start__ = .;
+
+        *(vtable)
+        *(.data*)
+
+        . = ALIGN(4);
+        /* preinit data */
+        PROVIDE_HIDDEN (__preinit_array_start = .);
+        KEEP(*(.preinit_array))
+        PROVIDE_HIDDEN (__preinit_array_end = .);
+
+        . = ALIGN(4);
+        /* init data */
+        PROVIDE_HIDDEN (__init_array_start = .);
+        KEEP(*(SORT(.init_array.*)))
+        KEEP(*(.init_array))
+        PROVIDE_HIDDEN (__init_array_end = .);
+
+        . = ALIGN(4);
+        /* finit data */
+        PROVIDE_HIDDEN (__fini_array_start = .);
+        KEEP(*(SORT(.fini_array.*)))
+        KEEP(*(.fini_array))
+        PROVIDE_HIDDEN (__fini_array_end = .);
+
+        KEEP(*(.jcr*))
+        . = ALIGN(4);
+
+        KEEP(*(.cy_ramfunc*))
+        . = ALIGN(4);
+
+        __data_end__ = .;
+
+    } > ram AT>flash
+
+
+    /* Place variables in the section that should not be initialized during the
+    *  device startup.
+    */
+    .noinit (NOLOAD) : ALIGN(8)
+    {
+      KEEP(*(.noinit))
+    } > ram
+
+
+    /* The uninitialized global or static variables are placed in this section.
+    *
+    * The NOLOAD attribute tells linker that .bss section does not consume
+    * any space in the image. The NOLOAD attribute changes the .bss type to
+    * NOBITS, and that  makes linker to A) not allocate section in memory, and
+    * A) put information to clear the section with all zeros during application
+    * loading.
+    *
+    * Without the NOLOAD attribute, the .bss section might get PROGBITS type.
+    * This  makes linker to A) allocate zeroed section in memory, and B) copy
+    * this section to RAM during application loading.
+    */
+    .bss (NOLOAD):
+    {
+        . = ALIGN(4);
+        __bss_start__ = .;
+        *(.bss*)
+        *(COMMON)
+        . = ALIGN(4);
+        __bss_end__ = .;
+    } > ram
+
+
+    .heap (NOLOAD):
+    {
+        __HeapBase = .;
+        __end__ = .;
+        end = __end__;
+        KEEP(*(.heap*))
+        . = ORIGIN(ram) + LENGTH(ram) - STACK_SIZE;
+        __HeapLimit = .;
+    } > ram
+
+
+    /* .stack_dummy section doesn't contains any symbols. It is only
+     * used for linker to calculate size of stack sections, and assign
+     * values to stack symbols later */
+    .stack_dummy (NOLOAD):
+    {
+        KEEP(*(.stack*))
+    } > ram
+
+
+    /* Set stack top to end of RAM, and stack limit move down by
+     * size of stack_dummy section */
+    __StackTop = ORIGIN(ram) + LENGTH(ram);
+    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
+    PROVIDE(__stack = __StackTop);
+
+    /* Check if data + heap + stack exceeds RAM limit */
+    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
+
+
+    /* Used for the digital signature of the secure application and the Bootloader SDK application.
+    * The size of the section depends on the required data size. */
+    .cy_app_signature ORIGIN(flash) + LENGTH(flash) - 256 :
+    {
+        KEEP(*(.cy_app_signature))
+    } > flash
+
+
+    /* Emulated EEPROM Flash area */
+    .cy_em_eeprom :
+    {
+        KEEP(*(.cy_em_eeprom))
+    } > em_eeprom
+
+
+    /* Places the code in the Execute in Place (XIP) section. See the smif driver
+    *  documentation for details.
+    */
+    cy_xip :
+    {
+        __cy_xip_start = .;
+        KEEP(*(.cy_xip))
+        __cy_xip_end = .;
+    } > xip
+
+
+}
+
+
+/* EOF */
diff --git a/boot/cypress/BlinkyApp/linker/BlinkyApp_CM0P_template_xip.ld b/boot/cypress/BlinkyApp/linker/BlinkyApp_CM0P_template_xip.ld
new file mode 100644
index 0000000..3a2a33c
--- /dev/null
+++ b/boot/cypress/BlinkyApp/linker/BlinkyApp_CM0P_template_xip.ld
@@ -0,0 +1,368 @@
+/***************************************************************************//**
+* \file cy8c6xxa_cm0plus.ld
+* \version 2.91
+*
+* Linker file for the GNU C compiler.
+*
+* The main purpose of the linker script is to describe how the sections in the
+* input files should be mapped into the output file, and to control the memory
+* layout of the output file.
+*
+* \note The entry point location is fixed and starts at 0x100E0000. The valid
+* application image should be placed there.
+*
+* \note The linker files included with the PDL template projects must be generic
+* and handle all common use cases. Your project may not use every section
+* defined in the linker files. In that case you may see warnings during the
+* build process. In your project, you can simply comment out or remove the
+* relevant code in the linker file.
+*
+********************************************************************************
+* \copyright
+* Copyright 2016-2022 Cypress Semiconductor Corporation (an Infineon company) or
+* an affiliate of Cypress Semiconductor Corporation
+* SPDX-License-Identifier: Apache-2.0
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*******************************************************************************/
+#include <main.h>
+
+OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
+SEARCH_DIR(.)
+GROUP(-lgcc -lc -lnosys)
+ENTRY(Reset_Handler)
+
+/* The size of the stack section at the end of CM0+ SRAM */
+STACK_SIZE = 0x1000;
+
+/* The size of the MCU boot header area at the start of FLASH */
+BOOT_HEADER_SIZE = 0x400;
+
+/* Force symbol to be entered in the output file as an undefined symbol. Doing
+* this may, for example, trigger linking of additional modules from standard
+* libraries. You may list several symbols for each EXTERN, and you may use
+* EXTERN multiple times. This command has the same effect as the -u command-line
+* option.
+*/
+EXTERN(Reset_Handler)
+
+/* The MEMORY section below describes the location and size of blocks of memory in the target.
+* Use this section to specify the memory regions available for allocation.
+*/
+MEMORY
+{
+    /* The ram and flash regions control RAM and flash memory allocation for the CM0+ core.
+     */
+    ram               (rwx)   : ORIGIN = USER_APP_RAM_START, LENGTH = USER_APP_RAM_SIZE
+    flash             (rx)    : ORIGIN = USER_APP_START, LENGTH = USER_APP_SIZE
+
+    public_ram        (rw)    : ORIGIN = 0x08000000, LENGTH = 0x800
+    /* This is a 32K flash region used for EEPROM emulation. This region can also be used as the general purpose flash.
+     * You can assign sections to this memory region for only one of the cores.
+     * Note some middleware (e.g. BLE, Emulated EEPROM) can place their data into this memory region.
+     * Therefore, repurposing this memory region will prevent such middleware from operation.
+     */
+    em_eeprom         (rx)    : ORIGIN = 0x14000000, LENGTH = 0x8000       /*  32 KB */
+
+    /* The following regions define device specific memory regions and must not be changed. */
+    xip               (rx)    : ORIGIN = 0x18000000, LENGTH = 0x8000000    /* 128 MB */
+}
+
+/* Library configurations */
+GROUP(libgcc.a libc.a libm.a libnosys.a)
+
+/* Linker script to place sections and symbol values. Should be used together
+ * with other linker script that defines memory regions FLASH and RAM.
+ * It references following symbols, which must be defined in code:
+ *   Reset_Handler : Entry of reset handler
+ *
+ * It defines following symbols, which code can use without definition:
+ *   __exidx_start
+ *   __exidx_end
+ *   __copy_table_start__
+ *   __copy_table_end__
+ *   __zero_table_start__
+ *   __zero_table_end__
+ *   __etext
+ *   __data_start__
+ *   __preinit_array_start
+ *   __preinit_array_end
+ *   __init_array_start
+ *   __init_array_end
+ *   __fini_array_start
+ *   __fini_array_end
+ *   __data_end__
+ *   __bss_start__
+ *   __bss_end__
+ *   __end__
+ *   end
+ *   __HeapLimit
+ *   __StackLimit
+ *   __StackTop
+ *   __stack
+ *   __Vectors_End
+ *   __Vectors_Size
+ */
+
+
+SECTIONS
+{
+
+    /* Cortex-M0+ application flash area */
+    .text ORIGIN(flash) + BOOT_HEADER_SIZE :
+    {
+        /* Cortex-M0+ flash vector table */
+        . = ALIGN(4);
+        __Vectors = . ;
+        KEEP(*(.vectors))
+        . = ALIGN(4);
+        __Vectors_End = .;
+        __Vectors_Size = __Vectors_End - __Vectors;
+        __end__ = .;
+        . = ALIGN(4);
+
+        EXCLUDE_FILE(*cy_smif.o *cy_smif_memslot.o *cy_smif_sfdp.o
+                *cy_sysclk.o *cy_smif_hybrid_sect.o *flash_qspi.o
+                *cy_syslib.o *cy_syslib_ext.o *system_psoc6_cm0plus.o) *(.text)
+
+        KEEP(*(.init))
+        KEEP(*(.fini))
+
+        /* .ctors */
+        *crtbegin.o(.ctors)
+        *crtbegin?.o(.ctors)
+        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+        *(SORT(.ctors.*))
+        *(.ctors)
+
+        /* .dtors */
+        *crtbegin.o(.dtors)
+        *crtbegin?.o(.dtors)
+        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+        *(SORT(.dtors.*))
+        *(.dtors)
+
+        /* Read-only code (constants). */
+        *(.rodata .rodata.* .constdata .constdata.* .conststring .conststring.*)
+
+        KEEP(*(.eh_frame*))
+    } > flash
+
+
+    .ARM.extab :
+    {
+        *(.ARM.extab* .gnu.linkonce.armextab.*)
+    } > flash
+
+    __exidx_start = .;
+
+    .ARM.exidx :
+    {
+        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+    } > flash
+    __exidx_end = .;
+
+
+    /* To copy multiple ROM to RAM sections,
+     * uncomment .copy.table section and,
+     * define __STARTUP_COPY_MULTIPLE in startup_psoc6_02_cm0plus.S */
+    .copy.table :
+    {
+        . = ALIGN(4);
+        __copy_table_start__ = .;
+
+        /* Copy interrupt vectors from flash to RAM */
+        LONG (__Vectors)                                    /* From */
+        LONG (__ram_vectors_start__)                        /* To   */
+        LONG (__Vectors_End - __Vectors)                    /* Size */
+
+        /* Copy data section to RAM */
+        LONG (__etext)                                      /* From */
+        LONG (__data_start__)                               /* To   */
+        LONG (__data_end__ - __data_start__)                /* Size */
+
+        __copy_table_end__ = .;
+    } > flash
+
+
+    /* To clear multiple BSS sections,
+     * uncomment .zero.table section and,
+     * define __STARTUP_COPY_MULTIPLE in startup_psoc6_02_cm0plus.S */
+    .zero.table :
+    {
+        . = ALIGN(4);
+        __zero_table_start__ = .;
+        LONG (__bss_start__)
+        LONG (__bss_end__ - __bss_start__)
+        __zero_table_end__ = .;
+    } > flash
+
+    __etext =  . ;
+
+
+    .ramVectors (NOLOAD) : ALIGN(8)
+    {
+        __ram_vectors_start__ = .;
+        KEEP(*(.ram_vectors))
+        __ram_vectors_end__   = .;
+    } > ram
+
+
+    .data __ram_vectors_end__ :
+    {
+        . = ALIGN(4);
+        __data_start__ = .;
+
+        *(vtable)
+        *(.data*)
+
+        . = ALIGN(4);
+        /* preinit data */
+        PROVIDE_HIDDEN (__preinit_array_start = .);
+        KEEP(*(.preinit_array))
+        PROVIDE_HIDDEN (__preinit_array_end = .);
+
+        . = ALIGN(4);
+        /* init data */
+        PROVIDE_HIDDEN (__init_array_start = .);
+        KEEP(*(SORT(.init_array.*)))
+        KEEP(*(.init_array))
+        PROVIDE_HIDDEN (__init_array_end = .);
+
+        . = ALIGN(4);
+        /* finit data */
+        PROVIDE_HIDDEN (__fini_array_start = .);
+        KEEP(*(SORT(.fini_array.*)))
+        KEEP(*(.fini_array))
+        PROVIDE_HIDDEN (__fini_array_end = .);
+
+        KEEP(*(.jcr*))
+        . = ALIGN(4);
+
+        KEEP(*(.cy_ramfunc*))
+        . = ALIGN(4);
+
+        *cy_smif.o(.text*)
+        *cy_smif_memslot.o(.text*)
+        *cy_smif_sfdp.o(.text*)
+        *cy_sysclk.o(.text*)
+        *cy_smif_hybrid_sect.o(.text*)
+        *flash_qspi.o(.text*)
+        *cy_syslib.o(.text*)
+        *cy_syslib_ext.o(.text*)
+
+        __data_end__ = .;
+
+    } > ram AT>flash
+
+
+    /* Place variables in the section that should not be initialized during the
+    *  device startup.
+    */
+    .noinit (NOLOAD) : ALIGN(8)
+    {
+      KEEP(*(.noinit))
+    } > ram
+
+
+    /* The uninitialized global or static variables are placed in this section.
+    *
+    * The NOLOAD attribute tells linker that .bss section does not consume
+    * any space in the image. The NOLOAD attribute changes the .bss type to
+    * NOBITS, and that  makes linker to A) not allocate section in memory, and
+    * A) put information to clear the section with all zeros during application
+    * loading.
+    *
+    * Without the NOLOAD attribute, the .bss section might get PROGBITS type.
+    * This  makes linker to A) allocate zeroed section in memory, and B) copy
+    * this section to RAM during application loading.
+    */
+    .bss (NOLOAD):
+    {
+        . = ALIGN(4);
+        __bss_start__ = .;
+        *(.bss*)
+        *(COMMON)
+        . = ALIGN(4);
+        __bss_end__ = .;
+    } > ram
+
+
+    .heap (NOLOAD):
+    {
+        __HeapBase = .;
+        __end__ = .;
+        end = __end__;
+        KEEP(*(.heap*))
+        . = ORIGIN(ram) + LENGTH(ram) - STACK_SIZE;
+        __HeapLimit = .;
+    } > ram
+
+    .cy_sharedmem (NOLOAD):
+    {
+        . = ALIGN(4);
+        __public_ram_start__ = .;
+        KEEP(*(.cy_sharedmem))
+        . = ALIGN(4);
+        __public_ram_end__ = .;
+    } > public_ram
+
+    /* .stack_dummy section doesn't contains any symbols. It is only
+     * used for linker to calculate size of stack sections, and assign
+     * values to stack symbols later */
+    .stack_dummy (NOLOAD):
+    {
+        KEEP(*(.stack*))
+    } > ram
+
+
+    /* Set stack top to end of RAM, and stack limit move down by
+     * size of stack_dummy section */
+    __StackTop = ORIGIN(ram) + LENGTH(ram);
+    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
+    PROVIDE(__stack = __StackTop);
+
+    /* Check if data + heap + stack exceeds RAM limit */
+    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
+
+
+    /* Used for the digital signature of the secure application and the Bootloader SDK application.
+    * The size of the section depends on the required data size. */
+    .cy_app_signature ORIGIN(flash) + LENGTH(flash) - 256 :
+    {
+        KEEP(*(.cy_app_signature))
+    } > flash
+
+
+    /* Emulated EEPROM Flash area */
+    .cy_em_eeprom :
+    {
+        KEEP(*(.cy_em_eeprom))
+    } > em_eeprom
+
+
+    /* Places the code in the Execute in Place (XIP) section. See the smif driver
+    *  documentation for details.
+    */
+    cy_xip :
+    {
+        __cy_xip_start = .;
+        KEEP(*(.cy_xip))
+        __cy_xip_end = .;
+    } > xip
+
+
+}
+
+
+/* EOF */
diff --git a/boot/cypress/BlinkyApp/linker/BlinkyApp_CM4_template_xip.ld b/boot/cypress/BlinkyApp/linker/BlinkyApp_CM4_template_xip.ld
index 55b307a..3e84aa3 100644
--- a/boot/cypress/BlinkyApp/linker/BlinkyApp_CM4_template_xip.ld
+++ b/boot/cypress/BlinkyApp/linker/BlinkyApp_CM4_template_xip.ld
@@ -132,7 +132,7 @@
 
         EXCLUDE_FILE(*cy_smif.o *cy_smif_memslot.o *cy_smif_sfdp.o
                 *cy_sysclk.o *cy_smif_hybrid_sect.o *flash_qspi.o
-                *cy_syslib.o *cy_syslib_gcc.o *system_psoc6_cm4.o) *(.text)
+                *cy_syslib.o *cy_syslib_ext.o *system_psoc6_cm4.o) *(.text)
 
         KEEP(*(.init))
         KEEP(*(.fini))
@@ -258,7 +258,7 @@
         *cy_smif_hybrid_sect.o(.text*)
         *flash_qspi.o(.text*)
         *cy_syslib.o(.text*)
-        *cy_syslib_gcc.o(.text*)
+        *cy_syslib_ext.o(.text*)
 
         __data_end__ = .;
 
diff --git a/boot/cypress/BlinkyApp/main.c b/boot/cypress/BlinkyApp/main.c
index 59cee6a..900c870 100644
--- a/boot/cypress/BlinkyApp/main.c
+++ b/boot/cypress/BlinkyApp/main.c
@@ -4,7 +4,7 @@
  *
  * SPDX-License-Identifier: Apache-2.0
  */
- /*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -23,147 +23,18 @@
  * under the License.
  */
 
-#ifdef CYW20829
-#include <inttypes.h>
-#include "cybsp.h"
-#include "cycfg_pins.h"
-#include "cyhal_wdt.h"
-#else
-#include "system_psoc6.h"
-#endif /* CYW20829 */
-
-#include "cy_pdl.h"
-#include "cy_retarget_io.h"
-#include "cyhal.h"
-#include "watchdog.h"
-
-#include "flash_qspi.h"
+#include "platform.h"
 
 #if !(SWAP_DISABLED) && defined(UPGRADE_IMAGE)
 #include "set_img_ok.h"
 #endif
 
-/* Define pins for UART debug output */
-#ifdef CYW20829
-#define CY_DEBUG_UART_TX (CYBSP_DEBUG_UART_TX)
-#define CY_DEBUG_UART_RX (CYBSP_DEBUG_UART_RX)
-#else
-#define CY_DEBUG_UART_TX (P5_1)
-#define CY_DEBUG_UART_RX (P5_0)
-#endif /* CYW20829 */
-
-#if defined(PSOC_062_2M)
-#define LED_PORT GPIO_PRT13
-#define LED_PIN 7U
-#elif defined(PSOC_062_1M)
-#define LED_PORT GPIO_PRT13
-#define LED_PIN 7U
-#elif defined(PSOC_062_512K)
-#define LED_PORT GPIO_PRT11
-#define LED_PIN 1U
-#elif defined(CYW20829)
-#define LED_PORT GPIO_PRT0
-#define LED_PIN 0U
-#endif
-
-const cy_stc_gpio_pin_config_t LED_config =
-{
-    .outVal = 1,
-    .driveMode = CY_GPIO_DM_STRONG_IN_OFF,
-    .hsiom = HSIOM_SEL_GPIO,
-    .intEdge = CY_GPIO_INTR_DISABLE,
-    .intMask = 0UL,
-    .vtrip = CY_GPIO_VTRIP_CMOS,
-    .slewRate = CY_GPIO_SLEW_FAST,
-    .driveSel = CY_GPIO_DRIVE_FULL,
-    .vregEn = 0UL,
-    .ibufMode = 0UL,
-    .vtripSel = 0UL,
-    .vrefSel = 0UL,
-    .vohSel = 0UL,
-};
-
-uint32_t smif_id = 1; /* Assume SlaveSelect_0 is used for External Memory */
-
-#ifdef BOOT_IMAGE
-    #define BLINK_PERIOD          (1000u)
-    #define GREETING_MESSAGE_VER  "[BlinkyApp] BlinkyApp v1.0 [CM4]\r\n"
-    #define GREETING_MESSAGE_INFO "[BlinkyApp] Red led blinks with 1 sec period\r\n"
-#elif defined(UPGRADE_IMAGE)
-    #define BLINK_PERIOD          (250u)
-    #define GREETING_MESSAGE_VER  "[BlinkyApp] BlinkyApp v2.0 [+]\r\n"
-    #define GREETING_MESSAGE_INFO "[BlinkyApp] Red led blinks with 0.25 sec period\r\n"
-#else
-    #error "[BlinkyApp] Please specify type of image: -DBOOT_IMAGE or -DUPGRADE_IMAGE\r\n"
-#endif
-
-#define WATCHDOG_FREE_MESSAGE "[BlinkyApp] Turn off watchdog timer\r\n"
-
-static void check_result(int res)
-{
-    if (res != CY_RSLT_SUCCESS) {
-        CY_ASSERT(0);
-        /* Loop forever... */
-        for (;;) {}
-    }
-}
-
-void test_app_init_hardware(void)
-{
-    /* enable interrupts */
-    __enable_irq();
-
-    /* Disabling watchdog so it will not interrupt normal flow later */
-    Cy_GPIO_Pin_Init(LED_PORT, LED_PIN, &LED_config);
-
-    /* Initialize retarget-io to use the debug UART port */
-    check_result(cy_retarget_io_init(CY_DEBUG_UART_TX, CY_DEBUG_UART_RX,
-                                     CY_RETARGET_IO_BAUDRATE));
-
-    printf("\n===========================\r\n");
-    printf(GREETING_MESSAGE_VER);
-    printf("===========================\r\n");
-
-    printf("[BlinkyApp] GPIO initialized \r\n");
-    printf("[BlinkyApp] UART initialized \r\n");
-    printf("[BlinkyApp] Retarget I/O set to 115200 baudrate \r\n");
-
-#ifdef CYW20829
-    cy_en_smif_status_t rc = CY_SMIF_CMD_NOT_FOUND;
-
-    rc = qspi_init_sfdp(smif_id);
-    if (CY_SMIF_SUCCESS == rc) {
-        printf("[BlinkyApp] External Memory initialized w/ SFDP. \r\n");
-    }
-    else {
-        printf("[BlinkyApp] External Memory initialization w/ SFDP FAILED: 0x%" PRIx32 " \r\n", (uint32_t)rc);
-    }
-#endif /* CYW20829 */
-}
-
 int main(void)
 {
-    uint32_t blinky_period = BLINK_PERIOD;
-
-#if defined CYW20829
-    cybsp_init();
-#endif /* CYW20829 */
-
-    test_app_init_hardware();
+    const char* detect_core_message = test_app_init_hardware();
 
     printf(GREETING_MESSAGE_INFO);
 
-    /* Disable watchdog timer to mark successful start up of application.
-     * For PSOC6 WDT is disabled in SystemInit() function.
-     */
-    printf(WATCHDOG_FREE_MESSAGE);
-#ifdef CYW20829
-    cyhal_wdt_t *cyw20829_wdt = NULL;
-    cyhal_wdt_free(cyw20829_wdt);
-#else
-    cy_wdg_free();
-#endif /* CYW20829 */
-
 #if !(SWAP_DISABLED) && defined(UPGRADE_IMAGE)
     int rc = -1;
 
@@ -176,20 +47,19 @@
 
     if (IMG_OK_ALREADY_SET == rc) {
         printf("[BlinkyApp] Img_ok is already set in trailer\r\n");
-    }
-    else if (IMG_OK_SET_SUCCESS == rc) {
+    } else if (IMG_OK_SET_SUCCESS == rc) {
         printf("[BlinkyApp] SWAP Status : Image OK was set at 0x%08x.\r\n", IMG_OK_ADDR);
-    }
-    else {
+    } else {
         printf("[BlinkyApp] SWAP Status : Failed to set Image OK.\r\n");
     }
 
 #endif /* !(SWAP_DISABLED) && defined(UPGRADE_IMAGE) */
 
-    for (;;)
-    {
+    printf("[BlinkyApp] Image type: " IMAGE_TYPE " on %s core\r\n", detect_core_message);
+
+    for (;;) {
         /* Toggle the user LED periodically */
-        Cy_SysLib_Delay(blinky_period/2);
+        Cy_SysLib_Delay(BLINK_PERIOD / 2);
 
         /* Invert the USER LED state */
         Cy_GPIO_Inv(LED_PORT, LED_PIN);
diff --git a/boot/cypress/BlinkyApp/platform.h b/boot/cypress/BlinkyApp/platform.h
new file mode 100644
index 0000000..a34650a
--- /dev/null
+++ b/boot/cypress/BlinkyApp/platform.h
@@ -0,0 +1,166 @@
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+#ifdef CYW20829
+#include <inttypes.h>
+
+#include "cybsp.h"
+#include "cycfg_pins.h"
+#include "cyhal_wdt.h"
+#else
+#include "system_psoc6.h"
+#endif /* CYW20829 */
+
+#include <stdio.h>
+
+#include "cy_pdl.h"
+#ifdef APP_CM0P
+#include "cycfg_peripherals.h"
+#include "cycfg_pins.h"
+#include "cy_retarget_io_pdl.h"
+#else
+#include "cyhal.h"
+#include "cy_retarget_io.h"
+
+#endif /* APP_CM0P */
+#include "watchdog.h"
+
+#if defined(CY_BOOT_USE_EXTERNAL_FLASH) || defined(CYW20829)
+#include "flash_qspi.h"
+#endif /* defined(CY_BOOT_USE_EXTERNAL_FLASH) || defined(CYW20829) */
+
+#ifdef BOOT_IMAGE
+#define IMAGE_TYPE             "BOOT"
+#define BLINK_PERIOD           (1000u)
+#define GREETING_MESSAGE_INFO  "[BlinkyApp] Red led blinks with 1 sec period\r\n"
+#elif defined(UPGRADE_IMAGE)
+#define IMAGE_TYPE             "UPGRADE"
+#define BLINK_PERIOD           (250u)
+#define GREETING_MESSAGE_INFO  "[BlinkyApp] Red led blinks with 0.25 sec period\r\n"
+#else
+#error                         "[BlinkyApp] Please specify type of image: -DBOOT_IMAGE or -DUPGRADE_IMAGE\r\n"
+#endif /* BOOT_IMAGE */
+
+#define GREETING_MESSAGE_VER   "[BlinkyApp] Version:"
+
+#define WATCHDOG_FREE_MESSAGE  "[BlinkyApp] Turn off watchdog timer\r\n"
+
+#define SMIF_ID (1U) /* Assume SlaveSelect_0 is used for External Memory */
+
+static const char* core33_message ="CM33";
+static const char* core0p_message ="CM0P";
+static const char* core4_message  ="CM4";
+
+#if defined(__cplusplus)
+extern "C" {
+#endif /* defined(__cplusplus) */
+
+static inline const char* test_app_init_hardware(void)
+{
+    const char* detect_core_message = NULL;
+    (void) core33_message;
+    (void) core0p_message;
+    (void) core4_message;
+    cy_rslt_t res = CY_RSLT_TYPE_ERROR;
+
+    const cy_stc_gpio_pin_config_t LED_config = {
+        .outVal = 1,
+        .driveMode = CY_GPIO_DM_STRONG_IN_OFF,
+        .hsiom = HSIOM_SEL_GPIO,
+        .intEdge = CY_GPIO_INTR_DISABLE,
+        .intMask = 0UL,
+        .vtrip = CY_GPIO_VTRIP_CMOS,
+        .slewRate = CY_GPIO_SLEW_FAST,
+        .driveSel = CY_GPIO_DRIVE_FULL,
+        .vregEn = 0UL,
+        .ibufMode = 0UL,
+        .vtripSel = 0UL,
+        .vrefSel = 0UL,
+        .vohSel = 0UL,
+    };
+
+#ifdef CYW20829
+    cybsp_init();
+#elif defined APP_CM0P
+    init_cycfg_peripherals();
+    init_cycfg_pins();
+#endif /* CYW20829 */
+
+    /* enable interrupts */
+    __enable_irq();
+
+    /* Initialize led port */
+    Cy_GPIO_Pin_Init(LED_PORT, LED_PIN, &LED_config);
+
+    /* Initialize retarget-io to use the debug UART port */
+#ifdef APP_CM0P
+    res = cy_retarget_io_pdl_init(CY_RETARGET_IO_BAUDRATE);
+#else
+    res = cy_retarget_io_init(CY_DEBUG_UART_TX, CY_DEBUG_UART_RX, CY_RETARGET_IO_BAUDRATE);
+#endif /* APP_CM0P */
+
+    if (res != CY_RSLT_SUCCESS) {
+        CY_ASSERT(0);
+        /* Loop forever... */
+        for (;;) {
+        }
+    }
+
+    printf("\n===========================\r\n");
+    printf("%s %s\r\n", GREETING_MESSAGE_VER, IMG_VER_MSG);
+
+#ifdef CYW20829
+    detect_core_message = core33_message;
+
+    printf("===========================\r\n");
+
+    cy_en_smif_status_t rc = CY_SMIF_CMD_NOT_FOUND;
+    cyhal_wdt_t *cyw20829_wdt = NULL;
+
+    rc = qspi_init_sfdp(SMIF_ID);
+    if (CY_SMIF_SUCCESS == rc) {
+        printf("[BlinkyApp] External Memory initialized w/ SFDP. \r\n");
+    } else {
+        printf("[BlinkyApp] External Memory initialization w/ SFDP FAILED: 0x%" PRIx32 " \r\n", (uint32_t)rc);
+    }
+
+    /* Disable watchdog timer to mark successful start up of application. */
+    cyhal_wdt_free(cyw20829_wdt);
+
+#else
+    /* Determine on which core this app is running by polling CPUSS_IDENTITY register.
+     * This register contains bits field [8:11]. This field specifies the bus master
+     * identifier of the transfer that reads the register.
+     */
+#ifdef APP_CM0P
+
+    en_prot_master_t core = _FLD2VAL(CPUSS_IDENTITY_MS, CPUSS->IDENTITY);
+
+    if (CPUSS_MS_ID_CM4 == core) {
+        printf("\n[BlinkyApp] is compiled for CM0P core, started on CM4 instead. Execution Halted.\n");
+        CY_ASSERT(0);
+    }
+    else if (CPUSS_MS_ID_CM0 == core) {
+        detect_core_message = core0p_message;
+    }
+    else
+#endif /* APP_CM0P */
+    {
+        detect_core_message = core4_message;
+    }
+    printf("===========================\r\n");
+    cy_wdg_free();
+#endif /* CYW20829 */
+    printf("[BlinkyApp] GPIO initialized \r\n");
+    printf("[BlinkyApp] UART initialized \r\n");
+    printf("[BlinkyApp] Retarget I/O set to 115200 baudrate \r\n");
+    printf(WATCHDOG_FREE_MESSAGE);
+
+    return(detect_core_message);
+}
+
+#if defined(__cplusplus)
+}
+#endif /* defined(__cplusplus) */
+
+#endif /* PLATFORM_H */
diff --git a/boot/cypress/BlinkyApp/set_img_ok.h b/boot/cypress/BlinkyApp/set_img_ok.h
deleted file mode 100644
index 68d4ac2..0000000
--- a/boot/cypress/BlinkyApp/set_img_ok.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/********************************************************************************
-* Copyright 2021 Infineon Technologies AG
-* SPDX-License-Identifier: Apache-2.0
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-********************************************************************************/
-
-#if !defined(SET_IMG_OK_H)
-#define SET_IMG_OK_H
-
-#include "cy_flash.h"
-#include "flash_qspi.h"
-#include "sysflash/sysflash.h"
-#include <string.h>
-
-#define FLASH_ROW_BUF_SZ        CY_FLASH_ALIGN
-#define IMG_TRAILER_SZ          CY_FLASH_ALIGN
-
-#define USER_SWAP_IMAGE_OK_OFFS (24)
-#define USER_SWAP_IMAGE_OK      (1)
-#define IMG_OK_ADDR             (PRIMARY_IMG_START + USER_APP_SIZE - USER_SWAP_IMAGE_OK_OFFS)
-
-#define IMG_OK_SET_FAILED       -1
-#define IMG_OK_ALREADY_SET      1
-#define IMG_OK_SET_SUCCESS      0
-
-int set_img_ok(uint32_t address, uint8_t value);
-
-#endif /* SET_IMG_OK_H */
\ No newline at end of file