-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Cortex-M: vector table relocation is incorrect with XIP=n #31235
Comments
Will take a look |
Looks like the case with CPU_HAS_VTOR=y and XIP=n has not been changed, since it was originally introduced long time ago, in #5988 I wonder why this had never been a problem until now. EDIT: it actually goes further back to https://github.com/tagunil/zephyr-for-patches/commit/6782c3ea236b737389dd6df1d361dfdfd6d910a2 EDIT: dates back to https://github.com/tagunil/zephyr-for-patches/commit/4465cf47e9cdccd7772b8a1e16a2b10ceba989ab |
@GrixaYrev is there some specific in-tree sample or test you want to run with XIP=n |
@GrixaYrev #31872 , please, see if this simple fix makes sense. |
@ioannisg is not, I use my custom project. In additional VTOR it is need to set custom MPU regions, because SRAM is not executable by default in |
OK, fine but this is another issue - not part of the ticket here. I wanted to check with you whether #31872 is in the right direction, in your opinion. |
@ioannisg, I have tested |
Describe the bug
In first, everything bellow is actual for case CONFIG_CPU_CORTEX_M_HAS_VTOR=y.
CortexM vector table relocate to SRAM start when CONFIG_XIP is not defined (see
arch\arm\core\aarch32\prep_c.c:50
).But vector table can be placed with some offset, for example in i.MX RT.
So it is not possible to use non XIP application with i.MX RT boot header.
To Reproduce
Expected behavior
Definition
VECTOR_ADDRESS
is set to_vector_start
inarch\arm\core\aarch32\prep_c.c:48
if CONFIG_XIP=y.But
_vector_start
is declared inarch\arm\core\aarch32\vector_table.ld
, which in turn is added to linker script inCMakeLists.txt
unconditional.So it is possible to set
VECTOR_ADDRESS
equal_vector_start
unconditionally also (if CONFIG_CPU_CORTEX_M_HAS_VTOR=y, of course).Impact
Showstopper
Environment:
Additional context
It is not possible to set CONFIG_XIP=y and CONFIG_FLASH_BASE_ADDRESS=CONFIG_SRAM_BASE_ADDRESS, because .text and .bss sections will be overlapped. So CONFIG_XIP=n is required.
The text was updated successfully, but these errors were encountered: