Problems porting Reliance Edge File System to ESP32 - No Persistence #36
-
[Originally asked and responded to in the Forum from 2019-08-04 – 2019-08-20] [Customer]
Some more information about the code above: OPENFILES is the max files I can open, defined as 4 When I reprogram ESP, I comment lines 2 and 3 leaving just the reading section. The error occurs right after it tries to fread() a FILE pointer that is NULL by fopen(). I can provide more code and documentation if someone has any idea of what might be happening. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
[Tuxera]
If this doesn't answer your question, you can send the requested code to support@tuxera.com? |
Beta Was this translation helpful? Give feedback.
-
[Customer] |
Beta Was this translation helpful? Give feedback.
-
[Tuxera] The default transaction mask doesn’t include an automatic transaction for red_write(). It does, however, include automatic transactions for red_close() and red_fsync(). The transaction mask can be found in redconf.h: it’s the REDCONF_TRANSACT_DEFAULT macro. You can edit it by hand or use the Reliance Edge Configuration Utility. In addition, the transaction mask can be changed at run-time via the red_settransmask() API (although that might not be accessible via the VFS). I wouldn’t usually recommend enabling RED_TRANSACT_WRITE, because it hurts performance. Transacting on close and fsync is typically more appropriate. However, since you are accessing Reliance Edge indirectly, via the VFS, you might have to investigate how the high-level options (like fwrite() and fclose()) are implemented in order to determine when an automatic transaction point can be expected.
[Tuxera] We will need more details in order to assist you: the OS, Visual Studio version, build log. Usually, it’s as simple as installing a version of Visual Studio (the Community Edition will work), installing GNU make, and then running “make” from projects/win32/host. |
Beta Was this translation helpful? Give feedback.
-
[Customer] |
Beta Was this translation helpful? Give feedback.
-
[Tuxera] Error 22 is RED_EINVAL. Usually that means the configuration is invalid. Try copying the redconf.h and redconf.c from the target into projects/win32 (not projects/win32/host: it has special redconf files that make use of the configuration files in the parent directory). |
Beta Was this translation helpful? Give feedback.
[Tuxera]
It would be helpful to see the actual code—test_setup(), write_test(), read_test()—in order to determine if there is an application error. A few other thoughts:
Is a transaction point occurring? If there is no transaction point, the file won’t persist. By default, creating a file will result in a transaction point, but that can be disabled.
If you have access to a Linux system, can you build the FUSE driver? (Copy the redconf.h/redconf.c into projects/linux, cd into projects/linux/host and make redfuse.) If so, do the files created on the target show up via FUSE? Do files created via FUSE show up on the target?
The problem might be that the SD/MMC sector writes aren’t worki…