Provide MFS_sector_cache_invalidate with args first_sector = X and sectors = 1. Insure cache includes sector X.
The cache_record will not be invalidated!
Check the current code out...
last_sector = first_sector + sectors - 1; // so last_sector now equals X
if ((cache_record->SECTOR_NUM >= first_sector) && (cache_record->SECTOR_NUM < last_sector))
The above evaluates to false, but the intent was for it to be true. Changing the second condition from < to <= fixes the issue.
Minimum number of sectors which MFS is able to keep in cache at a time is 2 sectors. There is a macro in mfs_cnfg.h.
#define MFSCFG_SECTOR_CACHE_SIZE 2
You also can refer to the section 2.5 in MQX_MFS_User_Guide.pdf for more details.
I will forward your solution to the develop team. Thanks for your feedback.
I am not sure that the sector cache size has anything to do with the invalidate function failing to invalidate a cached sector? A cached record is comprised of one sector, no matter the number of records (MFSCFG_SECTOR_CACHE_SIZE ).
MFSCFG_SECTOR_CACHE_SIZE defines the number of cache records, one sector per record.
The MFS_sector_cache_invalidate function allows you to request 1 or a region of sectors to be invalidated. In the case of trying to invalidate 1, it fails.