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/MCUBootApp/main.c b/boot/cypress/MCUBootApp/main.c
index 6097173..b54e7e5 100644
--- a/boot/cypress/MCUBootApp/main.c
+++ b/boot/cypress/MCUBootApp/main.c
@@ -27,15 +27,20 @@
#include "cy_retarget_io.h"
#include "cybsp.h"
#include "cyhal_wdt.h"
-#include "cyw_20829_utils.h"
+#include "cyw_platform_utils.h"
#include "cy_service_app.h"
#else
#include "cy_retarget_io_pdl.h"
#include "cycfg_clocks.h"
#include "cycfg_peripherals.h"
-#endif /* CYW20829 */
+#if defined APP_CM0P || defined CM4
+#include "cyw_platform_utils.h"
+#endif /* defined APP_CM0P || defined CM4 */
+#endif /* defined CYW20829 || defined EXPLORER */
+#if defined(CY_BOOT_USE_EXTERNAL_FLASH) || defined(CYW20829)
#include "flash_qspi.h"
+#endif /* defined(CY_BOOT_USE_EXTERNAL_FLASH) || defined(CYW20829) */
#include "cycfg_pins.h"
#include "cy_result.h"
@@ -52,6 +57,15 @@
#include "watchdog.h"
+#ifdef USE_EXEC_TIME_CHECK
+#include "misc/timebase_us.h"
+#include "misc/exec_time_check.h"
+#endif /* USE_EXEC_TIME_CHECK */
+
+#ifdef USE_LOG_TIMESTAMP
+#include "timestamp.h"
+#endif /* USE_LOG_TIMESTAMP */
+
#define CY_RSLT_MODULE_MCUBOOTAPP 0x500U
#define CY_RSLT_MODULE_MCUBOOTAPP_MAIN 0x51U
@@ -97,7 +111,7 @@
#if defined(CY_BOOT_USE_EXTERNAL_FLASH) && !defined(MCUBOOT_ENC_IMAGES_XIP)
qspi_deinit(SMIF_ID);
#endif /* defined(CY_BOOT_USE_EXTERNAL_FLASH) && !defined(MCUBOOT_ENC_IMAGES_XIP) */
- cyw20829_RunApp(app_addr, key, iv);
+ platform_RunNextApp(app_addr, key, iv);
}
#if defined(CY_BOOT_USE_EXTERNAL_FLASH) && !defined(MCUBOOT_ENC_IMAGES_XIP)
CY_RAMFUNC_END /* SMIF will be deinitialized in this case! */
@@ -141,22 +155,53 @@
return false;
}
#endif /* MCUBOOT_ENC_IMAGES_XIP */
+
+
+#ifdef APP_CM33
/* This function does not return */
+ BOOT_LOG_INF("Launching app on CM33 core");
BOOT_LOG_INF(BOOT_MSG_FINISH);
hw_deinit();
cyw20829_launch_app(app_addr, key, iv);
#else
- /* This function turns on CM4 and returns */
- BOOT_LOG_INF(BOOT_MSG_FINISH);
+#error "Application should run on Cortex-M33"
+#endif /* APP_CM33 */
- hw_deinit();
+#else /* defined CYW20829 || defined EXPLORER */
+
#ifdef USE_XIP
BOOT_LOG_DBG("XIP: Switch to SMIF XIP mode");
qspi_set_mode(CY_SMIF_MEMORY);
-#endif
+#endif /* USE_XIP */
+
+#ifdef APP_CM4
+ /* This function turns on CM4 and returns */
+ BOOT_LOG_INF("Launching app on CM4 core");
+ BOOT_LOG_INF(BOOT_MSG_FINISH);
+ hw_deinit();
+#ifdef CM0P
Cy_SysEnableCM4(fih_uint_decode(app_addr));
return true;
-#endif /* CYW20829 */
+#else
+ psoc6_launch_cm4_app(app_addr);
+#endif /* CM0P */
+
+#elif defined APP_CM0P
+#ifdef CM0P
+ /* This function does not return */
+ BOOT_LOG_INF("Launching app on CM0P core");
+ BOOT_LOG_INF(BOOT_MSG_FINISH);
+ hw_deinit();
+ psoc6_launch_cm0p_app(app_addr);
+#else
+#error "Application should run on Cortex-M4"
+#endif /* CM0P */
+
+#else
+#error "Application should run on either Cortex-M0+ or Cortex-M4"
+#endif /* APP_CM4 */
+
+#endif /* defined CYW20829 */
} else {
BOOT_LOG_ERR("Flash device ID not found");
return false;
@@ -187,6 +232,15 @@
init_cycfg_peripherals();
init_cycfg_pins();
#endif /* CYW20829 */
+
+#ifdef USE_EXEC_TIME_CHECK
+ timebase_us_init();
+#endif /* USE_EXEC_TIME_CHECK */
+
+#ifdef USE_LOG_TIMESTAMP
+ log_timestamp_init();
+#endif /* USE_LOG_TIMESTAMP */
+
/* enable interrupts */
__enable_irq();
@@ -197,13 +251,12 @@
* to keep CM4 disabled. Note that debugging of CM4 is not supported when it
* is disabled.
*/
-#ifndef CYW20829
-#if defined(CY_DEVICE_PSOC6ABLE2)
+#if !defined CYW20829
+#if defined(CY_DEVICE_PSOC6ABLE2) && !defined(CM4)
if (CY_SYS_CM4_STATUS_ENABLED == Cy_SysGetCM4Status()) {
Cy_SysDisableCM4();
}
-#endif /* defined(CY_DEVICE_PSOC6ABLE2) */
-
+#endif /* defined(CY_DEVICE_PSOC6ABLE2) && !defined(CM4) */
/* Initialize retarget-io to use the debug UART port (CYBSP_UART_HW) */
rc = cy_retarget_io_pdl_init(CY_RETARGET_IO_BAUDRATE);
#else
@@ -251,7 +304,17 @@
#endif /* CYW20829 && MCUBOOT_HW_ROLLBACK_PROT */
(void)memset(&rsp, 0, sizeof(rsp));
- FIH_CALL(boot_go, fih_rc, &rsp);
+#ifdef USE_EXEC_TIME_CHECK
+ {
+ uint32_t exec_time;
+ EXEC_TIME_CHECK_BEGIN(&exec_time);
+#endif /* USE_EXEC_TIME_CHECK */
+ FIH_CALL(boot_go, fih_rc, &rsp);
+#ifdef USE_EXEC_TIME_CHECK
+ EXEC_TIME_CHECK_END();
+ BOOT_LOG_INF("Exec time: %" PRIu32 " [ms]", exec_time / 1000U);
+ }
+#endif /* USE_EXEC_TIME_CHECK */
if (true == fih_eq(fih_rc, FIH_SUCCESS)) {
BOOT_LOG_INF("User Application validated successfully");
/* initialize watchdog timer. it should be updated from user app
@@ -309,4 +372,12 @@
qspi_deinit(SMIF_ID);
#endif /* defined(CY_BOOT_USE_EXTERNAL_FLASH) && !defined(MCUBOOT_ENC_IMAGES_XIP) */
#endif /* CYW20829 */
+
+#ifdef USE_EXEC_TIME_CHECK
+ timebase_us_deinit();
+#endif /* USE_EXEC_TIME_CHECK */
+
+#ifdef USE_LOG_TIMESTAMP
+ log_timestamp_deinit();
+#endif /* USE_LOG_TIMESTAMP */
}