1 /* 2 * Copyright 2022 NXP 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/linker/linker-defs.h> 8 #include <zephyr/arch/arm/mpu/arm_mpu.h> 9 10 #define DEVICE_REGION_START 0x40000000UL 11 #define DEVICE_REGION_END 0x76FFFFFFUL 12 13 static const struct arm_mpu_region mpu_regions[] = { 14 MPU_REGION_ENTRY("SRAM_TEXT", 15 (uintptr_t)__rom_region_start, 16 REGION_RAM_TEXT_ATTR((uintptr_t)__rodata_region_start)), 17 18 MPU_REGION_ENTRY("SRAM_RODATA", 19 (uintptr_t)__rodata_region_start, 20 #ifdef CONFIG_XIP 21 REGION_RAM_RO_ATTR(CONFIG_FLASH_BASE_ADDRESS + KB(CONFIG_FLASH_SIZE)) 22 #else 23 REGION_RAM_RO_ATTR((uintptr_t)__rodata_region_end) 24 #endif 25 ), 26 27 MPU_REGION_ENTRY("SRAM_DATA", 28 #ifdef CONFIG_XIP 29 (uintptr_t)_image_ram_start, 30 #else 31 (uintptr_t)__rom_region_end, 32 #endif 33 REGION_RAM_ATTR((uintptr_t)__kernel_ram_end)), 34 35 MPU_REGION_ENTRY("DEVICE", 36 DEVICE_REGION_START, 37 REGION_DEVICE_ATTR(DEVICE_REGION_END)), 38 }; 39 40 const struct arm_mpu_config mpu_config = { 41 .num_regions = ARRAY_SIZE(mpu_regions), 42 .mpu_regions = mpu_regions, 43 }; 44