Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions drivers/flash/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ if(CONFIG_FLASH_NXP_S32_QSPI_NOR OR CONFIG_FLASH_NXP_S32_QSPI_HYPERFLASH)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers/memc)
endif()

zephyr_library_sources_ifdef(CONFIG_FLASH_MCUX_C40_API flash_mcux_c40.c)
# Run the driver from RAM or another relocation source when relocation is enabled
if(CONFIG_FLASH_MCUX_C40_API AND CONFIG_CODE_DATA_RELOCATION)
zephyr_code_relocate(FILES ${CMAKE_CURRENT_LIST_DIR}/flash_mcux_c40.c LOCATION RAM)
if(DEFINED ZEPHYR_HAL_NXP_MODULE_DIR)
# Relocating HAL driver from Zephyr keeping HAL RTOS-agnostic
Copy link
Contributor

Choose a reason for hiding this comment

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

cmake indent is 2 spaces

zephyr_code_relocate(FILES ${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk-ng/drivers/flash_c40/fsl_c40_flash.c LOCATION RAM)
endif()
endif()

if(CONFIG_SOC_FLASH_RENESAS_RA_HP)
zephyr_library_sources(soc_flash_renesas_ra_hp.c)
zephyr_library_sources_ifdef(CONFIG_FLASH_EX_OP_ENABLED soc_flash_renesas_ra_hp_ex_op.c)
Expand Down
29 changes: 29 additions & 0 deletions drivers/flash/Kconfig.mcux
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,32 @@ choice FLASH_LOG_LEVEL_CHOICE
endchoice

endif # DT_HAS_NXP_IMX_FLEXSPI_ENABLED

# MCUX C40 internal flash API shim (S32K3x)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# MCUX C40 internal flash API shim (S32K3x)
# MCUX C40 internal flash driver (S32K3x)

config FLASH_MCUX_C40_API
def_bool y
depends on SOC_SERIES_S32K3
Copy link
Contributor

Choose a reason for hiding this comment

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

redundant with DT_HAS_NXP_S32K3X_C40_FLASH_ENABLED

depends on DT_HAS_NXP_S32K3X_C40_FLASH_ENABLED
select FLASH_HAS_DRIVER_ENABLED
select FLASH_HAS_EXPLICIT_ERASE
select FLASH_HAS_PAGE_LAYOUT
# C40 uses controller commands, not CPU stores to flash
# so we are not relaxing MPU for ROM writes.
# Relocate driver/HAL when XIP so erase/program run from SRAM:
imply CODE_DATA_RELOCATION if XIP
imply CODE_DATA_RELOCATION_SRAM if XIP
help
Enable the MCUX C40 internal flash API shim used on NXP S32K3x
(e.g. S32K344). Provides Zephyr flash driver glue for &flash0 using
the MCUX C40 HAL. Needed for FLASH_MAP/MCUboot on internal flash
Comment on lines +136 to +138
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Enable the MCUX C40 internal flash API shim used on NXP S32K3x
(e.g. S32K344). Provides Zephyr flash driver glue for &flash0 using
the MCUX C40 HAL. Needed for FLASH_MAP/MCUboot on internal flash
Enable the MCUX C40 internal flash driver used on NXP S32K3x
(e.g. S32K344). Provides Zephyr flash API using MCUX C40 HAL.


# NXP MCUX C40 internal flash: optional protection pass at init
config FLASH_MCUX_C40_APPLY_PROTECTION
bool "Apply default protection windows (IVT/MCUboot) at init"
depends on FLASH_MCUX_C40_API
default y if XIP
help
When enabled, the driver locks/unlocks protection for well-known
regions derived from devicetree (e.g. ivt_header, ivt_pad, mcuboot)
during driver init. Useful on XIP systems to keep IVT/bootloader
areas read-only. Disable if your bootloader/policy manages this.
Loading