Skip to content

Conversation

@DerekSnell
Copy link
Contributor

  • updates this SOC to use flash_k4 driver. Uses flash_k4 driver for internal flash instead of ROM API driver. One
    benefit is the flash program phrase size decreases from 128 Bytes to 16 Bytes. 16 Byte phrases enables this SOC to leverage the Zephyr NVS subsystem, and the MCUboot swap mode.
  • adds testcase for MCXN947 internal flash in samples/subsys/nvs. For boards frdm_mcxn947 and mcx_n9xx_evks test NVS in internal flash in addition to external QSPI flash. Also enable the NVS subsystem on these boards for Twister.

@github-actions
Copy link

github-actions bot commented May 13, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_nxp zephyrproject-rtos/hal_nxp@cea5006 zephyrproject-rtos/hal_nxp@2fe4ab6 zephyrproject-rtos/hal_nxp@cea5006f..2fe4ab6c

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-hal_nxp DNM (manifest) This PR should not be merged (controlled by action-manifest) labels May 13, 2025
@DerekSnell
Copy link
Contributor Author

@hakehuang , can you help test this? This changes the driver used for internal flash. Only the MCXN947 and MCXW devices use this flash_k4 driver currently. The other MCXN and MCXA devices use the existing ROM API driver (for now).

@hakehuang
Copy link
Contributor

@hakehuang , can you help test this? This changes the driver used for internal flash. Only the MCXN947 and MCXW devices use this flash_k4 driver currently. The other MCXN and MCXA devices use the existing ROM API driver (for now).

@DerekSnell , but this will cause the tests/drivers/flash cases failure on those board

2025-05-14 11:44:36,353 - twister - DEBUG - DEVICE: ===================================================================
2025-05-14 11:44:36,356 - twister - DEBUG - DEVICE: TESTSUITE flash_driver failed.
2025-05-14 11:44:36,360 - twister - DEBUG - DEVICE: ------ TESTSUITE SUMMARY START ------
2025-05-14 11:44:36,369 - twister - DEBUG - DEVICE: SUITE FAIL -  50.00% [flash_driver]: pass = 3, fail = 3, skip = 1, total = 7 duration = 2.213 seconds
2025-05-14 11:44:36,375 - twister - DEBUG - DEVICE: - PASS - [flash_driver.test_flash_copy] duration = 0.129 seconds
2025-05-14 11:44:36,381 - twister - DEBUG - DEVICE: - FAIL - [flash_driver.test_flash_erase] duration = 1.705 seconds
2025-05-14 11:44:36,386 - twister - DEBUG - DEVICE: - FAIL - [flash_driver.test_flash_fill] duration = 0.105 seconds
2025-05-14 11:44:36,392 - twister - DEBUG - DEVICE: - FAIL - [flash_driver.test_flash_flatten] duration = 0.104 seconds
2025-05-14 11:44:36,399 - twister - DEBUG - DEVICE: - PASS - [flash_driver.test_flash_page_layout] duration = 0.045 seconds
2025-05-14 11:44:36,404 - twister - DEBUG - DEVICE: - SKIP - [flash_driver.test_get_size] duration = 0.043 seconds
2025-05-14 11:44:36,411 - twister - DEBUG - DEVICE: - PASS - [flash_driver.test_read_unaligned_address] duration = 0.082 seconds
2025-05-14 11:44:36,415 - twister - DEBUG - DEVICE: ------ TESTSUITE SUMMARY END ------
2025-05-14 11:44:36,421 - twister - DEBUG - DEVICE: ===================================================================
2025-05-14 11:44:36,424 - twister - DEBUG - DEVICE: RunID: ff28e480f2713a77f8f07bd24c2121e6
2025-05-14 11:44:36,427 - twister - DEBUG - DEVICE: PROJECT EXECUTION FAILED

- i2c
- i2s
- i3c
- nvs
Copy link
Contributor

Choose a reason for hiding this comment

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

I am personally OK with using SW features, but Zephyr considers it as a mistake.
Please read the comment of @nashif:
#79924 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @butok . But the NVS support does depend on the hardware. NVS does not support flash with program phrase sizes over 32 Bytes. This is the major reason this PR moves this SOC to the other driver, to enable NVS. I feel we do need to filter the NVS tests and samples based on the HW platform. NXP still has other platforms that are not compatible with NVS, like the LPC5500 family.

Copy link
Contributor

Choose a reason for hiding this comment

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

But the NVS support does depend on the hardware.

Nice. I will use this argument in future discussions. ;)

@DerekSnell
Copy link
Contributor Author

@DerekSnell , but this will cause the tests/drivers/flash cases failure on those board

@hakehuang , that test case fails from this known issue #88080. And that test case tests the external QSPI flash, not the internal flash used with this PR.

@hakehuang
Copy link
Contributor

@hakehuang , that test case fails from this known issue #88080. And that test case tests the external QSPI flash, not the internal flash used with this PR.

board testing for system/subsys/nvs pass on v4.1.0-3814-g72ab204c80ac

@kartben kartben assigned mmahadevan108 and dleach02 and unassigned kartben May 16, 2025
@dleach02
Copy link
Member

@DerekSnell can you address the merge conflicts

@DerekSnell
Copy link
Contributor Author

rebased to resolve merge conflicts. Also added the MCXN547 SOC derivative from #89712

@hakehuang hakehuang self-requested a review May 26, 2025 05:35
hakehuang
hakehuang previously approved these changes May 26, 2025
@DerekSnell
Copy link
Contributor Author

rebased to resolve CI test failures

@hakehuang
Copy link
Contributor

board testing pass for
• board_list :['frdm_mcxn947/mcxn947/cpu0', 'mcx_n9xx_evk/mcxn947/cpu0']
• commit_id :96a637c2aad472a8eaca077674b9a4b35e59335e
• pull_id :89909
• version :v4.1.0-4937-g96a637c2aad4

@hakehuang hakehuang self-requested a review May 30, 2025 04:19
hakehuang
hakehuang previously approved these changes May 30, 2025
decsny
decsny previously approved these changes May 30, 2025
Use flash_k4 driver for internal flash instead of ROM API driver.  One
benefit is the flash program phrase size decreases from 128 Bytes to 16
Bytes.  16 Byte phrases enables this SOC to leverage the Zephyr NVS
subsystem, and the MCUboot swap mode.

Signed-off-by: Derek Snell <derek.snell@nxp.com>

Conflicts:
	west.yml
For internal flash FMU programg/erase operations, enable the FRO12MHZ
clock when the flash driver is enabled.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
For boards frdm_mcxn947 and mcx_n9xx_evk test NVS in internal flash in
addition to external QSPI flash.  Also enable the NVS subsystem on
these boards for Twister.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
@dleach02 dleach02 dismissed stale reviews from decsny and hakehuang via be4523c May 30, 2025 18:26
@dleach02
Copy link
Member

@DerekSnell your HAL PR was merged so I updated this one to have the new SHA

@github-actions github-actions bot removed the DNM (manifest) This PR should not be merged (controlled by action-manifest) label May 30, 2025
@decsny decsny mentioned this pull request May 30, 2025
1 task
@dleach02 dleach02 closed this May 30, 2025
@dleach02 dleach02 reopened this May 30, 2025
@sonarqubecloud
Copy link

@nashif nashif merged commit 2dc9c2b into zephyrproject-rtos:main May 31, 2025
53 of 65 checks passed
@DerekSnell DerekSnell deleted the flash_k4_mcx branch June 2, 2025 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants