Platform: Add secure part section tag for data
This patch adds secure partition section tags. Those tags can be used
to place data, which is not located in the service folder, in the
secure partition area.
Change-Id: I6868376aed8e53f125d305600a82e6395f3dede4
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/platform/include/tfm_plat_defs.h b/platform/include/tfm_plat_defs.h
index ffe61f6..2a90d94 100644
--- a/platform/include/tfm_plat_defs.h
+++ b/platform/include/tfm_plat_defs.h
@@ -25,16 +25,46 @@
TFM_PLAT_ERR_FORCE_INT_SIZE = INT_MAX
};
+#if defined(TFM_LVL) && (TFM_LVL != 1)
/*!
- * \def TFM_LINK_SET_OBJECT_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
+ * \def TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
*
- * \brief This macro provides a mechanism to place a function code in a specific
- * secure partition at linker time in TF-M Level 3.
+ * \brief This macro provides a mechanism to place a function code or a data
+ * variable in the code section (e.g. RO) of a specific secure partition
+ * at linker time in TF-M Level 3.
*
* \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest
* file "name" field.
*/
-#define TFM_LINK_SET_OBJECT_IN_PARTITION_SECTION(TFM_PARTITION_NAME) \
+#define TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME) \
__attribute__((section(TFM_PARTITION_NAME"_ATTR_FN")))
+/*!
+ * \def TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
+ *
+ * \brief This macro provides a mechanism to place data variables in the RW data
+ * section of a specific secure partition at linker time in TF-M Level 3.
+ *
+ * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest
+ * file "name" field.
+ */
+#define TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME) \
+ __attribute__((section(TFM_PARTITION_NAME"_ATTR_RW")))
+
+/*!
+ * \def TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
+ *
+ * \brief This macro provides a mechanism to place data variables in the ZI data
+ * section of a specific secure partition at linker time in TF-M Level 3.
+ *
+ * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest
+ * file "name" field.
+ */
+#define TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME) \
+ __attribute__((section(TFM_PARTITION_NAME"_ATTR_ZI")))
+#else
+#define TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
+#define TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
+#define TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
+#endif
#endif /* __TFM_PLAT_DEFS_H__ */
diff --git a/platform/include/tfm_platform_system.h b/platform/include/tfm_platform_system.h
index 8ad22b1..c248fe5 100644
--- a/platform/include/tfm_platform_system.h
+++ b/platform/include/tfm_platform_system.h
@@ -25,7 +25,7 @@
*
* \details Requests a system reset to reset the MCU.
*/
-TFM_LINK_SET_OBJECT_IN_PARTITION_SECTION("TFM_SP_PLATFORM")
+TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_PLATFORM")
void tfm_platform_hal_system_reset(void);
/*!
@@ -38,7 +38,7 @@
*
* \return Returns values as specified by the \ref tfm_platform_err_t
*/
-TFM_LINK_SET_OBJECT_IN_PARTITION_SECTION("TFM_SP_PLATFORM")
+TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_PLATFORM")
enum tfm_platform_err_t tfm_platform_hal_ioctl(tfm_platform_ioctl_req_t request,
psa_invec *in_vec,
psa_outvec *out_vec);