Skip to content

Commit 21f81cc

Browse files
Evgeni Bolotin0xc0170
authored andcommitted
make protected secure flash region configurable and change secure and non secure default region sizes
1 parent a197ebc commit 21f81cc

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT_M0_PSA/cyprotection_config.h

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,35 @@ CY_PROT_PCMASK3 + CY_PROT_PCMASK4)
4242

4343
#define ALL_SUBREGIONS (0x0)
4444

45+
46+
/* protected rom region size */
47+
48+
#if PSA_SECURE_ROM_SIZE == 0x20000
49+
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_128KB /* 0x20000 */
50+
#elif PSA_SECURE_ROM_SIZE == 0x40000
51+
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_256KB /* 0x40000 */
52+
#elif PSA_SECURE_ROM_SIZE == 0x80000
53+
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_512KB /* 0x80000 */
54+
#else
55+
#error unsupported protected rom region size - not aligned or out of range
56+
#endif
57+
58+
59+
/* protected ram region size */
60+
61+
#if PSA_SECURE_RAM_SIZE == 0x10000
62+
#define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_64KB /* 0x10000 */
63+
#elif PSA_SECURE_RAM_SIZE == 0x20000
64+
#define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_128KB /* 0x20000 */
65+
#else
66+
#error unsupported protected ram region size - not aligned or out of range
67+
#endif
68+
69+
4570
const cy_smpu_region_config_t flash_spm_smpu_config[] = {
4671
{ /* FLASH_PC1_SPM */
4772
.address = (uint32_t *)PSA_SECURE_ROM_START, /* 0x10000000 */
48-
.regionSize = CY_PROT_SIZE_512KB, /* 0x80000 */
73+
.regionSize = CY_PROT_ROM_REGION_SIZE,
4974
.subregions = ALL_SUBREGIONS,
5075
.userPermission = CY_PROT_PERM_RWX,
5176
.privPermission = CY_PROT_PERM_RWX,
@@ -62,7 +87,7 @@ const cy_smpu_region_config_t flash_spm_smpu_config[] = {
6287
const cy_smpu_region_config_t sram_spm_smpu_config[] = {
6388
{ /* SRAM_SPM_PRIV - must include SRAM_SPM_PUB area */
6489
.address = (uint32_t *)PSA_SECURE_RAM_START, /* 0x08020000 */
65-
.regionSize = CY_PROT_SIZE_64KB, /* 0x10000 */
90+
.regionSize = CY_PROT_RAM_REGION_SIZE,
6691
.subregions = ALL_SUBREGIONS, /* 0xC0, /*Size 0xC000 ALL_SUBREGIONS,*/
6792
.userPermission = CY_PROT_PERM_DISABLED,
6893
.privPermission = CY_PROT_PERM_RWX,

targets/targets.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8049,9 +8049,9 @@
80498049
"delivery_dir": "TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT_PSA/prebuilt",
80508050
"overrides": {
80518051
"secure-rom-start": "0x10000000",
8052-
"secure-rom-size": "0x80000",
8053-
"non-secure-rom-start": "0x10080000",
8054-
"non-secure-rom-size": "0x78000",
8052+
"secure-rom-size": "0x40000",
8053+
"non-secure-rom-start": "0x10040000",
8054+
"non-secure-rom-size": "0xB8000",
80558055
"secure-ram-start": "0x08000000",
80568056
"secure-ram-size": "0x10000",
80578057
"non-secure-ram-start": "0x08010000",
@@ -8071,9 +8071,9 @@
80718071
"hex_filename": "psa_release_1.0.hex",
80728072
"overrides": {
80738073
"secure-rom-start": "0x10000000",
8074-
"secure-rom-size": "0x80000",
8075-
"non-secure-rom-start": "0x10080000",
8076-
"non-secure-rom-size": "0x78000",
8074+
"secure-rom-size": "0x40000",
8075+
"non-secure-rom-start": "0x10040000",
8076+
"non-secure-rom-size": "0xB8000",
80778077
"secure-ram-start": "0x08000000",
80788078
"secure-ram-size": "0x10000",
80798079
"non-secure-ram-start": "0x08010000",

0 commit comments

Comments
 (0)