Hi,
In PSoC6 target, SST block size is configured as 8 flash sectorshttps://git.trustedfirmware.org/trusted-firmware-m.git/tree/platform/ext/target/psoc6/partition/flash_layout.h?h=feature-twincpu#n59 (4KB) and we observe the following issues due to that. These are related to the current implementation at the driver and SST layer.
1. Erasing a block. When sst_flash_erase_block() is invokedhttps://git.trustedfirmware.org/trusted-firmware-m.git/tree/secure_fw/services/secure_storage/flash/sst_flash.c?h=feature-twincpu#n218 from Flash File System for PSoC6 target, seeing that it would never be able to erase more than 512 bytes on PSoC6 when SST emulated block is 4KB which is causing flaw in the initialization sequencehttps://git.trustedfirmware.org/trusted-firmware-m.git/tree/secure_fw/services/secure_storage/tfm_protected_storage.c?h=feature-twincpu#n12 or any meta block erase operationhttps://git.trustedfirmware.org/trusted-firmware-m.git/tree/secure_fw/services/secure_storage/flash_fs/sst_flash_fs_mblock.c?h=feature-twincpu. The ideal solution needs to be addressed on SST Layer, as having a possible workaround in the driver layer would not be ideal.
1. Program Data For the write operation, we do have an implementation in driver layer for PSoC targethttps://git.trustedfirmware.org/trusted-firmware-m.git/tree/platform/ext/target/psoc6/CMSIS_Driver/Driver_Flash.c?h=feature-twincpu#n165 which takes care of erasing emulated block size of 4KB before writehttps://git.trustedfirmware.org/trusted-firmware-m.git/tree/secure_fw/services/secure_storage/flash/sst_flash.c?h=feature-twincpu#n156 operation which doesn't seem to be adequate way, as the erase needs to happen at the SST than driver layer of the target.
Please post your comments on Task : https://developer.trustedfirmware.org/T497
Patch review request: https://review.trustedfirmware.org/c/trusted-firmware-m/+/2109 https://review.trustedfirmware.org/c/trusted-firmware-m/+/2110 https://review.trustedfirmware.org/c/trusted-firmware-m/+/2111
These patches address the Erase block issue and removes the workaround for PSoC6 target. Further enhances support for future targets with less than 4KB flash sector erase.
Thanks & Best Regards, Vikas Katariya
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
tf-m@lists.trustedfirmware.org