Hi @Arunpk
If the FLASH_DRV_Init returns DFlash size 0, the device has been already partitioned and whole DFlash is used as a backup memory for Emulated EEPROM. To be able to use the DFlash directly, you need to remove the partition and then set new partition which will configure the DFlash as normal flash.
You can take a look at this example in SDK 4.0.1 folder:
c:\NXP\S32DS.3.5\S32DS\software\S32SDK_S32K1XX_RTM_4.0.1\examples\S32K118\driver_examples\system\flash_partitioning\
This example contains everything you need. To remove the partition (i.e. to erase whole device), you need to build the RAM target.
This will erase the device and partition, reprogram back the flash configuration field and then it will set the partition:

To use whole DFlash as normal flash (so Emulated EEPROM is not used), use following parameters:
ret = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x0Fu, 0x00u, 0x0u, false, true);



The rest of the example then shows how to erase and program both PFlash and Dflash.
And one more thing - if CSEc was enabled in this device, FLASH_DRV_EraseAllBlock() function needed to remove the partition won't be successful. This command is blocked when CSEc is enabled. The only way to remove the partition is to run CMD_DBG_CHAL and CMD_DBG_AUTH commands with knowledge of MASTER_ECU_KEY. This is shown in following example:
c:\NXP\S32DS.3.5\S32DS\software\S32SDK_S32K1XX_RTM_4.0.1\examples\S32K118\driver_examples\system\csec_keyconfig\
Search for function eraseKeys().
If you don't know the MASTER_ECU_KEY, you are not allowed to remove the partition. There's no workaround for this.

Regards,
Lukas