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)