Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,25 @@ Many configurations specific to SQLite library have been set in the `sdkconfig.d

The Flash size has been assumed as 4MB for SPIFFS example. Please change any of these configurations if necessary.

ESP-IDF Compatibility
---------------------
The user KikyTokamuro indicated in the `issues <https://github.com/siara-cc/esp32-idf-sqlite3/issues/18>`_ that you must do this changes for this component to work with **ESP-IDF v5.X.X**:

* In the file "esp32-idf-sqlite3/CMakeLists.txt" add 'spi_flash' to REQUIRES.

It was tested and work in **ESP-IDF v5.0.2-dirty** and **ESP-IDF v5.1.1-dirty**.

The ESP-IDF version is handled in private_include/esp_idf_compat.h

Without this changes this component should work with **ESP-IDF v4.X.X**.

The `examples <https://github.com/siara-cc/esp32-idf-sqlite3-examples/tree/master>`_ where tested with **ESP-IDF Visual Studio Code Extension v1.6.5**. For them to work I had to do some changes:

* In the file `main/CMakeLists.txt` the line `idf_build_component(esp32-idf-sqlite3)` must be commented.
* In the file `CMakeLists.txt` (in root) the line `include($ENV{IDF_PATH}/tools/cmake/idf.cmake)` must be commented and the line `include($ENV{IDF_PATH}/tools/cmake/project.cmake)` must be decomented.

For the case of `sd_spi <https://github.com/siara-cc/esp32-idf-sqlite3-examples/tree/master/sd_spi>`_ example I could not make it work because of changes between version 4.X.X and 5.X.X of ESP-IDF like changing sdspi_slot_config_t to sdspi_device_config_t, which changes the structure of the data.

Issues
------

Expand Down
2 changes: 1 addition & 1 deletion esp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
#include <time.h>
#include <unistd.h>
#include <sqlite3.h>
#include <esp_spi_flash.h>
#include <esp_system.h>
#include <rom/ets_sys.h>
#include <sys/stat.h>

#include "shox96_0_2.h"
#include "esp_idf_compat.h"

#undef dbg_printf
//#define dbg_printf(...) printf(__VA_ARGS__)
Expand Down
18 changes: 18 additions & 0 deletions private_include/esp_idf_compat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef ESP_IDF_COMPAT_H
#define ESP_IDF_COMPAT_H

#if __has_include("esp_idf_version.h")
#include "esp_idf_version.h"
#endif

#ifdef ESP_IDF_VERSION

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
#include <esp_random.h>
#include <spi_flash_mmap.h>
#elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0) && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
#include <esp_spi_flash.h>
#endif

#endif /* ESP_IDF_VERSION */
#endif /* ESP_IDF_COMPAT_H */