1 /* 2 * Copyright (c) 2021-2023 Arm Limited (or its affiliates). All rights reserved. 3 * SPDX-License-Identifier: Apache-2.0 4 */ 5 6 #include <stdint.h> 7 8 #include <zephyr/arch/arm64/cortex_r/arm_mpu.h> 9 #include <zephyr/linker/linker-defs.h> 10 #include <zephyr/sys/util.h> 11 12 static const struct arm_mpu_region mpu_regions[] = { 13 /* Region 0 */ 14 MPU_REGION_ENTRY("FLASH_0", 15 CONFIG_FLASH_BASE_ADDRESS, 16 CONFIG_FLASH_BASE_ADDRESS + 17 KB(CONFIG_FLASH_SIZE), 18 REGION_FLASH_ATTR), 19 20 /* Region 1 zephyr text */ 21 MPU_REGION_ENTRY("SRAM_0", 22 (uintptr_t)__text_region_start, 23 (uintptr_t)__text_region_end, 24 REGION_RAM_TEXT_ATTR), 25 26 /* Region 2 zephyr rodata */ 27 MPU_REGION_ENTRY("SRAM_1", 28 (uintptr_t)__rodata_region_start, 29 (uintptr_t)__rodata_region_end, 30 REGION_RAM_RO_ATTR), 31 32 /* Region 3 zephyr data */ 33 MPU_REGION_ENTRY("SRAM_2", 34 #ifdef CONFIG_USERSPACE 35 (uintptr_t)_app_smem_start, 36 #else 37 (uintptr_t)__kernel_ram_start, 38 #endif 39 (uintptr_t)__kernel_ram_end, 40 REGION_RAM_ATTR), 41 }; 42 43 const struct arm_mpu_config mpu_config = { 44 .num_regions = ARRAY_SIZE(mpu_regions), 45 .mpu_regions = mpu_regions, 46 }; 47