arch: arm: Create a MPU entry for relocated code

Code relocated using CONFIG_CODE_DATA_RELOCATION_SRAM should
be allowed to execute from SRAM

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This commit is contained in:
Mahesh Mahadevan 2021-04-05 12:57:23 -05:00 committed by Ioannis Glaropoulos
commit 1b36c6c00e

View file

@ -55,6 +55,11 @@ extern K_THREAD_STACK_DEFINE(z_main_stack, CONFIG_MAIN_STACK_SIZE);
uint32_t z_arm_mpu_stack_guard_and_fpu_adjust(struct k_thread *thread);
#endif
#if defined(CONFIG_CODE_DATA_RELOCATION_SRAM)
extern char __sram_text_start[];
extern char __sram_text_size[];
#endif
static const struct z_arm_mpu_partition static_regions[] = {
#if defined(CONFIG_COVERAGE_GCOV) && defined(CONFIG_USERSPACE)
{
@ -82,6 +87,14 @@ static const struct z_arm_mpu_partition static_regions[] = {
.attr = K_MEM_PARTITION_P_RX_U_RX,
},
#endif /* CONFIG_ARCH_HAS_RAMFUNC_SUPPORT */
#if defined(CONFIG_CODE_DATA_RELOCATION_SRAM)
{
/* RAM area for relocated text */
.start = (uint32_t)&__sram_text_start,
.size = (uint32_t)&__sram_text_size,
.attr = K_MEM_PARTITION_P_RX_U_RX,
},
#endif /* CONFIG_CODE_DATA_RELOCATION_SRAM */
#if !defined(CONFIG_MULTITHREADING) && defined(CONFIG_MPU_STACK_GUARD)
/* Main stack MPU guard to detect overflow.
* Note: