I haven’t updated that library in years, but I have recently updated FreeRTOS-FAT-CLI-for-RPi-Pico. I rewrote that function. The idea is to align the volume to an SD card “allocation unit” or “segment”:
AU (Allocation Unit): is a physical boundary of the card and consists of one or more blocks and its size depends on each card. The maximum AU size is defined for memory capacity. Furthermore AU is the minimal unit in which the card guarantees its performance for devices which complies with Speed Class Specification. The information about the size and the Speed Class are stored in the SD Status.
– SD Card Association; Physical Layer Specification Version 3.01
My strategy has been to attempt to emulate the SD Memory Card Formatter because I figure the SD Association ought to know how to properly format an SD card. For a typical 16 GB card with a 4 MiB AU (“segment”) size, it produces a layout like:
Volume base sector: 8192
FAT base sector: 8790
Root directory base sector (FAT12/16) or cluster (FAT32/exFAT): 2
Data base sector: 16384
FAT Cluster size ("allocation unit"): 64 sectors (32768 bytes)
Volume base sector: 8192
FAT base sector: 8224
Root directory base sector (FAT12/16) or cluster (FAT32/exFAT): 2
Data base sector: 15772
FAT Cluster size ("allocation unit"): 64 sectors (32768 bytes)
but that is as close as I have been able to get. (I like that the SD Memory Card Formatter starts the data area on a new AU (“segment”), separate from the FAT, but FF_Format doesn’t give me that option.)
The big difference between FreeRTOS-FAT-CLI-for-PSoC-63 and FreeRTOS-FAT-CLI-for-RPi-Pico would be in the low levels of the SPI driver (e.g., spi.c). I would use something like WinMerge or a similar differencing and merging tool to combine them into an updated package. [If you do something like that, you are welcome to submit a Pull Request.]
If you want to go fast, if at all possible you want to ditch SPI and use SDIO.
I have written up my (limited) understanding of SD card performance tuning: Performance Tuning Tips.