Skip to content
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

ARM: SoC MPU definition cleanup #21227

Conversation

ioannisg
Copy link
Member

@ioannisg ioannisg commented Dec 6, 2019

A clean-up patch.

We move the definition of the fixed (Flash and SRAM) MPU region definition for ARM Cortex-M platforms in a common place, and remove all duplicate definitions in each SoC / SoC series.

For backwards compatibility we keep the ability for SoCs to define their own fixed regions, with a Kconfig defined for this purpose. We exercise this for the Kinetis SoCs with the NXP MPU.

We move the configuration of the fixed MPU regions for ARM
Cortex-M SoCs in a common place under soc/arm/common/cortex-m,
instead of having this configuration present in each ARM SoC or
SoC Series definition. The rationale behind this is that for all
SoCs the fixed MPU regions configured at SoC definition are only
used for enforcing default Flash and SRAM access policies, and
currently, this is common to all ARM SoCs with MPU support.

We also simplify the Flash and SRAM MPU region definition,
aiming at using a single MPU region index to program each
of them.

We still support the possibility for ARM SoCs to opt-out and,
instead, define their own custom fixed MPU regions at SoC
definition. We do it using a Kconfig option, introduced
explicitly for this purpose.

Signed-off-by: Ioannis Glaropoulos <[email protected]>
We remove the custom fixed MPU region definition from Nordic
nRF SoC definition, as the common fixed MPU region definition
is now used.

Signed-off-by: Ioannis Glaropoulos <[email protected]>
We remove the custom fixed MPU region definition from Atmel
SAM SoC definition, as the common fixed MPU region definition
is now used.

Signed-off-by: Ioannis Glaropoulos <[email protected]>
We remove the custom fixed MPU region definition from NXP IMX
RT, Kinetis, and LPC SoC definitions, as the common fixed MPU
region definition is now used.

Signed-off-by: Ioannis Glaropoulos <[email protected]>
For the NXP Kinetis SoCs with the NXP MPU regions, we keep
the confiruation of the fixed SoC MPU regions at each SoC
definition.

Signed-off-by: Ioannis Glaropoulos <[email protected]>
We remove the custom fixed MPU region definition from Silicon
Labs exx32 SoC definitions, as the common fixed MPU region
definition is now used.

Signed-off-by: Ioannis Glaropoulos <[email protected]>
We remove the custom fixed MPU region definition from ARM
- Beetle
- Musca_a
- Musca_b1
- MPS2 (an385 and an521)
SoC definitions, as the common fixed MPU region definition
is now used.

Signed-off-by: Ioannis Glaropoulos <[email protected]>
We remove the custom fixed MPU region definition from ST
STM32 SoC definitions, as the common fixed MPU
region definition is now used.

Signed-off-by: Ioannis Glaropoulos <[email protected]>
@ioannisg ioannisg added area: ARM ARM (32-bit) Architecture Enhancement Changes/Updates/Additions to existing features labels Dec 6, 2019
@ioannisg ioannisg added this to the v2.2.0 milestone Dec 6, 2019
@zephyrbot
Copy link
Collaborator

All checks passed.

checkpatch (informational only, not a failure)

-:450: WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#450: FILE: soc/arm/common/cortex_m/arm_mpu_regions.c:18:
+			 REGION_FLASH_ATTR(CONFIG_FLASH_BASE_ADDRESS, \

-:460: WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#460: FILE: soc/arm/common/cortex_m/arm_mpu_regions.c:27:
+			 REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \

- total: 0 errors, 2 warnings, 218 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: Ignored message types: AVOID_EXTERNS BRACES CONFIG_EXPERIMENTAL CONST_STRUCT DATE_TIME FILE_PATH_CHANGES MINMAX NETWORKING_BLOCK_COMMENT_STYLE PRINTK_WITHOUT_KERN_LEVEL SPLIT_STRING VOLATILE

NOTE: If any of the errors are false positives, please report
      them to the maintainers.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

Copy link
Collaborator

@agansari agansari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay, removes redundant code.

CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS may be used in the future to split multi-core and secure/non-secure partitioning, not just kinetis devices.

Copy link
Member

@henrikbrixandersen henrikbrixandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the Kconfig name (CONFIG_CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS seems a bit too long and complex to understand), but the change looks good to me. Thanks for working on this.

@nashif nashif merged commit 16d8a49 into zephyrproject-rtos:master Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARM ARM (32-bit) Architecture Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants