arch: arm: fix mem domain sample/test for ARMv8-M access permissions

This commit updates the mem_domain_apis_test sample and the
mem_protect test, so they can compile and execute in ARMv8-M
platforms, which do not support the P_RW_U_RO access permissions
combination (privileged read/write, unprivileged read-only). The
modification consists of, simply, selecting a different access
permission (P_RO_U_RO) when building for ARMv8-M MPUs with the
unmodified ARM MPU architecture.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2018-10-08 20:12:40 +02:00 committed by Kumar Gala
commit 52b729a6a4
2 changed files with 12 additions and 3 deletions

View file

@ -36,7 +36,10 @@ u8_t __aligned(4096) app1_buf[4096];
K_MEM_PARTITION_DEFINE(app0_parts0, app0_buf, sizeof(app0_buf),
K_MEM_PARTITION_P_RW_U_RW);
#ifdef CONFIG_X86
#if defined(CONFIG_X86) || \
((defined(CONFIG_ARMV8_M_BASELINE) || \
defined(CONFIG_ARMV8_M_MAINLINE)) \
&& defined(CONFIG_CPU_HAS_ARM_MPU))
K_MEM_PARTITION_DEFINE(app0_parts1, app1_buf, sizeof(app1_buf),
K_MEM_PARTITION_P_RO_U_RO);
#else
@ -51,7 +54,10 @@ struct k_mem_partition *app0_parts[] = {
K_MEM_PARTITION_DEFINE(app1_parts0, app1_buf, sizeof(app1_buf),
K_MEM_PARTITION_P_RW_U_RW);
#ifdef CONFIG_X86
#if defined(CONFIG_X86) || \
((defined(CONFIG_ARMV8_M_BASELINE) || \
defined(CONFIG_ARMV8_M_MAINLINE)) \
&& defined(CONFIG_CPU_HAS_ARM_MPU))
K_MEM_PARTITION_DEFINE(app1_parts1, app0_buf, sizeof(app0_buf),
K_MEM_PARTITION_P_RO_U_RO);
#else

View file

@ -35,7 +35,10 @@ K_MEM_PARTITION_DEFINE(mem_domain_memory_partition,
sizeof(mem_domain_buf),
K_MEM_PARTITION_P_RW_U_RW);
#ifdef CONFIG_X86
#if defined(CONFIG_X86) || \
((defined(CONFIG_ARMV8_M_BASELINE) || \
defined(CONFIG_ARMV8_M_MAINLINE)) \
&& defined(CONFIG_CPU_HAS_ARM_MPU))
K_MEM_PARTITION_DEFINE(mem_domain_memory_partition1,
mem_domain_buf1,
sizeof(mem_domain_buf1),