[silicon_creator] Consider refactoring the FLASH_CTRL_MP_REGIONS
X-macro in flash_ctrl
#24514
Labels
FLASH_CTRL_MP_REGIONS
X-macro in flash_ctrl
#24514
Description
Consider refactoring the uses of the
FLASH_CTRL_MP_REGIONS
X-macros in the flash_ctrl driver.Currently, these X-macros expand to a switch/case statement to cover adjusting the various properties of the flash memory protection region registers. The expansion use macro-pasting to generate the register index and field names (like
FLASH_CTRL_MP_REGION_##arg##_REG_RESVAL
. These values can probably be calculated from base register and an index rather than register pasting.Each case of the switch-case includes a HARDENED_CHECK; it is probably sufficient to use hardened checks to ensure the index is in range before performing the index register calculation.
flash_ctrl_mp_region
functions with the current X-macro expansions.The text was updated successfully, but these errors were encountered: