2018-04-05 10:04 PM
I am working with F746G-Discovery board running the project application FatFs_uSD built in the repository. The application runs using the code as is which writes the data to the uSD with the f_write function. There is also a f_printf function in ff.c. When I try to call it from main the compiler throws an error indicating the function is not defined. This is odd since it is in the same ff.c file. The function is declared in both the ff.h and ff.c and the function is not static. I checked to see if possibly the directory where the ff.c and ff.h are contained are not in the includes directory list. Sure enough the folder is not in the list. So I added it but the same result occurs. So why is the compiler giving the error? And why is the f_write not coming up as undefined when the directory containing the files are not in the include list. I even tried #include 'ff.h' in the top of main and still the errors occurs with f_printf.
Comments?
PS. ff.c and ff.h are in the Middlewares>FatFs>Core folder in the repository.
2018-04-05 10:10 PM
f_printf is 'extended string' function, available in FATFS at specific configuration:
http://elm-chan.org/fsw/ff/doc/printf.html
, check QuickInfo information.Keep in mind that f_printf calls write function for every character which may cause low-throughput. To keep good throughput, FATFS uses internal sector caches. Try to avoid using this function if possible.
2018-04-09 09:09 AM
Great to know, but the original questions remain unanswered.
2018-04-09 09:18 AM
Note that FatFs is an independent, 3rd-party product - nothing to do with ST.
So specific question should really be directed to the FatFs forum - see:
http://elm-chan.org/fsw/ff/00index_e.html
But the key to your question is probably here:
Majerle.Tilen
wrote:... available in FATFS at specific configuration
.(my emphasis)
So - do you have the correct configuration for f_printf to be available?
See the link to the FatFs documentation which
Majerle.Tilen
provided.2018-04-09 09:19 AM
Make sure ffconf.h defines the components you want to be pulled in.
...
♯ define _USE_STRFUNC 0
/* This option switches string functions, f_gets(), f_putc(), f_puts() and/ f_printf().// 0: Disable string functions./ 1: Enable without LF-CRLF conversion./ 2: Enable with LF-CRLF conversion. */...
Going to be a huge sloth, really want to use sprintf() to fill a spill buffer so you can write multiple sectors in a single operation. ie offset += sprintf(&buffer[offset],'%d ', x); with a buffer holding 8192+16 bytes