aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Brand <chris.brand@cypress.com>2020-08-18 12:15:07 -0700
committerDavid Hu <david.hu@arm.com>2020-10-28 02:20:45 +0000
commitbad1135ccb257c1fb2781ad2e5ea6817345e09fd (patch)
treecebc8f0baa507f4e1eef2080d3bcbce46b88caaf
parent600a463bb79c5e3c10da3cfaaae6935422956583 (diff)
downloadtrusted-firmware-m-bad1135ccb257c1fb2781ad2e5ea6817345e09fd.tar.gz
PSoC64: Clean up region_defs.h
Rather than multiple blocks conditioned on BL2 (all of which error out if BL2 is defined), just test BL2 once at the top and make the code all unconditional. Also rename BL2_HEADER_SIZE and BL2_TRAILER_SIZE and remove unused BL2_MSP_STACK_SIZE and BL2_HEAP_SIZE. Change-Id: I8ff8660f6a917ffa7fd9cff824a534842253479a Signed-off-by: Chris Brand <chris.brand@cypress.com>
-rw-r--r--platform/ext/target/cypress/psoc64/partition/region_defs.h32
-rw-r--r--platform/ext/target/cypress/psoc64/target_cfg.c2
2 files changed, 11 insertions, 23 deletions
diff --git a/platform/ext/target/cypress/psoc64/partition/region_defs.h b/platform/ext/target/cypress/psoc64/partition/region_defs.h
index edfb26ec91..7b4d57eaeb 100644
--- a/platform/ext/target/cypress/psoc64/partition/region_defs.h
+++ b/platform/ext/target/cypress/psoc64/partition/region_defs.h
@@ -20,6 +20,10 @@
#include "flash_layout.h"
+#ifdef BL2
+#error "BL2 configuration is not supported"
+#endif /* BL2 */
+
#define TOTAL_ROM_SIZE FLASH_TOTAL_SIZE
/* 2KB of RAM (at the end of the SRAM) are reserved for system use. Using
* this memory region for other purposes will lead to unexpected behavior.
@@ -29,9 +33,6 @@
system allocation */
#define TOTAL_RAM_SIZE (0x000E8000) /* CY_SRAM_SIZE - 96KB */
-#define BL2_HEAP_SIZE 0x0001000
-#define BL2_MSP_STACK_SIZE 0x0001000
-
#define S_HEAP_SIZE 0x0001000
#define S_MSP_STACK_SIZE_INIT 0x0000400
#define S_MSP_STACK_SIZE 0x0000800
@@ -54,12 +55,8 @@
* of partitions is defined in accordance with this constraint.
*/
-#ifdef BL2
-#error "BL2 configuration is not supported"
-#else
#define S_IMAGE_PRIMARY_PARTITION_OFFSET SECURE_IMAGE_OFFSET
#define NS_IMAGE_PRIMARY_PARTITION_OFFSET NON_SECURE_IMAGE_OFFSET
-#endif /* BL2 */
/* TFM PSoC6 CY8CKIT_064 RAM layout:
*
@@ -86,22 +83,17 @@
* because we reserve space for the image header and trailer introduced by the
* bootloader.
*/
-#ifdef BL2
-#error "BL2 configuration is not supported"
-#else
/* Even though TFM BL2 is excluded from the build,
* CY BL built externally is used and it needs offsets for header and trailer
* to be taken in account.
* */
-#define BL2_HEADER_SIZE (0x400)
-#define BL2_TRAILER_SIZE (0x400)
-
-#endif /* BL2 */
+#define CYBL_HEADER_SIZE (0x400)
+#define CYBL_TRAILER_SIZE (0x400)
#define IMAGE_S_CODE_SIZE \
- (FLASH_S_PARTITION_SIZE - BL2_HEADER_SIZE - BL2_TRAILER_SIZE)
+ (FLASH_S_PARTITION_SIZE - CYBL_HEADER_SIZE - CYBL_TRAILER_SIZE)
#define IMAGE_NS_CODE_SIZE \
- (FLASH_NS_PARTITION_SIZE - BL2_HEADER_SIZE - BL2_TRAILER_SIZE)
+ (FLASH_NS_PARTITION_SIZE - CYBL_HEADER_SIZE - CYBL_TRAILER_SIZE)
/* Alias definitions for secure and non-secure areas*/
#define S_ROM_ALIAS(x) (S_ROM_ALIAS_BASE + (x))
@@ -112,7 +104,7 @@
/* Secure regions */
#define S_IMAGE_PRIMARY_AREA_OFFSET \
- (S_IMAGE_PRIMARY_PARTITION_OFFSET + BL2_HEADER_SIZE)
+ (S_IMAGE_PRIMARY_PARTITION_OFFSET + CYBL_HEADER_SIZE)
#define S_CODE_START (S_ROM_ALIAS(S_IMAGE_PRIMARY_AREA_OFFSET))
#define S_CODE_SIZE IMAGE_S_CODE_SIZE
#define S_CODE_LIMIT (S_CODE_START + S_CODE_SIZE - 1)
@@ -152,7 +144,7 @@
/* Non-secure regions */
#define NS_IMAGE_PRIMARY_AREA_OFFSET \
- (NS_IMAGE_PRIMARY_PARTITION_OFFSET + BL2_HEADER_SIZE)
+ (NS_IMAGE_PRIMARY_PARTITION_OFFSET + CYBL_HEADER_SIZE)
#define NS_CODE_START (NS_ROM_ALIAS(NS_IMAGE_PRIMARY_AREA_OFFSET))
#define NS_CODE_SIZE IMAGE_NS_CODE_SIZE
#define NS_CODE_LIMIT (NS_CODE_START + NS_CODE_SIZE - 1)
@@ -180,10 +172,6 @@
#define NS_PARTITION_SIZE (FLASH_NS_PARTITION_SIZE)
-#ifdef BL2
-#error "BL2 configuration is not supported"
-#endif /* BL2 */
-
/* Shared data area between bootloader and runtime firmware.
* Shared data area is allocated at the beginning of the privileged data area,
* it is overlapping with TF-M Secure code's MSP stack
diff --git a/platform/ext/target/cypress/psoc64/target_cfg.c b/platform/ext/target/cypress/psoc64/target_cfg.c
index 58fc8a6652..3baf35a6c6 100644
--- a/platform/ext/target/cypress/psoc64/target_cfg.c
+++ b/platform/ext/target/cypress/psoc64/target_cfg.c
@@ -42,7 +42,7 @@ REGION_DECLARE(Load$$LR$$, LR_SECONDARY_PARTITION, $$Base);
const struct memory_region_limits memory_regions = {
.non_secure_code_start =
(uint32_t)&REGION_NAME(Load$$LR$$, LR_NS_PARTITION, $$Base) +
- BL2_HEADER_SIZE,
+ CYBL_HEADER_SIZE,
.non_secure_partition_base =
(uint32_t)&REGION_NAME(Load$$LR$$, LR_NS_PARTITION, $$Base),