ITS/PS: Make file system configuration dynamic
Support not providing the following macros:
- ITS_FLASH_AREA_ADDR
- ITS_FLASH_AREA_SIZE
- PS_FLASH_AREA_ADDR
- PS_FLASH_AREA_SIZE
instead getting them from the platform HAL at runtime.
The intent here is that it will eventually be possible to use a single
TFM image on multiple boards, with the flash layout specified in
provisioning information.
Add platform HAL API functions to get the file system configuration.
Provide default implementations that just use the macros.
Add support for new macros, ITS_RAM_FS_SIZE and PS_RAM_FS_SIZE, for
use with ITS_RAM_FS and PS_RAM_FS.
Also add a validation function and perform the validation of fs
configuration that was previously done at compile-time at runtime.
There's a TODO in the new code - to move the flash_dev from struct
its_flash_info_t to struct flash_fs_info_t. Because the sector_size
and erase_val are both hard-coded in macros rather than being read
from the device driver using flash_dev->ARM_Flash_GetInfo(), this
would be a fairly major change in itself at this time.
Change-Id: I6ccb126999b0227e85dd8f6de2ea044e2a36c2e8
Signed-off-by: Chris Brand <chris.brand@cypress.com>
diff --git a/platform/ext/Mps2AN519.cmake b/platform/ext/Mps2AN519.cmake
index c18f482..3613f67 100644
--- a/platform/ext/Mps2AN519.cmake
+++ b/platform/ext/Mps2AN519.cmake
@@ -1,5 +1,6 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -146,6 +147,8 @@
if (TFM_PARTITION_PLATFORM)
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an519/services/src/tfm_platform_system.c")
endif()
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_platform.c")
embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
endif()
diff --git a/platform/ext/Mps2AN521.cmake b/platform/ext/Mps2AN521.cmake
index 6a6d64d..215ab04 100644
--- a/platform/ext/Mps2AN521.cmake
+++ b/platform/ext/Mps2AN521.cmake
@@ -1,5 +1,6 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -147,6 +148,8 @@
if (TFM_PARTITION_PLATFORM)
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an521/services/src/tfm_platform_system.c")
endif()
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_platform.c")
embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
endif()
diff --git a/platform/ext/Mps2AN539.cmake b/platform/ext/Mps2AN539.cmake
index a806e50..f0b572e 100644
--- a/platform/ext/Mps2AN539.cmake
+++ b/platform/ext/Mps2AN539.cmake
@@ -1,5 +1,6 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -143,6 +144,8 @@
if (TFM_PARTITION_PLATFORM)
list(APPEND ALL_SRC_C_S "${AN539_DIR}/services/src/tfm_platform_system.c")
endif()
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_platform.c")
embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
endif()
diff --git a/platform/ext/Mps3AN524.cmake b/platform/ext/Mps3AN524.cmake
index 6ab58f4..557c19d 100644
--- a/platform/ext/Mps3AN524.cmake
+++ b/platform/ext/Mps3AN524.cmake
@@ -1,5 +1,6 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -153,6 +154,8 @@
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/template/attest_hal.c")
list(APPEND ALL_SRC_C_S "${AN524_DIR}/native_drivers/mpu_armv8m_drv.c")
list(APPEND ALL_SRC_C_S "${AN524_DIR}/services/src/tfm_platform_system.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_platform.c")
embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
endif()
diff --git a/platform/ext/SSE-200_AWS.cmake b/platform/ext/SSE-200_AWS.cmake
index 4c9500f..c56f3b8 100644
--- a/platform/ext/SSE-200_AWS.cmake
+++ b/platform/ext/SSE-200_AWS.cmake
@@ -1,5 +1,6 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -149,6 +150,8 @@
if (TFM_PARTITION_PLATFORM)
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/sse-200_aws/services/src/tfm_platform_system.c")
endif()
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_platform.c")
embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
endif()
diff --git a/platform/ext/common/tfm_hal_its.c b/platform/ext/common/tfm_hal_its.c
new file mode 100644
index 0000000..ed7b6ad
--- /dev/null
+++ b/platform/ext/common/tfm_hal_its.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "cmsis_compiler.h"
+#include "flash_layout.h"
+#include "tfm_hal_its.h"
+
+__WEAK void tfm_hal_its_fs_info(uint32_t *flash_area_addr, uint32_t *flash_area_size)
+{
+ if (!flash_area_addr || !flash_area_size) {
+ return;
+ }
+
+ *flash_area_addr = ITS_FLASH_AREA_ADDR;
+ *flash_area_size = ITS_FLASH_AREA_SIZE;
+}
diff --git a/platform/ext/common/tfm_hal_ps.c b/platform/ext/common/tfm_hal_ps.c
new file mode 100644
index 0000000..df88292
--- /dev/null
+++ b/platform/ext/common/tfm_hal_ps.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "cmsis_compiler.h"
+#include "flash_layout.h"
+#include "tfm_hal_ps.h"
+
+__WEAK void tfm_hal_ps_fs_info(uint32_t *flash_area_addr, uint32_t *flash_area_size)
+{
+ if (!flash_area_addr || !flash_area_size) {
+ return;
+ }
+
+ *flash_area_addr = PS_FLASH_AREA_ADDR;
+ *flash_area_size = PS_FLASH_AREA_SIZE;
+}
diff --git a/platform/ext/fvp_sse300_mps2.cmake b/platform/ext/fvp_sse300_mps2.cmake
index 9a9030e..6117b71 100644
--- a/platform/ext/fvp_sse300_mps2.cmake
+++ b/platform/ext/fvp_sse300_mps2.cmake
@@ -1,5 +1,6 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -137,6 +138,8 @@
if (TFM_PARTITION_PLATFORM)
list(APPEND ALL_SRC_C_S "${FVP_SSE300_DIR}/services/src/tfm_platform_system.c")
endif()
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_platform.c")
embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
endif()
diff --git a/platform/ext/lpc55s69.cmake b/platform/ext/lpc55s69.cmake
index 66f72f4..be11318 100644
--- a/platform/ext/lpc55s69.cmake
+++ b/platform/ext/lpc55s69.cmake
@@ -1,6 +1,7 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
# Copyright (c) 2020, Linaro. All rights reserved.
+# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -174,6 +175,8 @@
if (TFM_PARTITION_PLATFORM)
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/nxp/lpcxpresso55s69/services/src/tfm_platform_system.c")
endif()
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_platform.c")
embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
endif()
diff --git a/platform/ext/musca_a.cmake b/platform/ext/musca_a.cmake
index 3af796f..e76f751 100644
--- a/platform/ext/musca_a.cmake
+++ b/platform/ext/musca_a.cmake
@@ -1,5 +1,6 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -138,6 +139,8 @@
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/musca_a/spm_hal.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/template/attest_hal.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/musca_a/Native_Driver/mpu_armv8m_drv.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_platform.c")
if (TFM_PARTITION_PLATFORM)
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/musca_a/services/src/tfm_platform_system.c")
diff --git a/platform/ext/musca_b1.cmake b/platform/ext/musca_b1.cmake
index b25cd82..32c3176 100644
--- a/platform/ext/musca_b1.cmake
+++ b/platform/ext/musca_b1.cmake
@@ -1,5 +1,6 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -148,6 +149,8 @@
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/musca_b1/services/src/tfm_platform_system.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/musca_b1/services/src/tfm_ioctl_s_api.c")
endif()
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_platform.c")
embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
endif()
diff --git a/platform/ext/musca_s1.cmake b/platform/ext/musca_s1.cmake
index 0815c3b..c8acee1 100644
--- a/platform/ext/musca_s1.cmake
+++ b/platform/ext/musca_s1.cmake
@@ -1,5 +1,6 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -146,6 +147,8 @@
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/musca_s1/services/src/tfm_platform_system.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/musca_s1/services/src/tfm_ioctl_s_api.c")
endif()
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_platform.c")
embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
endif()
diff --git a/platform/ext/psoc64.cmake b/platform/ext/psoc64.cmake
index db48300..c47dea3 100644
--- a/platform/ext/psoc64.cmake
+++ b/platform/ext/psoc64.cmake
@@ -202,6 +202,8 @@
if (TFM_PARTITION_PLATFORM)
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/cypress/psoc64/services/src/tfm_platform_system.c")
endif()
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_platform.c")
embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
endif()
diff --git a/platform/ext/readme.rst b/platform/ext/readme.rst
index 1d877d4..52e14da 100644
--- a/platform/ext/readme.rst
+++ b/platform/ext/readme.rst
@@ -226,6 +226,8 @@
.. Note::
The sectors must be consecutive.
+ The platform may implement ``tfm_hal_ps_fs_info()`` as an alternative
+ to defining ``PS_FLASH_AREA_ADDR`` and ``PS_FLASH_AREA_SIZE``.
Internal Trusted Storage (ITS) Service definitions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -251,6 +253,8 @@
.. Note::
The sectors must be consecutive.
+ The platform may implement ``tfm_hal_its_fs_info()`` as an alternative
+ to defining ``ITS_FLASH_AREA_ADDR`` and ``ITS_FLASH_AREA_SIZE``.
***************************************
Expose target support for HW components
@@ -266,3 +270,4 @@
--------------
*Copyright (c) 2017-2020, Arm Limited. All rights reserved.*
+*Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.*
diff --git a/platform/ext/target/cypress/psoc64/partition/flash_layout.h b/platform/ext/target/cypress/psoc64/partition/flash_layout.h
index 36bdeeb..1f30233 100644
--- a/platform/ext/target/cypress/psoc64/partition/flash_layout.h
+++ b/platform/ext/target/cypress/psoc64/partition/flash_layout.h
@@ -132,6 +132,7 @@
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
/* Dedicated flash area for PS */
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of PS_SECTOR_SIZE per block */
#define PS_SECTORS_PER_BLOCK 0x8
@@ -156,6 +157,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
/* Dedicated flash area for ITS */
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of ITS_SECTOR_SIZE per block */
#define ITS_SECTORS_PER_BLOCK (0x8)
diff --git a/platform/ext/target/mps2/an519/partition/flash_layout.h b/platform/ext/target/mps2/an519/partition/flash_layout.h
index e6eb047..098e1c9 100644
--- a/platform/ext/target/mps2/an519/partition/flash_layout.h
+++ b/platform/ext/target/mps2/an519/partition/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017-2020 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -178,6 +179,7 @@
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
/* Dedicated flash area for PS */
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of PS_SECTOR_SIZE per block */
#define PS_SECTORS_PER_BLOCK (0x1)
@@ -202,6 +204,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
/* Dedicated flash area for ITS */
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of ITS_SECTOR_SIZE per block */
#define ITS_SECTORS_PER_BLOCK (0x1)
diff --git a/platform/ext/target/mps2/an521/partition/flash_layout.h b/platform/ext/target/mps2/an521/partition/flash_layout.h
index cb661ea..5e87781 100644
--- a/platform/ext/target/mps2/an521/partition/flash_layout.h
+++ b/platform/ext/target/mps2/an521/partition/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017-2020 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -178,6 +179,7 @@
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
/* Dedicated flash area for PS */
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of PS_SECTOR_SIZE per block */
#define PS_SECTORS_PER_BLOCK (0x1)
@@ -202,6 +204,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
/* Dedicated flash area for ITS */
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of ITS_SECTOR_SIZE per block */
#define ITS_SECTORS_PER_BLOCK (0x1)
diff --git a/platform/ext/target/mps2/an539/partition/flash_layout.h b/platform/ext/target/mps2/an539/partition/flash_layout.h
index 092e83b..6cd45c3 100644
--- a/platform/ext/target/mps2/an539/partition/flash_layout.h
+++ b/platform/ext/target/mps2/an539/partition/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2019-2020 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -177,6 +178,7 @@
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
/* Dedicated flash area for PS */
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of PS_SECTOR_SIZE per block */
#define PS_SECTORS_PER_BLOCK (0x1)
@@ -201,6 +203,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
/* Dedicated flash area for ITS */
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of ITS_SECTOR_SIZE per block */
#define ITS_SECTORS_PER_BLOCK (0x1)
diff --git a/platform/ext/target/mps2/fvp_sse300/partition/flash_layout.h b/platform/ext/target/mps2/fvp_sse300/partition/flash_layout.h
index 39461c5..f188add 100644
--- a/platform/ext/target/mps2/fvp_sse300/partition/flash_layout.h
+++ b/platform/ext/target/mps2/fvp_sse300/partition/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2019-2020 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -181,6 +182,7 @@
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
/* Dedicated flash area for PS */
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of PS_SECTOR_SIZE per block */
#define PS_SECTORS_PER_BLOCK (0x1)
@@ -205,6 +207,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
/* Dedicated flash area for ITS */
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of ITS_SECTOR_SIZE per block */
#define ITS_SECTORS_PER_BLOCK (0x1)
diff --git a/platform/ext/target/mps3/an524/partition/flash_layout.h b/platform/ext/target/mps3/an524/partition/flash_layout.h
index 191445a..8dcab0c 100644
--- a/platform/ext/target/mps3/an524/partition/flash_layout.h
+++ b/platform/ext/target/mps3/an524/partition/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2019-2020 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -165,6 +166,7 @@
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
/* Dedicated flash area for PS */
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
/* Sector size of the flash hardware; same as FLASH0_SECTOR_SIZE */
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of PS_SECTOR_SIZE per block */
@@ -190,6 +192,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
/* Dedicated flash area for ITS */
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
/* Sector size of the flash hardware; same as FLASH0_SECTOR_SIZE */
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of ITS_SECTOR_SIZE per block */
diff --git a/platform/ext/target/musca_a/partition/flash_layout.h b/platform/ext/target/musca_a/partition/flash_layout.h
index 126f173..6e311df 100644
--- a/platform/ext/target/musca_a/partition/flash_layout.h
+++ b/platform/ext/target/musca_a/partition/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2020 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -185,6 +186,7 @@
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
/* Dedicated flash area for PS */
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of PS_SECTOR_SIZE per block */
#define PS_SECTORS_PER_BLOCK (0x1)
@@ -209,6 +211,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
/* Dedicated flash area for ITS */
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of ITS_SECTOR_SIZE per block */
#define ITS_SECTORS_PER_BLOCK (0x1)
diff --git a/platform/ext/target/musca_b1/partition/flash_layout.h b/platform/ext/target/musca_b1/partition/flash_layout.h
index 1ccb5e8..4738e68 100644
--- a/platform/ext/target/musca_b1/partition/flash_layout.h
+++ b/platform/ext/target/musca_b1/partition/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2020 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -184,6 +185,7 @@
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
/* Dedicated flash area for PS */
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
#define PS_SECTOR_SIZE QSPI_FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of PS_SECTOR_SIZE per block */
#define PS_SECTORS_PER_BLOCK (0x1)
@@ -208,6 +210,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
/* Dedicated flash area for ITS */
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of ITS_SECTOR_SIZE per block */
#define ITS_SECTORS_PER_BLOCK (0x1)
diff --git a/platform/ext/target/musca_s1/partition/flash_layout.h b/platform/ext/target/musca_s1/partition/flash_layout.h
index 72b4810..70281e0 100644
--- a/platform/ext/target/musca_s1/partition/flash_layout.h
+++ b/platform/ext/target/musca_s1/partition/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2020 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -187,6 +188,7 @@
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
/* Dedicated flash area for PS */
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of PS_SECTOR_SIZE per block */
#define PS_SECTORS_PER_BLOCK (0x1)
@@ -211,6 +213,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
/* Dedicated flash area for ITS */
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of ITS_SECTOR_SIZE per block */
#define ITS_SECTORS_PER_BLOCK (0x1)
diff --git a/platform/ext/target/nxp/lpcxpresso55s69/partition/flash_layout.h b/platform/ext/target/nxp/lpcxpresso55s69/partition/flash_layout.h
index acee769..74794c5 100755
--- a/platform/ext/target/nxp/lpcxpresso55s69/partition/flash_layout.h
+++ b/platform/ext/target/nxp/lpcxpresso55s69/partition/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2020 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -176,6 +177,7 @@
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
/* Dedicated flash area for PS */
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of PS_SECTOR_SIZE per block */
#define PS_SECTORS_PER_BLOCK (0x8)
@@ -201,6 +203,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
/* Dedicated flash area for ITS */
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of ITS_SECTOR_SIZE per block */
#define ITS_SECTORS_PER_BLOCK (0x2)
diff --git a/platform/ext/target/sse-200_aws/partition/flash_layout.h b/platform/ext/target/sse-200_aws/partition/flash_layout.h
index d2fb3a4..699180e 100644
--- a/platform/ext/target/sse-200_aws/partition/flash_layout.h
+++ b/platform/ext/target/sse-200_aws/partition/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017-2020 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -178,6 +179,7 @@
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
/* Dedicated flash area for PS */
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of PS_SECTOR_SIZE per block */
#define PS_SECTORS_PER_BLOCK (0x1)
@@ -202,6 +204,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
/* Dedicated flash area for ITS */
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* Number of ITS_SECTOR_SIZE per block */
#define ITS_SECTORS_PER_BLOCK (0x1)
diff --git a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout.h b/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout.h
index e0d0e1c..3339731 100644
--- a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout.h
+++ b/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -171,6 +172,7 @@
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
#define PS_SECTORS_PER_BLOCK (0x1)
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
/* The sectors must be in consecutive memory location */
#define PS_NBR_OF_SECTORS (FLASH_PS_AREA_SIZE / PS_SECTOR_SIZE)
@@ -185,6 +187,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* The sectors must be in consecutive memory location */
diff --git a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout.h b/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout.h
index fe33fc9..4826bd2 100644
--- a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout.h
+++ b/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018 Arm Limited. All rights reserved.
+ * Copyright (c) 2020 Cypress Semiconductor Corporation. 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.
@@ -175,6 +176,7 @@
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
#define PS_SECTORS_PER_BLOCK (0x1)
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
+#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
/* The sectors must be in consecutive memory location */
#define PS_NBR_OF_SECTORS (FLASH_PS_AREA_SIZE / PS_SECTOR_SIZE)
@@ -190,6 +192,7 @@
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
+#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
/* The sectors must be in consecutive memory location */
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx.cmake b/platform/ext/target/stm/stm32l5xx/stm32l5xx.cmake
index 4e7449c..d8d6914 100644
--- a/platform/ext/target/stm/stm32l5xx/stm32l5xx.cmake
+++ b/platform/ext/target/stm/stm32l5xx/stm32l5xx.cmake
@@ -1,4 +1,5 @@
# Copyright (c) 2018, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -78,6 +79,8 @@
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/secure/system_stm32l5xx.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/template/tfm_initial_attestation_key_material.c")
list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/secure/tfm_platform_system.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver" ABSOLUTE)
endif()
diff --git a/platform/include/tfm_hal_its.h b/platform/include/tfm_hal_its.h
new file mode 100644
index 0000000..843eb71
--- /dev/null
+++ b/platform/include/tfm_hal_its.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_HAL_ITS_H__
+#define __TFM_HAL_ITS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Retrieve the filesystem config for ITS.
+ *
+ * Note that this function should ensure that the values returned do
+ * not result in a security compromise.
+ *
+ * \param [out] flash_area_addr Location of the block of flash to use for ITS
+ * \param [out] flash_area_size Number of bytes of flash to use for ITS
+ *
+ * \return void
+ * If an error is detected within this function, is should leave the
+ * content of the parameters unchanged.
+ */
+void tfm_hal_its_fs_info(uint32_t *flash_area_addr, uint32_t *flash_area_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_HAL_ITS_H__ */
diff --git a/platform/include/tfm_hal_ps.h b/platform/include/tfm_hal_ps.h
new file mode 100644
index 0000000..e372883
--- /dev/null
+++ b/platform/include/tfm_hal_ps.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_HAL_PS_H__
+#define __TFM_HAL_PS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Retrieve the filesystem config for PS.
+ *
+ * Note that this function should ensure that the values returned do
+ * not result in a security compromise.
+ *
+ * \param [out] flash_area_addr Location of the block of flash to use for PS
+ * \param [out] flash_area_size Number of bytes of flash to use for PS
+ *
+ * \return void
+ * If an error is detected within this function, is should leave the
+ * content of the parameters unchanged.
+ */
+void tfm_hal_ps_fs_info(uint32_t *flash_area_addr, uint32_t *flash_area_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_HAL_PS_H__ */