cypress: Add support for watchdog timer update in boot image

Add watchdog timer to MCUBootApp plus BlinkyApp to implement  additional way of boot/upgrade image operation confirmation.

Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
diff --git a/boot/cypress/BlinkyApp/main.c b/boot/cypress/BlinkyApp/main.c
index 936511d..e08fdd0 100644
--- a/boot/cypress/BlinkyApp/main.c
+++ b/boot/cypress/BlinkyApp/main.c
@@ -27,6 +27,7 @@
 #include "cy_pdl.h"
 #include "cyhal.h"
 #include "cy_retarget_io.h"
+#include "watchdog.h"
 
 /* Define pins for UART debug output */
 
@@ -60,11 +61,14 @@
     .vohSel = 0UL,
 };
 
+#define WATCHDOG_UPD_MESSAGE  "[BlinkyApp] Update watchdog timer started in MCUBootApp to mark successful start of user app\r\n"
+#define WATCHDOG_FREE_MESSAGE "[BlinkyApp] Turn off watchdog timer\r\n"
+
 #ifdef BOOT_IMG
     #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 UPGRADE_IMG
+#elif defined(UPGRADE_IMG)
     #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"
@@ -74,8 +78,7 @@
 
 void check_result(int res)
 {
-    if (res != CY_RSLT_SUCCESS)
-    {
+    if (res != CY_RSLT_SUCCESS) {
         CY_ASSERT(0);
     }
 }
@@ -109,6 +112,12 @@
 
     printf(GREETING_MESSAGE_INFO);
 
+    /* Update watchdog timer to mark successful start up of application */
+    printf(WATCHDOG_UPD_MESSAGE);
+    cy_wdg_kick();
+    printf(WATCHDOG_FREE_MESSAGE);
+    cy_wdg_free();
+
     for (;;)
     {
         /* Toggle the user LED periodically */