You are currently viewing the documentation for:
The ECF_Format function formats a block device to prepare it to hold files. It will erase all existing data on the block device.
ECF_ErrorCode ECF_Format(
   struct ECF_BlockDriver *pBlockDriver,
   uint16_t clusterSize,
   uint16_t flags
This is a pointer to the ECF_BlockDriver struct that allows the file system to access your block device.
This is the desired cluster size. Valid values are 512, 1024, 2048, 4096, 8192, 16384 and 32768.
Automatically select the smallest possible cluster size.
Options to ECF_Format(). Several options can be used and are OR:ed together. Specify only one or none of the ECF_FORMAT_PARTITIONLESS, ECF_FORMAT_CREATE_PARTITION1 and ECF_FORMAT_PARTITIONx flags. If none of these flags is specified, ECF_FORMAT_PARTITIONLESS will be used as the default.
Format this block device without using a partition table. Recommended setting when formatting an internal flash and you only want to use one partition. This is the default.
This will clear the partition table, create a partition that occupies the entire block device and format it. Recommended setting when formatting an SD card and you only want to use one partition.
This will format partition 1. The partition must already exist.
This will format partition 2. The partition must already exist.
This will format partition 3. The partition must already exist.
This will format partition 4. The partition must already exist.
Performs a quick format by not clearing the data area of the disk when formatting. Note: If you are using Trim support, the entire area will always be trimmed regardless of this flag.
Aligns the cluster placement to the cluster size. This is useful if you are using flash memory to store your file system. By using this flag and a suitable cluster size you can be sure that each of the clusters is aligned to an even page boundary on your flash. As an example, if you are using a flash with a page size of 4096 bytes it is recommended that you enable the ECF_FORMAT_ALIGN flag and set the cluster size to 4096 for best results.
Will force the FAT12 format. This will possibly waste space and create a FAT12 that is as big as possible. It is useful if you want to make sure the formatted disk is compatible with EcFAT Lite.
Return value
Returns one of the EcFAT error codes (ECFERR_SUCCESS on success)
ECF_Format will erase all the data on the block device. It needs to be called for an unformatted block device before it can be mounted. You need to specify ECF_OPT_SUPPORT_FORMAT in your Project.h for EcFAT to compile with support for this function. If you want to wear-level or use bad block management, you should call ECF_WearLevelFormat before calling ECF_Format.
Example Code
See ECF_Mount
See also