ravi wrote: ↑Tue Jan 14, 2025 8:41 ami don't have access to tools, i have to write a program to do it so can you share relevant material if are aware of,
Here is a copy of the FAT32 specification. You can also use Part 2 of the SD specification, but I can't give you a link to it.
If your eMMC will always be the same size, you can create a disk image and write that disk image to the eMMC. You only need to write the blocks containing the filesystem headers, the FAT, and the root directory, so you only need to use a small part of the disk image. (And most of the FAT will be filled with zeroes, so you can make the disk image even smaller.)
ravi wrote: ↑Tue Jan 14, 2025 8:41 amif the speed is because its already erased, then i should not get the same speed for the second time
The eMMC has a translation table mapping LBAs to physical locations in the flash memory. When you write to the eMMC, your data is written to an empty portion of flash, then the translation table is updated to point to the new location in the flash, and eventually the old location is erased. If there is no empty portion of flash, you have to wait for the eMMC to find an unused portion and erase it.
When you send an erase command, the translation table for that LBA is updated to mark it as erased, and the space it used to occupy in the flash can be erased. The more LBAs you erase, the more empty flash there will be next time you try to write something. Sometimes writing specific data, like all-zeroes, will also erase an LBA, but you might need to ask the eMMC vendor to know for sure.
SD cards use the FAT16/FAT32/exFAT filesystem (depending on their size) to optimize the translation table. Some SD cards won't work correctly without it. I don't think eMMC requires a filesystem, but I don't have a copy of the eMMC specification.