Hi, is it possible to embed read-only SPIFFS into APP partition?
Unfortunately, the device has been already shipped to client, but there is a request for some updates, which can be solved by OTA update, but the device doesn't have SPIFFS partition created, only 3 APP partitions (factory, ota1, ota2). I need to embed some web files and it would be easier if I could access them by their names using fopen() rather than asm symbols. So I could edit just VFS path to read file from SD card, or embedded one.
virtual SPIFFS in APP partition
Re: virtual SPIFFS in APP partition
I guess I'll try to embed files in tar archive, and register custom VFS to that tar data.
Re: virtual SPIFFS in APP partition
How I can check which mode was used in open() function?
So far I have following code:
And in URI handler I call open() like this:
However, in debug log I get 0 for each mode.
So far I have following code:
Code: Select all
void register_webtar_vfs(void)
{
esp_vfs_t webtar = {
.flags = ESP_VFS_FLAG_DEFAULT,
.write = NULL, // &webtar_write
.open = &webtar_open,
.fstat = NULL, // &webtar_fstat,
.close = NULL, // &webtar_close,
.read = &webtar_read,
};
ESP_ERROR_CHECK(esp_vfs_register("/webtar", &webtar, NULL));
}
Code: Select all
static int webtar_open(const char * path, int flags, int mode)
{
ESP_LOGI(TAG, "open %s, flags: 0x%08X, mode: 0x%08X [RO: %d, WO: %d, RW: %d]",
path, flags, mode, mode & O_RDONLY, mode & O_WRONLY, mode & O_RDWR);
// if (mode != O_RDONLY) return -1;
// ...
}
Code: Select all
int fd = open(path, O_RDONLY);
I (20057) WEBTAR_VFS: open /index.html, flags: 0x00000000, mode: 0x3F40B918 [RO: 0, WO: 0, RW: 0]
-
- Posts: 9745
- Joined: Thu Nov 26, 2015 4:08 am
Re: virtual SPIFFS in APP partition
That is odd... all I can say that 'mode' looks like a pointer here, while you'd simply expect the value of the mode argument (=O_RDONLY) to show up there.
Who is online
Users browsing this forum: Bing [Bot] and 97 guests