sFlash is a small section of flash that is separate from the regular Hex image and has 4 rows of space (hence the parameter limit of 0-3 on the input to the function).
Regular flash is the same flash that your code is written to.
If you want flash that is accessible between image flashes to the chip, can be read externally, etc. Then use the sFlash to store the data.
Otherwise, if you want to use the regular flash, you will want to verify that you are careful not to corrupt your flash image on the device.
See here: I have a question about flash and sflash
The chip you listed is a variant of PSoC 4 chips, and thus why the datasheets are pointing you to the PSoC 4 architecture:
Thank you for your response Elijah and Gyan.
I understand now about FLASH configuration used by cypress here. For SFLASH, the datasheet mentions it contains library for executable functions for flash programming. So, is there a specific amount of area that is user configurable here? Just wondering so that I don't overwrite any per-existing data.
Another question that I have is, I'm using an external FLASH (512 KB). Out of this, the first 256KB is reserved for application upgrade using bootloader and the rest of storage space is used to store any system information. I reserved 256KB for application upgrade since the on-chip FLASH is also 256KB. I'm wondering if I can optimize this (reduce the space currently reserved on the external FLASH)?
The SFlash is generally intented for application-specific data storage. It is separate from flash and allows you to keep the settings during firmware upgrades.
In some devices (PSoC 4 BLE), part of the SFlash is used for BLE stack (MAC address), while most of it is available to the user application.
Regarding external flash and bootloader - basically, you need as much space reserved as the maximum size of application is expected to be. Theoretically, you could reduce the size, but you would need to make adjustments to the bootloader code (as far as I know, the original bootloader reserves the last sector for metadata, which in your case is just before 256k addres). It can be done, but is a bit of pain in the a** due to automatic code generation overriding any changes you make.
The SFLASH area is not a part of programming memory. It is user configurable area of 4 ROWS ( Each ROW size is 128 bytes for 128 K device and 256 bytes for 256 K device) to store the user device specific information. You can use this area to store your system specific information instead of an external memory for the same task.