HAL: Rename platform init function
Align with HAL design document:
- Rename 'tfm_spm_hal_post_init' to 'tfm_hal_platform_init'.
- Set 'tfm_hal_platform_init' to weak, and platform with specific init
operation needs to override it.
- Remove 'tfm_spm_hal_post_init_platform' and move the operations to
'tfm_hal_platform_init'.
Change-Id: Ia96b3a6bae716d154edab8709eb6e277bafcb45e
Signed-off-by: Summer Qin <summer.qin@arm.com>
diff --git a/platform/ext/common/tfm_platform.c b/platform/ext/common/tfm_platform.c
index fc9ecb7..fd13dc2 100644
--- a/platform/ext/common/tfm_platform.c
+++ b/platform/ext/common/tfm_platform.c
@@ -8,23 +8,14 @@
#include "target_cfg.h"
#include "tfm_spm_hal.h"
#include "uart_stdout.h"
+#include "tfm_hal_platform.h"
-/* platform-specific hw initialization */
-__WEAK enum tfm_plat_err_t tfm_spm_hal_post_init_platform(void)
+__WEAK enum tfm_hal_status_t tfm_hal_platform_init(void)
{
- return TFM_PLAT_ERR_SUCCESS;
-}
-
-enum tfm_plat_err_t tfm_spm_hal_post_init(void)
-{
- if (tfm_spm_hal_post_init_platform() != TFM_PLAT_ERR_SUCCESS) {
- return TFM_PLAT_ERR_SYSTEM_ERR;
- }
-
__enable_irq();
stdio_init();
- return TFM_PLAT_ERR_SUCCESS;
+ return TFM_HAL_SUCCESS;
}
__WEAK void tfm_hal_system_reset(void)
diff --git a/platform/ext/target/cypress/psoc64/spm_hal.c b/platform/ext/target/cypress/psoc64/spm_hal.c
index 27c8ed0..4ddb869 100644
--- a/platform/ext/target/cypress/psoc64/spm_hal.c
+++ b/platform/ext/target/cypress/psoc64/spm_hal.c
@@ -11,6 +11,7 @@
#include <string.h>
#include "tfm_spm_hal.h"
+#include "tfm_hal_platform.h"
#include "device_definition.h"
#include "region_defs.h"
@@ -417,12 +418,15 @@
memcpy(boot_data, mock_data, sizeof(mock_data));
}
-enum tfm_plat_err_t tfm_spm_hal_post_init_platform(void)
+enum tfm_hal_status_t tfm_hal_platform_init(void)
{
platform_init();
/* FIXME: Use the actual data from mcuboot */
mock_tfm_shared_data();
- return TFM_PLAT_ERR_SUCCESS;
+ __enable_irq();
+ stdio_init();
+
+ return TFM_HAL_SUCCESS;
}
diff --git a/platform/ext/target/stm/stm32l5xx/secure/tfm_platform_system.c b/platform/ext/target/stm/stm32l5xx/secure/tfm_platform_system.c
index a13e5f8..06bd86a 100644
--- a/platform/ext/target/stm/stm32l5xx/secure/tfm_platform_system.c
+++ b/platform/ext/target/stm/stm32l5xx/secure/tfm_platform_system.c
@@ -10,6 +10,8 @@
#include "tfm_spm_hal.h"
#include "uart_stdout.h"
#include "tfm_platform_system.h"
+#include "tfm_hal_platform.h"
+
void tfm_platform_hal_system_reset(void)
{
/* Reset the system */
@@ -23,21 +25,12 @@
return TFM_PLAT_ERR_SYSTEM_ERR;
}
-__WEAK enum tfm_plat_err_t tfm_spm_hal_post_init_platform(void)
+enum tfm_hal_status_t tfm_hal_platform_init(void)
{
- return TFM_PLAT_ERR_SUCCESS;
-}
-
-enum tfm_plat_err_t tfm_spm_hal_post_init(void)
-{
- if (tfm_spm_hal_post_init_platform() != TFM_PLAT_ERR_SUCCESS) {
- return TFM_PLAT_ERR_SYSTEM_ERR;
- }
-
__enable_irq();
stdio_init();
- return TFM_PLAT_ERR_SUCCESS;
+ return TFM_HAL_SUCCESS;
}
__WEAK void tfm_hal_system_reset(void)
@@ -45,8 +38,6 @@
NVIC_SystemReset();
}
-
-
enum tfm_platform_err_t tfm_platform_hal_ioctl(tfm_platform_ioctl_req_t request,
psa_invec *in_vec,
psa_outvec *out_vec)