Please refer to the SDK example cyfxusbspiregmode or cyfxusbspidmamode for writing or reading data to/from SPI flash devices. Both these firmware enumerates the device as a vendor specific USB device with only the control endpoint and provides a set of vendor commands to read/write the data on SPI flash devices. Both these example projects can be found in the following location:
C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples
Note that this path depends on the installation directory of FX3 SDK.
Please refer to the handling of different vendor commands to understand the implementation of sector erase, writes and reads to/from flash. You can also refer to the readme file available with these example projects to map the vendor commands to their purpose (erase, write, read etc).
Please let me know if you have any queries on this.