Skip to content

Add external flash support and dual-bank flash swap functionality for PSoC6 devices#700

Open
Pushyanth-Infineon wants to merge 1 commit intowolfSSL:masterfrom
Pushyanth-Infineon:psoc6_extflash_dualbank_support
Open

Add external flash support and dual-bank flash swap functionality for PSoC6 devices#700
Pushyanth-Infineon wants to merge 1 commit intowolfSSL:masterfrom
Pushyanth-Infineon:psoc6_extflash_dualbank_support

Conversation

@Pushyanth-Infineon
Copy link

Description

Add external flash support and dual-bank flash swap functionality for PSoC6 devices.
Removed NVM_FLASH_WRITEONCE restriction for PSoC6 devices.
Update flash hal functions of PSoC6 to support read-modify-erase-write way to perform the programming of flash

Testing

Tested using CY8CPROTO-062-4343W with the project: https://github.com/Pushyanth-Infineon/mtb-example-wolfboot-tpm

Usage:

  • Import the project into ModusToolbox IDE using project-creator.
  • Switch to master branch in wolfssl submodule which have fix for includes in wolfcrypt psoc6 port:
    cd ../mtb_shared/wolfboot/wolfboot-psoc6/lib/wolfssl
    git switch master
    git pull origin
  • Program the bootloader and main application using ModusToolbox.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@danielinux danielinux requested a review from Copilot February 27, 2026 16:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds external flash support and dual-bank flash swap functionality for PSoC6 devices, along with enhanced flash programming capabilities using a read-modify-erase-write approach.

Changes:

  • Removed NVM_FLASH_WRITEONCE restriction to enable flexible flash programming
  • Added external QSPI flash support with SFDP-based configuration and temporary sector management
  • Implemented dual-bank flash swap for hardware-assisted firmware updates
  • Enhanced internal flash operations with optimized erase size selection (sector/subsector/row)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
hal/psoc6.c Core implementation of external flash, dual-bank swap, and enhanced flash HAL functions
docs/Targets.md Documentation for new external flash and dual-bank features
config/examples/cypsoc6.config Updated default configuration with NVM_FLASH_WRITEONCE=0 and fixed swap address

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dgarske
Copy link
Contributor

dgarske commented Feb 27, 2026

Okay to test. Contributor agreement on file. Over to @danielinux to review.

Copy link
Member

@danielinux danielinux left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution! A couple of minor things:

  • check the return value of ext_flash_read() as described in docs/HAL.md
  • it looks like the content of the temp sector is never restored at the end of ext_flash_write()

@Pushyanth-Infineon Pushyanth-Infineon force-pushed the psoc6_extflash_dualbank_support branch 2 times, most recently from 53d6227 to 46ed900 Compare March 3, 2026 19:57
Copy link
Member

@danielinux danielinux left a comment

Choose a reason for hiding this comment

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

Issues solved now. Please fix build error

… PSoC6 devices.

Removed NVM_FLASH_WRITEONCE restriction for psoc6.
Update flash hal functions to support read-modify-erase-write way to perform the programming of flash.
@Pushyanth-Infineon Pushyanth-Infineon force-pushed the psoc6_extflash_dualbank_support branch from 46ed900 to f819928 Compare March 5, 2026 11:38
@Pushyanth-Infineon
Copy link
Author

Issues solved now. Please fix build error

Resolved the build errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants