mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #1 from orenc17/flash_protected_region_config
Finish memory protection and add static assertpull/10034/head
commit
b3f59da23c
|
@ -25,6 +25,7 @@
|
||||||
#define _CYPROTECTION_CONFIG_H_
|
#define _CYPROTECTION_CONFIG_H_
|
||||||
|
|
||||||
#include "cyprotection.h"
|
#include "cyprotection.h"
|
||||||
|
#include "mbed_assert.h"
|
||||||
|
|
||||||
/* Add to M0_PSA target in targets.json:
|
/* Add to M0_PSA target in targets.json:
|
||||||
* - INITIAL_ROT_PROTECTION_AVAILABLE - to disable pc0 related protections
|
* - INITIAL_ROT_PROTECTION_AVAILABLE - to disable pc0 related protections
|
||||||
|
@ -45,12 +46,16 @@ CY_PROT_PCMASK3 + CY_PROT_PCMASK4)
|
||||||
|
|
||||||
/* protected rom region size */
|
/* protected rom region size */
|
||||||
|
|
||||||
#if PSA_SECURE_ROM_SIZE == 0x20000
|
#if PSA_SECURE_ROM_SIZE == 0x10000
|
||||||
|
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_64KB /* 0x10000 */
|
||||||
|
#elif PSA_SECURE_ROM_SIZE == 0x20000
|
||||||
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_128KB /* 0x20000 */
|
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_128KB /* 0x20000 */
|
||||||
#elif PSA_SECURE_ROM_SIZE == 0x40000
|
#elif PSA_SECURE_ROM_SIZE == 0x40000
|
||||||
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_256KB /* 0x40000 */
|
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_256KB /* 0x40000 */
|
||||||
#elif PSA_SECURE_ROM_SIZE == 0x80000
|
#elif PSA_SECURE_ROM_SIZE == 0x80000
|
||||||
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_512KB /* 0x80000 */
|
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_512KB /* 0x80000 */
|
||||||
|
#elif PSA_SECURE_ROM_SIZE == 0x100000
|
||||||
|
#define CY_PROT_ROM_REGION_SIZE CY_PROT_SIZE_1MB /* 0x100000 */
|
||||||
#else
|
#else
|
||||||
#error unsupported protected rom region size - not aligned or out of range
|
#error unsupported protected rom region size - not aligned or out of range
|
||||||
#endif
|
#endif
|
||||||
|
@ -58,14 +63,21 @@ CY_PROT_PCMASK3 + CY_PROT_PCMASK4)
|
||||||
|
|
||||||
/* protected ram region size */
|
/* protected ram region size */
|
||||||
|
|
||||||
#if PSA_SECURE_RAM_SIZE == 0x10000
|
#if PSA_SECURE_RAM_SIZE == 0x8000
|
||||||
|
#define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_32KB /* 0x8000 */
|
||||||
|
#elif PSA_SECURE_RAM_SIZE == 0x10000
|
||||||
#define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_64KB /* 0x10000 */
|
#define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_64KB /* 0x10000 */
|
||||||
#elif PSA_SECURE_RAM_SIZE == 0x20000
|
#elif PSA_SECURE_RAM_SIZE == 0x20000
|
||||||
#define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_128KB /* 0x20000 */
|
#define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_128KB /* 0x20000 */
|
||||||
|
#elif PSA_SECURE_RAM_SIZE == 0x40000
|
||||||
|
#define CY_PROT_RAM_REGION_SIZE CY_PROT_SIZE_256KB /* 0x40000 */
|
||||||
#else
|
#else
|
||||||
#error unsupported protected ram region size - not aligned or out of range
|
#error unsupported protected ram region size - not aligned or out of range
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MBED_STATIC_ASSERT((PSA_SECURE_ROM_START % PSA_SECURE_ROM_SIZE) == 0, "PSA_SECURE_ROM_START is not alligned with PSA_SECURE_ROM_SIZE");
|
||||||
|
MBED_STATIC_ASSERT((PSA_SECURE_RAM_START % PSA_SECURE_RAM_SIZE) == 0, "PSA_SECURE_RAM_START is not alligned with PSA_SECURE_RAM_SIZE");
|
||||||
|
|
||||||
|
|
||||||
const cy_smpu_region_config_t flash_spm_smpu_config[] = {
|
const cy_smpu_region_config_t flash_spm_smpu_config[] = {
|
||||||
{ /* FLASH_PC1_SPM */
|
{ /* FLASH_PC1_SPM */
|
||||||
|
|
Loading…
Reference in New Issue