diff options
author | Yicheng Li <yichengli@chromium.org> | 2020-05-27 11:36:08 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-05-30 05:16:20 +0000 |
commit | 3590a14bcf9a1a575d41464285efe981f21dfdb6 (patch) | |
tree | ff3b47d98c4375315f3c4b54cde2004bc34af88d /core/cortex-m/include/mpu.h | |
parent | 77ae633c41e958ec91193c48ad3fbd6012d6739e (diff) | |
download | chrome-ec-3590a14bcf9a1a575d41464285efe981f21dfdb6.tar.gz |
test: Add on-device test for calculating MPU regions for RW
MPU logic needs to represent RW with no more than 2 MPU regions
when locking RW. Add on-device unit test for this calculation.
BRANCH=none
BUG=b:155410753
TEST=make -j BOARD=bloonchipper
TEST=make -j BOARD=nucleo-f412zg test-mpu
Then flash the test binary to nucleo board
runtest on device ==> Pass
Change-Id: Idc746efa9419d31cdae9c6fccc499c92160ac593
Signed-off-by: Yicheng Li <yichengli@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2218595
Diffstat (limited to 'core/cortex-m/include/mpu.h')
-rw-r--r-- | core/cortex-m/include/mpu.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/cortex-m/include/mpu.h b/core/cortex-m/include/mpu.h index 81aefa6a75..610728b501 100644 --- a/core/cortex-m/include/mpu.h +++ b/core/cortex-m/include/mpu.h @@ -86,6 +86,14 @@ enum mpu_region { #define MPU_ATTR_FLASH_MEMORY 2 /* for flash memory */ #endif +/* Represent RW with at most 2 MPU regions. */ +#define MAX_RW_REGIONS 2 +struct mpu_rw_regions { + int num_regions; + uint32_t addr[MAX_RW_REGIONS]; + uint32_t size[MAX_RW_REGIONS]; +}; + /** * Enable MPU */ |