Skip to content

Conversation

@ibirnbaum
Copy link
Member

Place the 'vectors' region configuration behind the 'sram' and 'rom_region' configurations so that the MPU region for the vectors takes precedence over the 'sram' region due to higher region index = higher priority when resolving memory properties/permissions for overlapping regions. This is required for the vectors to work properly if the SRAM base address is also at 0x0.

Fixes #96688.

Place the 'vectors' region configuration behind the 'sram' and
'rom_region' configurations so that the MPU region for the
vectors takes precedence over the 'sram' region due to higher
region index = higher priority when resolving memory properties
/ permissions for overlapping regions. This is required for the
vectors to work properly if the SRAM base address is also at 0x0.

Fixes zephyrproject-rtos#96688.

Signed-off-by: Immo Birnbaum <[email protected]>
@ibirnbaum ibirnbaum force-pushed the bugfix/zynqmp-vectors branch from 7c5ed7d to 3b51e58 Compare September 28, 2025 19:23
@sonarqubecloud
Copy link

@venodela
Copy link
Contributor

i faced the same issue, i also configured the vectors after 'sram' and 'rom' region when i'm verifying on ZCU102.

Additionally, I noticed that the file soc/xlnx/zynqmp/arm_mpu_regions.c includes
#include <zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h>
whereas for ZynqMP it should instead be
#include <zephyr/arch/arm/cortex_a_r/arm_mpu_mem_cfg.h>

@michalsimek
Copy link
Contributor

i faced the same issue, i also configured the vectors after 'sram' and 'rom' region when i'm verifying on ZCU102.

Additionally, I noticed that the file soc/xlnx/zynqmp/arm_mpu_regions.c includes #include <zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h> whereas for ZynqMP it should instead be #include <zephyr/arch/arm/cortex_a_r/arm_mpu_mem_cfg.h>

Please create the patch on top of this one.

@ibirnbaum
Copy link
Member Author

ibirnbaum commented Oct 3, 2025

i faced the same issue, i also configured the vectors after 'sram' and 'rom' region when i'm verifying on ZCU102.
Additionally, I noticed that the file soc/xlnx/zynqmp/arm_mpu_regions.c includes #include <zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h> whereas for ZynqMP it should instead be #include <zephyr/arch/arm/cortex_a_r/arm_mpu_mem_cfg.h>

Please create the patch on top of this one.

@venodela @michalsimek There's no such file in the cortex_a_r directory. <zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h> is merely a helper file that converts the KCONFIG values specifying the current RAM and FLASH sizes to region size masks. It includes the already Cortex-variant-neutral header file <zephyr/arch/arm/mpu/arm_mpu.h> which eventually resolves to the variant-specific implementation at an even lower level (seems like the main difference between the M-MPU and the R-MPU is memory-based register access vs. CP15-based register access). I'd rather move this to a more generic place like zephyr/arch/arm/mpu if possible instead of placing a 100% identical clone of this header file in the cortex_a_r directory. The current placement is a historical debt of the fact that MPU support was there for Cortex-M first and for Cortex-R later and therefore some MPU related stuff wasn't named in a Cortex-agnostic way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

soc: xlnx: zynqmp: exception vectors MPU entry invalid if SRAM base address is 0x0

4 participants