1 /* 2 * Copyright 2023 NXP 3 * 4 * Based on soc/soc_legacy/arm/nxp_kinetis/ke1xf/nxp_mpu_regions.c, which is: 5 * Copyright (c) 2017 Linaro Limited. 6 * 7 * SPDX-License-Identifier: Apache-2.0 8 */ 9 10 #include <soc.h> 11 #include <zephyr/arch/arm/mpu/nxp_mpu.h> 12 13 static const struct nxp_mpu_region mpu_regions[] = { 14 /* Region 0 */ 15 MPU_REGION_ENTRY("DEBUGGER", 16 0, 17 0xFFFFFFFF, 18 REGION_DEBUGGER_AND_DEVICE_ATTR), 19 20 /* Region 1 */ 21 MPU_REGION_ENTRY("BACKGROUND_0", 22 0, 23 CONFIG_SRAM_BASE_ADDRESS-1, 24 REGION_BACKGROUND_ATTR), 25 /* Region 2 */ 26 MPU_REGION_ENTRY("BACKGROUND_1", 27 CONFIG_SRAM_BASE_ADDRESS + 28 (CONFIG_SRAM_SIZE * 1024), 29 0xFFFFFFFF, 30 REGION_BACKGROUND_ATTR), 31 32 #if defined(CONFIG_XIP) 33 /* Region 3 */ 34 MPU_REGION_ENTRY("SRAM", 35 CONFIG_SRAM_BASE_ADDRESS, 36 (CONFIG_SRAM_BASE_ADDRESS + 37 (CONFIG_SRAM_SIZE * 1024) - 1), 38 REGION_RAM_ATTR), 39 40 /* Region 4 */ 41 MPU_REGION_ENTRY("FLASH", 42 CONFIG_FLASH_BASE_ADDRESS, 43 (CONFIG_FLASH_BASE_ADDRESS + 44 (CONFIG_FLASH_SIZE * 1024) - 1), 45 REGION_FLASH_ATTR), 46 #else 47 /* Region 3 */ 48 MPU_REGION_ENTRY("SRAM", 49 CONFIG_SRAM_BASE_ADDRESS, 50 (CONFIG_SRAM_BASE_ADDRESS + 51 (CONFIG_SRAM_SIZE * 1024) - 1), 52 REGION_FLASH_ATTR), 53 #endif 54 }; 55 56 const struct nxp_mpu_config mpu_config = { 57 .num_regions = ARRAY_SIZE(mpu_regions), 58 .mpu_regions = mpu_regions, 59 .sram_region = 3, 60 }; 61