Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom mpu regions for imxrt #70920

Open
GrixaYrev opened this issue Mar 30, 2024 · 5 comments · May be fixed by #75604
Open

custom mpu regions for imxrt #70920

GrixaYrev opened this issue Mar 30, 2024 · 5 comments · May be fixed by #75604
Assignees
Labels
area: Memory Protection Enhancement Changes/Updates/Additions to existing features platform: NXP NXP

Comments

@GrixaYrev
Copy link
Contributor

File zephyr\soc\nxp\imxrt\mpu_regions.c is included to sources unconditionally. So i can't use SRAM size more than 16M and less than 32M, because error in zephyr\include\zephyr\arch\arm\cortex_m\arm_mpu_mem_cfg.h:72 is rised: "Unsupported sram size configuration".

I think additional Kconfig option need for exclude zephyr\soc\nxp\imxrt\mpu_regions.c from sources.

I use custom board based on iMX.RT1052 with external SDRAM. Part SDRAM used as FLASH (for bootloader and application), other space as RAM.

Version of Zephyr – 3.6.99 (SHA 0714052)

prj.conf:

CONFIG_FLASH_SIZE=11264 
CONFIG_FLASH_BASE_ADDRESS=0x80100000
CONFIG_SRAM_SIZE=20480
CONFIG_SRAM_BASE_ADDRESS=0x80C00000
@GrixaYrev GrixaYrev added the Enhancement Changes/Updates/Additions to existing features label Mar 30, 2024
@GrixaYrev
Copy link
Contributor Author

I suggest to add configuration option NXP_IMX_RT_USER_MPU_REGIONS to zephyr\soc\nxp\imxrt\Kconfig.
I can prepare PR.

@GrixaYrev
Copy link
Contributor Author

@teburd, @dleach02, what do you think about my suggestion?

GrixaYrev added a commit to GrixaYrev/zephyr that referenced this issue May 17, 2024
Option NXP_IMX_RT_USER_MPU_REGIONS exclude soc file mpu_regions.c
and allow user define custom mpu_regions in custom file.
Fixes zephyrproject-rtos#70920

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
@dleach02
Copy link
Member

@GrixaYrev, isn't the board level device tree entry for SDRAM with CONFIG_NXP_IMX_EXTERNAL_SDRAM supposed to handle this?

GrixaYrev added a commit to GrixaYrev/zephyr that referenced this issue May 20, 2024
Option NXP_IMX_RT_USER_MPU_REGIONS exclude soc file mpu_regions.c
and allow user define custom mpu_regions in custom file.
Fixes zephyrproject-rtos#70920

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
@GrixaYrev
Copy link
Contributor Author

GrixaYrev commented Jul 7, 2024

@dleach02, no, first two items of mpu_regions[] is included unconditional (file zephyr\soc\nxp\imxrt\mpu_regions.c):

	/* Region 0 */
	MPU_REGION_ENTRY("FLASH_0",
			 CONFIG_FLASH_BASE_ADDRESS,
			 REGION_FLASH_ATTR(REGION_FLASH_SIZE)),
	/* Region 1 */
	MPU_REGION_ENTRY("SRAM_0",
			 CONFIG_SRAM_BASE_ADDRESS,
			 REGION_RAM_ATTR(REGION_SRAM_SIZE)),

If i set CONFIG_FLASH_SIZE=11264 and CONFIG_SRAM_SIZE=20480 i have error message "Unsupported sram size configuration".

@dleach02
Copy link
Member

dleach02 commented Jul 7, 2024

Please prepare a PR so I can route it appropriately for internal review.

GrixaYrev added a commit to GrixaYrev/zephyr that referenced this issue Jul 7, 2024
Option NXP_IMX_RT_USER_MPU_REGIONS exclude soc file mpu_regions.c
and allow user define custom mpu_regions in custom file.
Fixes zephyrproject-rtos#70920

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
GrixaYrev added a commit to GrixaYrev/zephyr that referenced this issue Jul 7, 2024
Option NXP_IMX_RT_USER_MPU_REGIONS exclude soc file mpu_regions.c
and allow user define custom mpu_regions in custom file.
Fixes zephyrproject-rtos#70920

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
GrixaYrev added a commit to GrixaYrev/zephyr that referenced this issue Jul 8, 2024
Option NXP_IMX_RT_USER_MPU_REGIONS exclude soc file mpu_regions.c
and allow user define custom mpu_regions in custom file.
Fixes zephyrproject-rtos#70920

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
GrixaYrev added a commit to GrixaYrev/zephyr that referenced this issue Jul 8, 2024
Option NXP_IMX_RT_USER_MPU_REGIONS exclude soc file mpu_regions.c
and allow user define custom mpu_regions in custom file.
Fixes zephyrproject-rtos#70920

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
@GrixaYrev GrixaYrev linked a pull request Jul 8, 2024 that will close this issue
GrixaYrev added a commit to GrixaYrev/zephyr that referenced this issue Jul 8, 2024
Option NXP_IMX_RT_USER_MPU_REGIONS exclude soc file mpu_regions.c
and allow user define custom mpu_regions in custom file.
Fixes zephyrproject-rtos#70920

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Memory Protection Enhancement Changes/Updates/Additions to existing features platform: NXP NXP
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants