I'm working on an embedded C app.
Some modules use fatfs to access an SD card. I would like to build some unit tests for those modules that will run on a pc for easier development.
As I did not already use files functions in C, I thought that the standard C lib and fatFs would have expose the same prototypes. After some research, it's not the case. Two examples:
FatFS:
FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode);
FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br);
C lib:
FILE * fopen( const char * restrict filename, const char * restrict accessMode );
size_t fread( void * restrict buffer, size_t blocSize, size_t blocCount, FILE * restrict stream );
It's not that far... but not the same.
Here's my question. Should I need to implement my own abstract layer to map an api on the other one or is there already something that exists for that? I suspect that I should not be the first one with this need.