[PATCH] bsps/arm: Add support for MPU region alignment

Gedare Bloom gedare at rtems.org
Thu Apr 2 14:44:19 UTC 2020


On Thu, Apr 2, 2020 at 12:15 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> ---
>  bsps/arm/shared/start/linkcmds.base | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/bsps/arm/shared/start/linkcmds.base b/bsps/arm/shared/start/linkcmds.base
> index 1f5f1ef959..d0663cf97e 100644
> --- a/bsps/arm/shared/start/linkcmds.base
> +++ b/bsps/arm/shared/start/linkcmds.base
> @@ -81,6 +81,17 @@ SECTIONS {
>         } > REGION_TEXT AT > REGION_TEXT_LOAD
>         .fini : ALIGN_WITH_INPUT {
>                 KEEP (*(.fini))
> +
> +               /*
> +                * If requested, align the size of the combined start and text
> +                * section to the next power of two to meet MPU region
> +                * alignment requirements.
> +                */
> +               . = DEFINED (bsp_section_do_mpu_align) ?
> +                   bsp_section_start_begin
> +                   + ALIGN (. - bsp_section_start_begin,
> +                   1 << LOG2CEIL (. - bsp_section_start_begin)) : .;
This looks alright. I don't find the symbol bsp_section_do_mpu_align
anywhere though, is it currently unused?

Do you need this in 5.1.0 for something?


> +
>                 bsp_section_text_end = .;
>         } > REGION_TEXT AT > REGION_TEXT_LOAD
>         bsp_section_text_size = bsp_section_text_end - bsp_section_text_begin;
> @@ -248,6 +259,16 @@ SECTIONS {
>                 *(set_pseudo_*);
>
>                 KEEP (*(SORT(.rtemsroset.*)))
> +
> +               /*
> +                * If requested, align the size of the rodata section to the
> +                * next power of two to meet MPU region alignment requirements.
> +                */
> +               . = DEFINED (bsp_section_do_mpu_align) ?
> +                   bsp_section_rodata_begin
> +                   + ALIGN (. - bsp_section_rodata_begin,
> +                   1 << LOG2CEIL (. - bsp_section_rodata_begin)) : .;
> +
>                 bsp_section_rodata_end = .;
>         } > REGION_RODATA AT > REGION_RODATA_LOAD
>         bsp_section_rodata_size = bsp_section_rodata_end - bsp_section_rodata_begin;
> --
> 2.16.4
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list