1
1
/* mbed Microcontroller Library
2
- *
2
+ *
3
3
* \copyright
4
4
5
5
* (c) 2018, Cypress Semiconductor Corporation
25
25
#define _CYPROTECTION_CONFIG_H_
26
26
27
27
#include "cyprotection.h"
28
+ #include "mbed_assert.h"
28
29
29
30
/* Add to M0_PSA target in targets.json:
30
31
* - INITIAL_ROT_PROTECTION_AVAILABLE - to disable pc0 related protections
@@ -45,32 +46,43 @@ CY_PROT_PCMASK3 + CY_PROT_PCMASK4)
45
46
46
47
/* protected rom region size */
47
48
48
- #if PSA_SECURE_ROM_SIZE == 0x20000
49
+ #if PSA_SECURE_ROM_SIZE == 0x10000
50
+ #define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_64KB /* 0x10000 */
51
+ #elif PSA_SECURE_ROM_SIZE == 0x20000
49
52
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_128KB /* 0x20000 */
50
53
#elif PSA_SECURE_ROM_SIZE == 0x40000
51
54
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_256KB /* 0x40000 */
52
55
#elif PSA_SECURE_ROM_SIZE == 0x80000
53
56
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_512KB /* 0x80000 */
57
+ #elif PSA_SECURE_ROM_SIZE == 0x100000
58
+ #define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_1MB /* 0x100000 */
54
59
#else
55
60
#error unsupported protected rom region size - not aligned or out of range
56
61
#endif
57
62
58
63
59
64
/* protected ram region size */
60
65
61
- #if PSA_SECURE_RAM_SIZE == 0x10000
66
+ #if PSA_SECURE_RAM_SIZE == 0x8000
67
+ #define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_32KB /* 0x8000 */
68
+ #elif PSA_SECURE_RAM_SIZE == 0x10000
62
69
#define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_64KB /* 0x10000 */
63
70
#elif PSA_SECURE_RAM_SIZE == 0x20000
64
71
#define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_128KB /* 0x20000 */
72
+ #elif PSA_SECURE_RAM_SIZE == 0x40000
73
+ #define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_256KB /* 0x40000 */
65
74
#else
66
75
#error unsupported protected ram region size - not aligned or out of range
67
76
#endif
68
77
78
+ MBED_STATIC_ASSERT ((PSA_SECURE_ROM_START % PSA_SECURE_ROM_SIZE ) == 0 , "PSA_SECURE_ROM_START is not alligned with PSA_SECURE_ROM_SIZE" );
79
+ MBED_STATIC_ASSERT ((PSA_SECURE_RAM_START % PSA_SECURE_RAM_SIZE ) == 0 , "PSA_SECURE_RAM_START is not alligned with PSA_SECURE_RAM_SIZE" );
80
+
69
81
70
82
const cy_smpu_region_config_t flash_spm_smpu_config [] = {
71
83
{ /* FLASH_PC1_SPM */
72
84
.address = (uint32_t * )PSA_SECURE_ROM_START , /* 0x10000000 */
73
- .regionSize = CY_PROT_ROM_REGION_SIZE ,
85
+ .regionSize = CY_PROT_ROM_REGION_SIZE ,
74
86
.subregions = ALL_SUBREGIONS ,
75
87
.userPermission = CY_PROT_PERM_RWX ,
76
88
.privPermission = CY_PROT_PERM_RWX ,
@@ -87,7 +99,7 @@ const cy_smpu_region_config_t flash_spm_smpu_config[] = {
87
99
const cy_smpu_region_config_t sram_spm_smpu_config [] = {
88
100
{ /* SRAM_SPM_PRIV - must include SRAM_SPM_PUB area */
89
101
.address = (uint32_t * )PSA_SECURE_RAM_START , /* 0x08020000 */
90
- .regionSize = CY_PROT_RAM_REGION_SIZE ,
102
+ .regionSize = CY_PROT_RAM_REGION_SIZE ,
91
103
.subregions = ALL_SUBREGIONS , /* 0xC0, /*Size 0xC000 ALL_SUBREGIONS,*/
92
104
.userPermission = CY_PROT_PERM_DISABLED ,
93
105
.privPermission = CY_PROT_PERM_RWX ,
0 commit comments