Skip to content
Permalink
Browse files

scripts: make mpu align in sections for code reloation

make mpu align inside sections instead of outside to avoid
overlap for code relocation feature.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
  • Loading branch information...
wentongwu authored and nashif committed Jul 1, 2019
1 parent e51c209 commit fa7ce3ff703213bbee555f035ccab0e54f9a9924
Showing with 20 additions and 2 deletions.
  1. +20 −2 scripts/gen_relocate_app.py
@@ -56,7 +56,6 @@

MPU_RO_REGION_END = """
MPU_ALIGN(_{0}_mpu_ro_region_end - _{0}_mpu_ro_region_start);
_{0}_mpu_ro_region_end = .;
"""
@@ -77,6 +76,20 @@
__{0}_{1}_size = SIZEOF(_{2}_{3}_SECTION_NAME);
"""

LINKER_SECTION_SEQ_MPU = """
/* Linker section for memory region {2} for {3} section */
SECTION_PROLOGUE(_{2}_{3}_SECTION_NAME,,)
{{
__{0}_{1}_start = .;
{4}
MPU_ALIGN(__{0}_{1}_size);
__{0}_{1}_end = .;
}} {5}
__{0}_{1}_size = __{0}_{1}_end - __{0}_{1}_start;
"""

SOURCE_CODE_INCLUDES = """
/* Auto generated code. Do not modify.*/
#include <zephyr.h>
@@ -215,7 +228,12 @@ def string_create_helper(region, memory_type,
if memory_type == 'SRAM' and (region == 'data' or region == 'bss'):
linker_string += tmp
else:
linker_string += LINKER_SECTION_SEQ.format(memory_type.lower(), region,
if memory_type != 'SRAM' and region == 'rodata':
linker_string += LINKER_SECTION_SEQ_MPU.format(memory_type.lower(),
region, memory_type.upper(),
region.upper(), tmp, load_address_string)
else:
linker_string += LINKER_SECTION_SEQ.format(memory_type.lower(), region,
memory_type.upper(), region.upper(),
tmp, load_address_string)

0 comments on commit fa7ce3f

Please sign in to comment.
You can’t perform that action at this time.