Add external flash support and dual-bank flash swap functionality for 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.
pull/723/head
Pushyanth Kamatham 2026-03-05 17:08:10 +05:30 committed by Daniele Lacamera
parent 756d569ac4
commit 1c756b3583
3 changed files with 1074 additions and 69 deletions

View File

@ -14,7 +14,7 @@ SPI_FLASH?=0
NO_XIP?=0
UART_FLASH?=0
ALLOW_DOWNGRADE?=0
NVM_FLASH_WRITEONCE?=1
NVM_FLASH_WRITEONCE?=0
WOLFBOOT_VERSION?=0
V?=0
SPMATH?=1
@ -27,4 +27,4 @@ WOLFBOOT_PARTITION_SIZE?=0x80000
WOLFBOOT_SECTOR_SIZE?=512
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x10080000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x10100000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=10010000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x10010000

View File

@ -2781,7 +2781,6 @@ The following configuration has been tested on the PSoC CY8CKIT-62S2-43012:
```
make TARGET=psoc6 \
NVM_FLASH_WRITEONCE=1 \
CYPRESS_PDL=./lib/psoc6pdl \
CYPRESS_TARGET_LIB=./lib/TARGET_CY8CKIT-062S2-43012 \
CYPRESS_CORE_LIB=./lib/core-lib \
@ -2798,6 +2797,34 @@ To compile with hardware acceleration disabled, use the option
in your wolfBoot configuration.
#### External Flash Support
PSoC6 supports external QSPI flash for firmware storage. To enable:
```
make TARGET=psoc6 \
EXT_FLASH=1 \
CYPRESS_PDL=./lib/psoc6pdl \
CYPRESS_TARGET_LIB=./lib/TARGET_CY8CKIT-062S2-43012 \
CYPRESS_CORE_LIB=./lib/core-lib \
WOLFBOOT_SECTOR_SIZE=4096
```
External flash uses a temporary sector backup mechanism to handle the larger erase size (for example, 0x40000-byte sectors on an S25FL512S device) compared to internal flash rows. The backup sector is automatically managed in external flash beyond the update partition.
#### Dual-Bank Flash Swap
PSoC6 supports hardware-assisted bank swapping for faster and more reliable firmware updates:
```
make TARGET=psoc6 \
DUALBANK_SWAP=1 \
CYPRESS_PDL=./lib/psoc6pdl \
CYPRESS_TARGET_LIB=./lib/TARGET_CY8CKIT-062S2-43012 \
CYPRESS_CORE_LIB=./lib/core-lib \
WOLFBOOT_SECTOR_SIZE=4096
```
#### OpenOCD installation
Compile and install the customized OpenOCD.

File diff suppressed because it is too large Load Diff