Build: Update to IAR support
Cleaned up #ifdef in secure_fw/services/tfm_spm_db.inc.template
Moved "signals" member to front of spm_partition_runtime_data_t.
The suggestion to move the aggregate types to the front turned
out to be hard to make work for both PSA and non-PSA configs.
Moved REGION_DECLARE macros to new include file,
platform/include/region.h.
Cleaned up type cast in core_test_api.c
Change-Id: I5dce1e7c019d4d7e4c14dc79be5ee2b855ad4f9e
Signed-off-by: Thomas Tornblom <thomas.tornblom@iar.com>
diff --git a/bl2/ext/mcuboot/bl2_main.c b/bl2/ext/mcuboot/bl2_main.c
index 01922cb..6c55ac8 100644
--- a/bl2/ext/mcuboot/bl2_main.c
+++ b/bl2/ext/mcuboot/bl2_main.c
@@ -28,6 +28,7 @@
#include "boot_record.h"
#include "security_cnt.h"
#include "boot_hal.h"
+#include "region.h"
#if MCUBOOT_LOG_LEVEL > MCUBOOT_LOG_LEVEL_OFF
#include "uart_stdout.h"
#endif
@@ -42,11 +43,6 @@
#endif
#if defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8M_BASE__)
-/* Macros to pick linker symbols */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
-
REGION_DECLARE(Image$$, ARM_LIB_STACK, $$ZI$$Base);
#endif
diff --git a/bl2/ext/mcuboot/flash_map_extended.c b/bl2/ext/mcuboot/flash_map_extended.c
index 887f89b..f84d698 100644
--- a/bl2/ext/mcuboot/flash_map_extended.c
+++ b/bl2/ext/mcuboot/flash_map_extended.c
@@ -28,7 +28,7 @@
if (fd_id != FLASH_DEVICE_ID) {
BOOT_LOG_ERR("invalid flash ID %d; expected %d",
fd_id, FLASH_DEVICE_ID);
- return -EINVAL;
+ return -1;
}
*ret = FLASH_DEVICE_BASE;
return 0;
@@ -47,7 +47,7 @@
case 2: return FLASH_AREA_IMAGE_SCRATCH;
}
- return -EINVAL; /* flash_area_open will fail on that */
+ return -1; /* flash_area_open will fail on that */
}
int flash_area_id_from_image_slot(int slot)
diff --git a/platform/ext/target/cypress/psoc64/spm_hal.c b/platform/ext/target/cypress/psoc64/spm_hal.c
index 39e7dee..62dc8a7 100644
--- a/platform/ext/target/cypress/psoc64/spm_hal.c
+++ b/platform/ext/target/cypress/psoc64/spm_hal.c
@@ -29,6 +29,7 @@
#include "cy_prot.h"
#include "pc_config.h"
#include "driver_dap.h"
+#include "region.h"
/* Get address of memory regions to configure MPU */
extern const struct memory_region_limits memory_regions;
diff --git a/platform/ext/target/cypress/psoc64/target_cfg.c b/platform/ext/target/cypress/psoc64/target_cfg.c
index c626a68..99c341e 100644
--- a/platform/ext/target/cypress/psoc64/target_cfg.c
+++ b/platform/ext/target/cypress/psoc64/target_cfg.c
@@ -30,13 +30,9 @@
#include "RTE_Device.h"
#include "target_cfg.h"
#include "tfm_plat_defs.h"
+#include "region.h"
-/* Macros to pick linker symbols */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
-
/* The section names come from the scatter file */
REGION_DECLARE(Load$$LR$$, LR_NS_PARTITION, $$Base);
#ifdef BL2
diff --git a/platform/ext/target/mps2/an519/boot_hal.c b/platform/ext/target/mps2/an519/boot_hal.c
index 26d7ce9..1b11c7b 100644
--- a/platform/ext/target/mps2/an519/boot_hal.c
+++ b/platform/ext/target/mps2/an519/boot_hal.c
@@ -1,27 +1,32 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "cmsis.h"
+#include "region.h"
+
+REGION_DECLARE(Image$$, ER_DATA, $$Base)[];
+REGION_DECLARE(Image$$, ARM_LIB_HEAP, $$ZI$$Limit)[];
__attribute__((naked)) void boot_clear_bl2_ram_area(void)
{
__ASM volatile(
".syntax unified \n"
"movs r0, #0 \n"
- "ldr r1, =Image$$ER_DATA$$Base \n"
- "ldr r2, =Image$$ARM_LIB_HEAP$$ZI$$Limit \n"
- "subs r2, r2, r1 \n"
+ "subs %1, %1, %0 \n"
"Loop: \n"
- "subs r2, #4 \n"
+ "subs %1, #4 \n"
"blt Clear_done \n"
- "str r0, [r1, r2] \n"
+ "str r0, [%0, %1] \n"
"b Loop \n"
"Clear_done: \n"
"bx lr \n"
- : : : "r0" , "r1" , "r2" , "memory"
+ :
+ : "r" (REGION_NAME(Image$$, ER_DATA, $$Base)),
+ "r" (REGION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Limit))
+ : "r0", "memory"
);
}
diff --git a/platform/ext/target/mps2/an519/spm_hal.c b/platform/ext/target/mps2/an519/spm_hal.c
index 833aa41..22f8758 100644
--- a/platform/ext/target/mps2/an519/spm_hal.c
+++ b/platform/ext/target/mps2/an519/spm_hal.c
@@ -16,6 +16,7 @@
#include "mpu_armv8m_drv.h"
#include "region_defs.h"
#include "secure_utilities.h"
+#include "region.h"
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
diff --git a/platform/ext/target/mps2/an519/target_cfg.c b/platform/ext/target/mps2/an519/target_cfg.c
index 8224741..acb7242 100644
--- a/platform/ext/target/mps2/an519/target_cfg.c
+++ b/platform/ext/target/mps2/an519/target_cfg.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 Arm Limited
+ * Copyright (c) 2018-2020 Arm Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,14 +21,10 @@
#include "region_defs.h"
#include "tfm_secure_api.h"
#include "tfm_plat_defs.h"
+#include "region.h"
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
-/* Macros to pick linker symbols */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
-
/* The section names come from the scatter file */
REGION_DECLARE(Load$$LR$$, LR_NS_PARTITION, $$Base);
REGION_DECLARE(Load$$LR$$, LR_VENEER, $$Base);
diff --git a/platform/ext/target/mps2/an521/boot_hal.c b/platform/ext/target/mps2/an521/boot_hal.c
index 5dadc3f..d5a804d 100644
--- a/platform/ext/target/mps2/an521/boot_hal.c
+++ b/platform/ext/target/mps2/an521/boot_hal.c
@@ -1,26 +1,30 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "cmsis.h"
+#include "region.h"
+
+REGION_DECLARE(Image$$, ER_DATA, $$Base)[];
+REGION_DECLARE(Image$$, ARM_LIB_HEAP, $$ZI$$Limit)[];
__attribute__((naked)) void boot_clear_bl2_ram_area(void)
{
__ASM volatile(
- ".syntax unified \n"
"mov r0, #0 \n"
- "ldr r1, =Image$$ER_DATA$$Base \n"
- "ldr r2, =Image$$ARM_LIB_HEAP$$ZI$$Limit \n"
- "subs r2, r2, r1 \n"
+ "subs %1, %1, %0 \n"
"Loop: \n"
- "subs r2, #4 \n"
+ "subs %1, #4 \n"
"itt ge \n"
- "strge r0, [r1, r2] \n"
+ "strge r0, [%0, %1] \n"
"bge Loop \n"
"bx lr \n"
- : : : "r0" , "r1" , "r2" , "memory"
+ :
+ : "r" (REGION_NAME(Image$$, ER_DATA, $$Base)),
+ "r" (REGION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Limit))
+ : "r0", "memory"
);
}
diff --git a/platform/ext/target/mps2/an521/spm_hal.c b/platform/ext/target/mps2/an521/spm_hal.c
index 8e559b2..6526e31 100644
--- a/platform/ext/target/mps2/an521/spm_hal.c
+++ b/platform/ext/target/mps2/an521/spm_hal.c
@@ -16,6 +16,7 @@
#include "mpu_armv8m_drv.h"
#include "region_defs.h"
#include "secure_utilities.h"
+#include "region.h"
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
diff --git a/platform/ext/target/mps2/an521/target_cfg.c b/platform/ext/target/mps2/an521/target_cfg.c
index a6f5317..78938c3 100644
--- a/platform/ext/target/mps2/an521/target_cfg.c
+++ b/platform/ext/target/mps2/an521/target_cfg.c
@@ -21,6 +21,7 @@
#include "region_defs.h"
#include "tfm_secure_api.h"
#include "tfm_plat_defs.h"
+#include "region.h"
#ifdef PSA_API_TEST_IPC
#define PSA_FF_TEST_SECURE_UART2
@@ -28,11 +29,6 @@
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
-/* Macros to pick linker symbols */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
-
/* The section names come from the scatter file */
REGION_DECLARE(Load$$LR$$, LR_NS_PARTITION, $$Base);
REGION_DECLARE(Load$$LR$$, LR_VENEER, $$Base);
diff --git a/platform/ext/target/mps2/an539/boot_hal.c b/platform/ext/target/mps2/an539/boot_hal.c
index 26d7ce9..1b11c7b 100644
--- a/platform/ext/target/mps2/an539/boot_hal.c
+++ b/platform/ext/target/mps2/an539/boot_hal.c
@@ -1,27 +1,32 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "cmsis.h"
+#include "region.h"
+
+REGION_DECLARE(Image$$, ER_DATA, $$Base)[];
+REGION_DECLARE(Image$$, ARM_LIB_HEAP, $$ZI$$Limit)[];
__attribute__((naked)) void boot_clear_bl2_ram_area(void)
{
__ASM volatile(
".syntax unified \n"
"movs r0, #0 \n"
- "ldr r1, =Image$$ER_DATA$$Base \n"
- "ldr r2, =Image$$ARM_LIB_HEAP$$ZI$$Limit \n"
- "subs r2, r2, r1 \n"
+ "subs %1, %1, %0 \n"
"Loop: \n"
- "subs r2, #4 \n"
+ "subs %1, #4 \n"
"blt Clear_done \n"
- "str r0, [r1, r2] \n"
+ "str r0, [%0, %1] \n"
"b Loop \n"
"Clear_done: \n"
"bx lr \n"
- : : : "r0" , "r1" , "r2" , "memory"
+ :
+ : "r" (REGION_NAME(Image$$, ER_DATA, $$Base)),
+ "r" (REGION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Limit))
+ : "r0", "memory"
);
}
diff --git a/platform/ext/target/mps2/an539/spm_hal.c b/platform/ext/target/mps2/an539/spm_hal.c
index 959bd45..ce345c5 100644
--- a/platform/ext/target/mps2/an539/spm_hal.c
+++ b/platform/ext/target/mps2/an539/spm_hal.c
@@ -13,6 +13,7 @@
#include "mpu_armv8m_drv.h"
#include "region_defs.h"
#include "platform_description.h"
+#include "region.h"
/* Debug configuration flags */
#define SPNIDEN_SEL_STATUS (0x01u << 7)
diff --git a/platform/ext/target/mps2/an539/target_cfg.c b/platform/ext/target/mps2/an539/target_cfg.c
index 2854d33..b59c90b 100644
--- a/platform/ext/target/mps2/an539/target_cfg.c
+++ b/platform/ext/target/mps2/an539/target_cfg.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,15 +24,11 @@
#include "mpu_armv8m_drv.h"
#include "secure_utilities.h"
#include "tfm_plat_defs.h"
+#include "region.h"
/* Throw out bus error when an access causes security violation */
#define CMSDK_SECRESPCFG_BUS_ERR_MASK (1UL << 0)
-/* Macros to pick linker symbols */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
-
/* The section names come from the scatter file */
REGION_DECLARE(Load$$LR$$, LR_NS_PARTITION, $$Base);
REGION_DECLARE(Load$$LR$$, LR_VENEER, $$Base);
diff --git a/platform/ext/target/mps3/an524/boot_hal.c b/platform/ext/target/mps3/an524/boot_hal.c
index 5dadc3f..d5a804d 100644
--- a/platform/ext/target/mps3/an524/boot_hal.c
+++ b/platform/ext/target/mps3/an524/boot_hal.c
@@ -1,26 +1,30 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "cmsis.h"
+#include "region.h"
+
+REGION_DECLARE(Image$$, ER_DATA, $$Base)[];
+REGION_DECLARE(Image$$, ARM_LIB_HEAP, $$ZI$$Limit)[];
__attribute__((naked)) void boot_clear_bl2_ram_area(void)
{
__ASM volatile(
- ".syntax unified \n"
"mov r0, #0 \n"
- "ldr r1, =Image$$ER_DATA$$Base \n"
- "ldr r2, =Image$$ARM_LIB_HEAP$$ZI$$Limit \n"
- "subs r2, r2, r1 \n"
+ "subs %1, %1, %0 \n"
"Loop: \n"
- "subs r2, #4 \n"
+ "subs %1, #4 \n"
"itt ge \n"
- "strge r0, [r1, r2] \n"
+ "strge r0, [%0, %1] \n"
"bge Loop \n"
"bx lr \n"
- : : : "r0" , "r1" , "r2" , "memory"
+ :
+ : "r" (REGION_NAME(Image$$, ER_DATA, $$Base)),
+ "r" (REGION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Limit))
+ : "r0", "memory"
);
}
diff --git a/platform/ext/target/mps3/an524/spm_hal.c b/platform/ext/target/mps3/an524/spm_hal.c
index a25aec9..c39c2ca 100644
--- a/platform/ext/target/mps3/an524/spm_hal.c
+++ b/platform/ext/target/mps3/an524/spm_hal.c
@@ -15,6 +15,7 @@
#include "region_defs.h"
#include "platform_description.h"
#include "Driver_Common.h"
+#include "region.h"
/* Debug configuration flags */
#define SPNIDEN_SEL_STATUS (0x01u << 7)
diff --git a/platform/ext/target/mps3/an524/target_cfg.c b/platform/ext/target/mps3/an524/target_cfg.c
index 5dfdf1a..1fd93c6 100644
--- a/platform/ext/target/mps3/an524/target_cfg.c
+++ b/platform/ext/target/mps3/an524/target_cfg.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,11 +23,7 @@
#include "tfm_secure_api.h"
#include "mpu_armv8m_drv.h"
#include "tfm_plat_defs.h"
-
-/* Macros to pick linker symbols */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
+#include "region.h"
/* The section names come from the scatter file */
REGION_DECLARE(Load$$LR$$, LR_NS_PARTITION, $$Base);
diff --git a/platform/ext/target/musca_a/boot_hal.c b/platform/ext/target/musca_a/boot_hal.c
index 5dadc3f..d5a804d 100644
--- a/platform/ext/target/musca_a/boot_hal.c
+++ b/platform/ext/target/musca_a/boot_hal.c
@@ -1,26 +1,30 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "cmsis.h"
+#include "region.h"
+
+REGION_DECLARE(Image$$, ER_DATA, $$Base)[];
+REGION_DECLARE(Image$$, ARM_LIB_HEAP, $$ZI$$Limit)[];
__attribute__((naked)) void boot_clear_bl2_ram_area(void)
{
__ASM volatile(
- ".syntax unified \n"
"mov r0, #0 \n"
- "ldr r1, =Image$$ER_DATA$$Base \n"
- "ldr r2, =Image$$ARM_LIB_HEAP$$ZI$$Limit \n"
- "subs r2, r2, r1 \n"
+ "subs %1, %1, %0 \n"
"Loop: \n"
- "subs r2, #4 \n"
+ "subs %1, #4 \n"
"itt ge \n"
- "strge r0, [r1, r2] \n"
+ "strge r0, [%0, %1] \n"
"bge Loop \n"
"bx lr \n"
- : : : "r0" , "r1" , "r2" , "memory"
+ :
+ : "r" (REGION_NAME(Image$$, ER_DATA, $$Base)),
+ "r" (REGION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Limit))
+ : "r0", "memory"
);
}
diff --git a/platform/ext/target/musca_a/spm_hal.c b/platform/ext/target/musca_a/spm_hal.c
index 4f78ca1..36f1e15 100644
--- a/platform/ext/target/musca_a/spm_hal.c
+++ b/platform/ext/target/musca_a/spm_hal.c
@@ -16,6 +16,7 @@
#include "mpu_armv8m_drv.h"
#include "region_defs.h"
#include "secure_utilities.h"
+#include "region.h"
/* Import MPC driver */
extern ARM_DRIVER_MPC Driver_CODE_SRAM_MPC;
diff --git a/platform/ext/target/musca_a/target_cfg.c b/platform/ext/target/musca_a/target_cfg.c
index d4eb92c..bf39090 100644
--- a/platform/ext/target/musca_a/target_cfg.c
+++ b/platform/ext/target/musca_a/target_cfg.c
@@ -21,15 +21,11 @@
#include "region_defs.h"
#include "tfm_secure_api.h"
#include "tfm_plat_defs.h"
+#include "region.h"
#define MIN(A, B) (((A) < (B)) ? (A) : (B))
#define MAX(A, B) (((A) > (B)) ? (A) : (B))
-/* Macros to pick linker symbols */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
-
/* The section names come from the scatter file */
REGION_DECLARE(Load$$LR$$, LR_NS_PARTITION, $$Base);
REGION_DECLARE(Load$$LR$$, LR_VENEER, $$Base);
diff --git a/platform/ext/target/musca_b1/boot_hal.c b/platform/ext/target/musca_b1/boot_hal.c
index 5dadc3f..d5a804d 100644
--- a/platform/ext/target/musca_b1/boot_hal.c
+++ b/platform/ext/target/musca_b1/boot_hal.c
@@ -1,26 +1,30 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "cmsis.h"
+#include "region.h"
+
+REGION_DECLARE(Image$$, ER_DATA, $$Base)[];
+REGION_DECLARE(Image$$, ARM_LIB_HEAP, $$ZI$$Limit)[];
__attribute__((naked)) void boot_clear_bl2_ram_area(void)
{
__ASM volatile(
- ".syntax unified \n"
"mov r0, #0 \n"
- "ldr r1, =Image$$ER_DATA$$Base \n"
- "ldr r2, =Image$$ARM_LIB_HEAP$$ZI$$Limit \n"
- "subs r2, r2, r1 \n"
+ "subs %1, %1, %0 \n"
"Loop: \n"
- "subs r2, #4 \n"
+ "subs %1, #4 \n"
"itt ge \n"
- "strge r0, [r1, r2] \n"
+ "strge r0, [%0, %1] \n"
"bge Loop \n"
"bx lr \n"
- : : : "r0" , "r1" , "r2" , "memory"
+ :
+ : "r" (REGION_NAME(Image$$, ER_DATA, $$Base)),
+ "r" (REGION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Limit))
+ : "r0", "memory"
);
}
diff --git a/platform/ext/target/musca_b1/spm_hal.c b/platform/ext/target/musca_b1/spm_hal.c
index 49285a3..d9ae389 100644
--- a/platform/ext/target/musca_b1/spm_hal.c
+++ b/platform/ext/target/musca_b1/spm_hal.c
@@ -16,6 +16,7 @@
#include "mpu_armv8m_drv.h"
#include "region_defs.h"
#include "secure_utilities.h"
+#include "region.h"
/* Import MPC driver */
extern ARM_DRIVER_MPC Driver_EFLASH0_MPC;
diff --git a/platform/ext/target/musca_b1/target_cfg.c b/platform/ext/target/musca_b1/target_cfg.c
index 84be107..87ff9b7 100644
--- a/platform/ext/target/musca_b1/target_cfg.c
+++ b/platform/ext/target/musca_b1/target_cfg.c
@@ -22,11 +22,7 @@
#include "region_defs.h"
#include "tfm_secure_api.h"
#include "tfm_plat_defs.h"
-
-/* Macros to pick linker symbols */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
+#include "region.h"
/* The section names come from the scatter file */
REGION_DECLARE(Load$$LR$$, LR_NS_PARTITION, $$Base);
diff --git a/platform/ext/target/musca_s1/boot_hal.c b/platform/ext/target/musca_s1/boot_hal.c
index 5dadc3f..d5a804d 100644
--- a/platform/ext/target/musca_s1/boot_hal.c
+++ b/platform/ext/target/musca_s1/boot_hal.c
@@ -1,26 +1,30 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "cmsis.h"
+#include "region.h"
+
+REGION_DECLARE(Image$$, ER_DATA, $$Base)[];
+REGION_DECLARE(Image$$, ARM_LIB_HEAP, $$ZI$$Limit)[];
__attribute__((naked)) void boot_clear_bl2_ram_area(void)
{
__ASM volatile(
- ".syntax unified \n"
"mov r0, #0 \n"
- "ldr r1, =Image$$ER_DATA$$Base \n"
- "ldr r2, =Image$$ARM_LIB_HEAP$$ZI$$Limit \n"
- "subs r2, r2, r1 \n"
+ "subs %1, %1, %0 \n"
"Loop: \n"
- "subs r2, #4 \n"
+ "subs %1, #4 \n"
"itt ge \n"
- "strge r0, [r1, r2] \n"
+ "strge r0, [%0, %1] \n"
"bge Loop \n"
"bx lr \n"
- : : : "r0" , "r1" , "r2" , "memory"
+ :
+ : "r" (REGION_NAME(Image$$, ER_DATA, $$Base)),
+ "r" (REGION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Limit))
+ : "r0", "memory"
);
}
diff --git a/platform/ext/target/musca_s1/spm_hal.c b/platform/ext/target/musca_s1/spm_hal.c
index 5d038f6..45622c4 100644
--- a/platform/ext/target/musca_s1/spm_hal.c
+++ b/platform/ext/target/musca_s1/spm_hal.c
@@ -16,6 +16,7 @@
#include "mpu_armv8m_drv.h"
#include "region_defs.h"
#include "secure_utilities.h"
+#include "region.h"
/* Import MPC driver */
extern ARM_DRIVER_MPC Driver_CODE_SRAM_MPC;
diff --git a/platform/ext/target/musca_s1/target_cfg.c b/platform/ext/target/musca_s1/target_cfg.c
index ec53df2..b2c9d9a 100644
--- a/platform/ext/target/musca_s1/target_cfg.c
+++ b/platform/ext/target/musca_s1/target_cfg.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,15 +22,11 @@
#include "region_defs.h"
#include "tfm_secure_api.h"
#include "tfm_plat_defs.h"
+#include "region.h"
#define MIN(A, B) (((A) < (B)) ? (A) : (B))
#define MAX(A, B) (((A) > (B)) ? (A) : (B))
-/* Macros to pick linker symbols */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
-
/* The section names come from the scatter file */
REGION_DECLARE(Load$$LR$$, LR_NS_PARTITION, $$Base);
REGION_DECLARE(Load$$LR$$, LR_VENEER, $$Base);
diff --git a/platform/ext/target/sse-200_aws/boot_hal.c b/platform/ext/target/sse-200_aws/boot_hal.c
index 5dadc3f..bea5786 100644
--- a/platform/ext/target/sse-200_aws/boot_hal.c
+++ b/platform/ext/target/sse-200_aws/boot_hal.c
@@ -1,26 +1,31 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "cmsis.h"
+#include "region.h"
+
+
+REGION_DECLARE(Image$$, ER_DATA, $$Base)[];
+REGION_DECLARE(Image$$, ARM_LIB_HEAP, $$ZI$$Limit)[];
__attribute__((naked)) void boot_clear_bl2_ram_area(void)
{
__ASM volatile(
- ".syntax unified \n"
"mov r0, #0 \n"
- "ldr r1, =Image$$ER_DATA$$Base \n"
- "ldr r2, =Image$$ARM_LIB_HEAP$$ZI$$Limit \n"
- "subs r2, r2, r1 \n"
+ "subs %1, %1, %0 \n"
"Loop: \n"
- "subs r2, #4 \n"
+ "subs %1, #4 \n"
"itt ge \n"
- "strge r0, [r1, r2] \n"
+ "strge r0, [%0, %1] \n"
"bge Loop \n"
"bx lr \n"
- : : : "r0" , "r1" , "r2" , "memory"
+ :
+ : "r" (REGION_NAME(Image$$, ER_DATA, $$Base)),
+ "r" (REGION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Limit))
+ : "r0", "memory"
);
}
diff --git a/platform/ext/target/sse-200_aws/spm_hal.c b/platform/ext/target/sse-200_aws/spm_hal.c
index be04637..34b2c1c 100644
--- a/platform/ext/target/sse-200_aws/spm_hal.c
+++ b/platform/ext/target/sse-200_aws/spm_hal.c
@@ -16,6 +16,7 @@
#include "mpu_armv8m_drv.h"
#include "region_defs.h"
#include "secure_utilities.h"
+#include "region.h"
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
diff --git a/platform/ext/target/sse-200_aws/target_cfg.c b/platform/ext/target/sse-200_aws/target_cfg.c
index 1d37188..5673a2d 100644
--- a/platform/ext/target/sse-200_aws/target_cfg.c
+++ b/platform/ext/target/sse-200_aws/target_cfg.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 Arm Limited
+ * Copyright (c) 2017-2020 Arm Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,14 +21,10 @@
#include "region_defs.h"
#include "tfm_secure_api.h"
#include "tfm_plat_defs.h"
+#include "region.h"
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
-/* Macros to pick linker symbols */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
-
/* The section names come from the scatter file */
REGION_DECLARE(Load$$LR$$, LR_NS_PARTITION, $$Base);
REGION_DECLARE(Load$$LR$$, LR_VENEER, $$Base);
diff --git a/platform/include/region.h b/platform/include/region.h
new file mode 100644
index 0000000..c6ca921
--- /dev/null
+++ b/platform/include/region.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __REGION_H__
+#define __REGION_H__
+
+/* Macros to pick linker symbols */
+#define REGION(a, b, c) a##b##c
+#define REGION_NAME(a, b, c) REGION(a, b, c)
+#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
+#define REGION_DECLARE_T(a, b, c, t) extern t REGION_NAME(a, b, c)
+
+#endif /* __REGION_H__ */
diff --git a/secure_fw/core/ipc/include/tfm_pools.h b/secure_fw/core/ipc/include/tfm_pools.h
index 64be3c4..422484b 100644
--- a/secure_fw/core/ipc/include/tfm_pools.h
+++ b/secure_fw/core/ipc/include/tfm_pools.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -28,11 +28,20 @@
uint8_t data[0]; /* Data indicator */
};
+/*
+ * tfm_pool_chunk_t minus the zero length "data" member,
+ * required for standards compliant C
+ */
+struct tfm_pool_chunk_s_t {
+ struct tfm_list_node_t list; /* Chunk list */
+ void *pool; /* Point to the parent pool */
+};
+
struct tfm_pool_instance_t {
size_t chunksz; /* Chunks size of pool member */
size_t chunk_count; /* A number of chunks in the pool */
struct tfm_list_node_t chunks_list; /* Chunk list head in pool */
- struct tfm_pool_chunk_t chunks[0]; /* Data indicator */
+ struct tfm_pool_chunk_s_t chunks[0]; /* Data indicator */
};
/*
diff --git a/secure_fw/core/ipc/tfm_multi_core_mem_check.c b/secure_fw/core/ipc/tfm_multi_core_mem_check.c
index 0d20f07..b126c7d 100644
--- a/secure_fw/core/ipc/tfm_multi_core_mem_check.c
+++ b/secure_fw/core/ipc/tfm_multi_core_mem_check.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -15,6 +15,7 @@
#include "tfm_multi_core.h"
#include "tfm_secure_api.h"
#include "tfm_utils.h"
+#include "region.h"
#ifndef TFM_LVL
#error TFM_LVL is not defined!
diff --git a/secure_fw/core/ipc/tfm_psa_client_call.c b/secure_fw/core/ipc/tfm_psa_client_call.c
index 3d8f46f..e4c349f 100644
--- a/secure_fw/core/ipc/tfm_psa_client_call.c
+++ b/secure_fw/core/ipc/tfm_psa_client_call.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -204,8 +204,10 @@
*/
for (i = 0; i + 1 < in_num; i++) {
for (j = i+1; j < in_num; j++) {
- if (!(invecs[j].base + invecs[j].len <= invecs[i].base ||
- invecs[j].base >= invecs[i].base + invecs[i].len)) {
+ if (!((char *) invecs[j].base + invecs[j].len <=
+ (char *) invecs[i].base ||
+ (char *) invecs[j].base >=
+ (char *) invecs[i].base + invecs[i].len)) {
tfm_core_panic();
}
}
diff --git a/secure_fw/core/ipc/tfm_svcalls.c b/secure_fw/core/ipc/tfm_svcalls.c
index ec14f0b..72ba1a1 100644
--- a/secure_fw/core/ipc/tfm_svcalls.c
+++ b/secure_fw/core/ipc/tfm_svcalls.c
@@ -29,6 +29,7 @@
#include "tfm_rpc.h"
#include "tfm_internal.h"
#include "tfm_core_trustzone.h"
+#include "region.h"
#ifdef PLATFORM_SVC_HANDLERS
extern int32_t platform_svc_handlers(tfm_svc_number_t svc_num,
@@ -130,7 +131,7 @@
TFM_CORE_ASSERT(args != NULL);
handle = args[0];
- return tfm_psa_close(handle, ns_caller);
+ tfm_psa_close(handle, ns_caller);
}
uint32_t tfm_svcall_get_lifecycle_state(void)
@@ -415,7 +416,7 @@
tfm_core_util_memcpy(buffer, msg->invec[invec_idx].base, bytes);
/* There maybe some remaining data */
- msg->invec[invec_idx].base += bytes;
+ msg->invec[invec_idx].base = (char *) msg->invec[invec_idx].base + bytes;
msg->msg.in_size[invec_idx] -= bytes;
return bytes;
@@ -486,7 +487,8 @@
}
/* There maybe some remaining data */
- msg->invec[invec_idx].base += num_bytes;
+ msg->invec[invec_idx].base = (char *) msg->invec[invec_idx].base +
+ num_bytes;
msg->msg.in_size[invec_idx] -= num_bytes;
return num_bytes;
@@ -570,7 +572,7 @@
tfm_core_panic();
}
- tfm_core_util_memcpy(msg->outvec[outvec_idx].base +
+ tfm_core_util_memcpy((char *) msg->outvec[outvec_idx].base +
msg->outvec[outvec_idx].len, buffer, num_bytes);
/* Update the write number */
@@ -771,7 +773,7 @@
TFM_CORE_ASSERT(args != NULL);
partition_id = (int32_t)args[0];
- return notify_with_signal(partition_id, PSA_DOORBELL);
+ notify_with_signal(partition_id, PSA_DOORBELL);
}
/**
diff --git a/secure_fw/core/tfm_core.c b/secure_fw/core/tfm_core.c
index 3387464..e834b39 100644
--- a/secure_fw/core/tfm_core.c
+++ b/secure_fw/core/tfm_core.c
@@ -20,6 +20,7 @@
#include "tfm_version.h"
#include "spm_db.h"
#include "log/tfm_log.h"
+#include "region.h"
#ifdef TFM_PSA_API
#include "psa/client.h"
#include "psa/service.h"
diff --git a/secure_fw/core/tfm_func_api.c b/secure_fw/core/tfm_func_api.c
index ca603eb..92c8b95 100644
--- a/secure_fw/core/tfm_func_api.c
+++ b/secure_fw/core/tfm_func_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -22,6 +22,7 @@
#include "psa/service.h"
#include "tfm_core_mem_check.h"
#include "tfm_secure_api.h"
+#include "region.h"
#define EXC_RETURN_SECURE_FUNCTION 0xFFFFFFFD
#define EXC_RETURN_SECURE_HANDLER 0xFFFFFFF1
@@ -30,13 +31,8 @@
#error TFM_LVL is not defined!
#endif
-/* Macros to pick linker symbols and allow references to sections */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
-
-REGION_DECLARE(Image$$, TFM_SECURE_STACK, $$ZI$$Base);
-REGION_DECLARE(Image$$, TFM_SECURE_STACK, $$ZI$$Limit);
+REGION_DECLARE_T(Image$$, TFM_SECURE_STACK, $$ZI$$Base, uint32_t);
+REGION_DECLARE_T(Image$$, TFM_SECURE_STACK, $$ZI$$Limit, struct iovec_args_t)[];
/* This is the "Big Lock" on the secure side, to guarantee single entry
* to SPE
diff --git a/secure_fw/core/tfm_secure_api.c b/secure_fw/core/tfm_secure_api.c
index c0bdc75..53b3499 100644
--- a/secure_fw/core/tfm_secure_api.c
+++ b/secure_fw/core/tfm_secure_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -44,7 +44,7 @@
/* Calculate the result */
range_in_region = ((uintptr_t)p >= region_start) &&
- ((uintptr_t)(p + s - 1) <= region_limit);
+ ((uintptr_t)((char *) p + s - 1) <= region_limit);
if (range_in_region) {
return TFM_SUCCESS;
} else {
diff --git a/secure_fw/spm/spm_api.c b/secure_fw/spm/spm_api.c
index 044e336..f71db78 100644
--- a/secure_fw/spm/spm_api.c
+++ b/secure_fw/spm/spm_api.c
@@ -20,6 +20,7 @@
#include "tfm_peripherals_def.h"
#include "spm_partition_defs.h"
#include "psa/lifecycle.h"
+#include "region.h"
#define NON_SECURE_INTERNAL_PARTITION_DB_IDX 0
#define TFM_CORE_INTERNAL_PARTITION_DB_IDX 1
diff --git a/secure_fw/spm/spm_api.h b/secure_fw/spm/spm_api.h
index 33118b1..b28cac7 100644
--- a/secure_fw/spm/spm_api.h
+++ b/secure_fw/spm/spm_api.h
@@ -88,8 +88,8 @@
*/
struct spm_partition_runtime_data_t {
#ifdef TFM_PSA_API
- struct tfm_event_t signal_evnt; /* Event signal */
uint32_t signals; /* Service signals had been triggered*/
+ struct tfm_event_t signal_evnt; /* Event signal */
struct tfm_list_node_t service_list;/* Service list */
struct tfm_core_thread_t sp_thrd; /* Thread object */
uint32_t assigned_signals; /* All assigned signals */
diff --git a/secure_fw/spm/spm_db.h b/secure_fw/spm/spm_db.h
index 6cd0e4e..2cbbe44 100644
--- a/secure_fw/spm/spm_db.h
+++ b/secure_fw/spm/spm_db.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -68,10 +68,6 @@
struct spm_partition_desc_t *partitions;
};
-/* Macros to pick linker symbols and allow to form the partition data base */
-#define REGION(a, b, c) a##b##c
-#define REGION_NAME(a, b, c) REGION(a, b, c)
-#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
#ifdef TFM_PSA_API
#define PART_REGION_ADDR(partition, region) \
(uint32_t)®ION_NAME(Image$$, partition, region)
diff --git a/secure_fw/spm/tfm_spm_db.inc b/secure_fw/spm/tfm_spm_db.inc
index 3da5c47..d22d46b 100644
--- a/secure_fw/spm/tfm_spm_db.inc
+++ b/secure_fw/spm/tfm_spm_db.inc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -1261,10 +1261,10 @@
/**************************************************************************/
static struct spm_partition_desc_t partition_list [] =
{
- {{}}, /* placeholder for Non-secure internal partition */
+ {{0}}, /* placeholder for Non-secure internal partition */
#ifndef TFM_PSA_API
- {{}}, /* placeholder for TF-M Core internal partition */
-#endif /* !ifndefined(TFM_PSA_API) */
+ {{0}}, /* placeholder for TF-M Core internal partition */
+#endif
/* -----------------------------------------------------------------------*/
/* - Partition DB record for TFM_SP_STORAGE */
@@ -1272,7 +1272,7 @@
#ifdef TFM_PARTITION_SECURE_STORAGE
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1284,7 +1284,7 @@
#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1296,7 +1296,7 @@
#ifdef TFM_PARTITION_AUDIT_LOG
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1308,7 +1308,7 @@
#ifdef TFM_PARTITION_CRYPTO
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1320,7 +1320,7 @@
#ifdef TFM_PARTITION_PLATFORM
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1332,7 +1332,7 @@
#ifdef TFM_PARTITION_INITIAL_ATTESTATION
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1344,7 +1344,7 @@
#ifdef TFM_PARTITION_TEST_CORE
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1356,7 +1356,7 @@
#ifdef TFM_PARTITION_TEST_CORE
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1368,7 +1368,7 @@
#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1380,7 +1380,7 @@
#ifdef TFM_PARTITION_TEST_CORE_IPC
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1392,7 +1392,7 @@
#ifdef TFM_PARTITION_TEST_CORE_IPC
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1404,7 +1404,7 @@
#ifdef TFM_ENABLE_IRQ_TEST
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1416,7 +1416,7 @@
#ifdef TFM_PARTITION_TEST_SST
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1428,7 +1428,7 @@
#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
@@ -1440,7 +1440,7 @@
#ifdef TFM_MULTI_CORE_TEST
{
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
},
diff --git a/secure_fw/spm/tfm_spm_db.inc.template b/secure_fw/spm/tfm_spm_db.inc.template
index 83de242..5a0f453 100644
--- a/secure_fw/spm/tfm_spm_db.inc.template
+++ b/secure_fw/spm/tfm_spm_db.inc.template
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -321,10 +321,10 @@
/**************************************************************************/
static struct spm_partition_desc_t partition_list [] =
{
- {{'{{}}'}}, /* placeholder for Non-secure internal partition */
+ {{'{{0}}'}}, /* placeholder for Non-secure internal partition */
#ifndef TFM_PSA_API
- {{'{{}}'}}, /* placeholder for TF-M Core internal partition */
-#endif /* !ifndefined(TFM_PSA_API) */
+ {{'{{0}}'}}, /* placeholder for TF-M Core internal partition */
+#endif
{% for manifest in manifests %}
/* -----------------------------------------------------------------------*/
@@ -335,7 +335,7 @@
{% endif %}
{{'{'}}
/* Runtime data */
- .runtime_data = {},
+ .runtime_data = {0},
.static_data = NULL,
.platform_data_list = NULL,
{{'},'}}
diff --git a/test/suites/core/non_secure/core_test_api.c b/test/suites/core/non_secure/core_test_api.c
index 05c9a77..b49af5d 100644
--- a/test/suites/core/non_secure/core_test_api.c
+++ b/test/suites/core/non_secure/core_test_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,10 +8,10 @@
#include "core_test_api.h"
#include "test/test_services/tfm_core_test/core_test_defs.h"
-int32_t tfm_core_test_call(void *fn_ptr, struct tfm_core_test_call_args_t *args)
+int32_t tfm_core_test_call(int32_t (*fn_ptr)(struct psa_invec*, size_t,
+ struct psa_outvec*, size_t),
+ struct tfm_core_test_call_args_t *args)
{
- int32_t (*fn_ptr_to_call)(struct psa_invec*, size_t,
- struct psa_outvec*, size_t) = fn_ptr;
- return fn_ptr_to_call(args->in_vec, args->in_len,
- args->out_vec, args->out_len);
+ return fn_ptr(args->in_vec, args->in_len,
+ args->out_vec, args->out_len);
}
diff --git a/test/suites/core/non_secure/core_test_api.h b/test/suites/core/non_secure/core_test_api.h
index 0f83311..eaa8b44 100644
--- a/test/suites/core/non_secure/core_test_api.h
+++ b/test/suites/core/non_secure/core_test_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -34,7 +34,7 @@
*
* \return Returns value depending on fn_ptr.
*/
-int32_t tfm_core_test_call(void *fn_ptr,
+int32_t tfm_core_test_call(int32_t (*fn_ptr)(),
struct tfm_core_test_call_args_t *args);
#ifdef __cplusplus