filesystem availability

TESTTHISONE
Posts: 9
Joined: Tue Dec 20, 2016 7:24 am

filesystem availability

Postby TESTTHISONE » Fri Jan 20, 2017 2:39 am

Are the following functions work on ESP32 yet?
- time() and clock() functions
- functions which read from standard input: scanf, getc, gets, and so on.
- functions which operate on FILEs, such as fopen, fread, fwrite, fflush, an so on, are not mapped to any filesystem.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: filesystem availability

Postby ESP_igrr » Fri Jan 20, 2017 3:11 am

For the current master branch:
1) yes, time and clock function work (provided you don't disable both FRC1 and RTC timer in menuconfig)
2) yes, although note that these functions currently operate as if the file descriptor has been opened as O_NONBLOCK. So using scanf/fscanf may give unexpected results, as these functions will not block until all input is received (they will just use whatever is there in UART FIFO). One possible way around this is to read up to a newline (or some other delimiter) using `fgetc`, and then pass the string to sscanf for parsing. This limitation will be removed once we add fcntl function to VFS interface.
3) stdio function can work with FAT filesystem on SD card. Some community projects have also ported SPIFFS to the ESP32, which can be plugged into the VFS interface.

Who is online

Users browsing this forum: Baidu [Spider] and 126 guests