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/docs/reference/services/tfm_its_integration_guide.rst b/docs/reference/services/tfm_its_integration_guide.rst
index 230117e..7c0ca5b 100644
--- a/docs/reference/services/tfm_its_integration_guide.rst
+++ b/docs/reference/services/tfm_its_integration_guide.rst
@@ -197,10 +197,6 @@
 ============================================
 The ITS service requires the following platform definitions:
 
-- ``ITS_FLASH_AREA_ADDR`` - Defines the flash address where the internal trusted
-  storage area starts.
-- ``ITS_FLASH_AREA_SIZE`` - Defines the size of the dedicated flash area for
-  internal trusted storage in bytes.
 - ``ITS_SECTOR_SIZE`` - Defines the size of the flash sectors (the smallest
   erasable unit) in bytes.
 - ``ITS_SECTORS_PER_BLOCK`` - Defines the number of contiguous ITS_SECTOR_SIZE
@@ -234,6 +230,12 @@
 The following optional platform definitions may also be defined in
 ``flash_layout.h`` or set at build time in ``platform/ext/<TARGET_NAME>.cmake``:
 
+- ``ITS_FLASH_AREA_ADDR`` - Defines the flash address where the internal trusted
+  storage area starts.
+  If not defined, the platform must implement ``tfm_hal_its_fs_info()``.
+- ``ITS_FLASH_AREA_SIZE`` - Defines the size of the dedicated flash area for
+  internal trusted storage in bytes.
+  If not defined, the platform must implement ``tfm_hal_its_fs_info()``.
 - ``ITS_BUF_SIZE``- Defines the size of the partition's internal data transfer
   buffer. If not provided, then ``ITS_MAX_ASSET_SIZE`` is used to allow asset
   data to be copied between the client and the filesystem in one iteration.
@@ -282,6 +284,8 @@
   service. This flag is ``OFF`` by default. The ITS regression tests write/erase
   storage multiple time, so enabling this flag can increase the life of flash
   memory when testing.
+  If this flag is set to ``ON``, ITS_RAM_FS_SIZE must also be provided. This
+  specifies the size of the block of RAM to be used to simulate the flash.
 
   .. Note::
     If this flag is disabled when running the regression tests, then it is