Skip to content

Commit a683bd7

Browse files
committed
Merge branch 'feature/update_nvs_flash_from_esp-idf' into 'master'
feat(nvs_flash): Update nvs_flash from esp-idf See merge request sdk/ESP8266_RTOS_SDK!1628
2 parents 71d16e7 + f25a7ad commit a683bd7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+10420
-1447
lines changed

components/esp8266/include/esp_attr.h

+6
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,10 @@
6868

6969
#define _COUNTER_STRINGIFY(COUNTER) #COUNTER
7070

71+
#ifdef IDF_CI_BUILD
72+
#define IDF_DEPRECATED(REASON) __attribute__((deprecated(REASON)))
73+
#else
74+
#define IDF_DEPRECATED(REASON)
75+
#endif
76+
7177
#endif /* __ESP_ATTR_H__ */

components/esp8266/source/phy_init.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,15 @@ static const char* PHY_NAMESPACE = "phy";
204204
static const char* PHY_CAL_DATA_KEY = "cal_data";
205205
static const char* PHY_RX_GAIN_DC_TABLE_KEY = "dc_table";
206206

207-
static esp_err_t load_cal_data_from_nvs_handle(nvs_handle handle,
207+
static esp_err_t load_cal_data_from_nvs_handle(nvs_handle_t handle,
208208
esp_phy_calibration_data_t* out_cal_data);
209209

210-
static esp_err_t store_cal_data_to_nvs_handle(nvs_handle handle,
210+
static esp_err_t store_cal_data_to_nvs_handle(nvs_handle_t handle,
211211
const esp_phy_calibration_data_t* cal_data);
212212

213213
esp_err_t esp_phy_load_cal_data_from_nvs(esp_phy_calibration_data_t* out_cal_data)
214214
{
215-
nvs_handle handle;
215+
nvs_handle_t handle;
216216
esp_err_t err = nvs_open(PHY_NAMESPACE, NVS_READONLY, &handle);
217217

218218
if (err == ESP_ERR_NVS_NOT_INITIALIZED) {
@@ -230,7 +230,7 @@ esp_err_t esp_phy_load_cal_data_from_nvs(esp_phy_calibration_data_t* out_cal_dat
230230

231231
esp_err_t esp_phy_store_cal_data_to_nvs(const esp_phy_calibration_data_t* cal_data)
232232
{
233-
nvs_handle handle;
233+
nvs_handle_t handle;
234234
esp_err_t err = nvs_open(PHY_NAMESPACE, NVS_READWRITE, &handle);
235235

236236
if (err != ESP_OK) {
@@ -243,7 +243,7 @@ esp_err_t esp_phy_store_cal_data_to_nvs(const esp_phy_calibration_data_t* cal_da
243243
}
244244
}
245245

246-
static esp_err_t load_cal_data_from_nvs_handle(nvs_handle handle,
246+
static esp_err_t load_cal_data_from_nvs_handle(nvs_handle_t handle,
247247
esp_phy_calibration_data_t* out_cal_data)
248248
{
249249
esp_err_t err;
@@ -278,7 +278,7 @@ static esp_err_t load_cal_data_from_nvs_handle(nvs_handle handle,
278278
return ESP_OK;
279279
}
280280

281-
static esp_err_t store_cal_data_to_nvs_handle(nvs_handle handle,
281+
static esp_err_t store_cal_data_to_nvs_handle(nvs_handle_t handle,
282282
const esp_phy_calibration_data_t* cal_data)
283283
{
284284
esp_err_t err;

components/esp8266/source/system_api.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static const char *BACKUP_MAC_DATA_KEY = "backup_mac_data";
136136
static esp_err_t load_backup_mac_data(uint8_t *mac)
137137
{
138138
esp_err_t err;
139-
nvs_handle handle;
139+
nvs_handle_t handle;
140140
uint32_t efuse[4];
141141
uint8_t efuse_crc = 0;
142142
uint8_t calc_crc = 0;
@@ -221,7 +221,7 @@ static esp_err_t load_backup_mac_data(uint8_t *mac)
221221
static esp_err_t store_backup_mac_data()
222222
{
223223
esp_err_t err;
224-
nvs_handle handle;
224+
nvs_handle_t handle;
225225
uint32_t efuse[4];
226226
efuse[0] = REG_READ(EFUSE_DATA0_REG);
227227
efuse[1] = REG_READ(EFUSE_DATA1_REG);

components/lwip/port/esp8266/netif/dhcp_state.c

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ static const char *interface_key[] = {"IF_STA", "IF_AP", "IF_ETH", "IF_TEST"};
3131
_Static_assert(sizeof(interface_key) / sizeof(char*) == TCPIP_ADAPTER_IF_MAX,
3232
"Number interface keys differs from number of interfaces");
3333

34-
typedef nvs_handle nvs_handle_t;
3534
bool dhcp_ip_addr_restore(void *netif)
3635
{
3736
nvs_handle_t nvs;

components/nvs_flash/CMakeLists.txt

+49-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,51 @@
1-
set(COMPONENT_SRCDIRS "src")
2-
set(COMPONENT_ADD_INCLUDEDIRS "include")
1+
idf_build_get_property(target IDF_TARGET)
32

4-
set(COMPONENT_PRIV_REQUIRES "spi_flash")
3+
set(srcs "src/nvs_api.cpp"
4+
"src/nvs_cxx_api.cpp"
5+
"src/nvs_item_hash_list.cpp"
6+
"src/nvs_page.cpp"
7+
"src/nvs_pagemanager.cpp"
8+
"src/nvs_storage.cpp"
9+
"src/nvs_handle_simple.cpp"
10+
"src/nvs_handle_locked.cpp"
11+
"src/nvs_partition.cpp"
12+
"src/nvs_partition_lookup.cpp"
13+
"src/nvs_partition_manager.cpp"
14+
"src/nvs_types.cpp")
515

6-
register_component()
16+
set(public_req spi_flash)
17+
18+
set(include_dirs "include")
19+
20+
idf_component_register(SRCS "${srcs}"
21+
REQUIRES "${public_req}"
22+
INCLUDE_DIRS "${include_dirs}")
23+
24+
# If we use the linux target, we need to redirect the crc functions to the linux
25+
if(${target} STREQUAL "linux")
26+
if(CONFIG_NVS_ENCRYPTION)
27+
# mbedtls isn't configured for building with linux or as mock target. It will draw in all kind of dependencies
28+
message(FATAL_ERROR "NVS currently doesn't support encryption if built for Linux.")
29+
endif()
30+
idf_component_get_property(spi_flash_dir spi_flash COMPONENT_DIR)
31+
target_include_directories(${COMPONENT_LIB} PUBLIC
32+
"${CMAKE_CURRENT_SOURCE_DIR}/mock/int"
33+
"${spi_flash_dir}/sim/stubs/freertos/include")
34+
target_sources(${COMPONENT_LIB} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/mock/int/crc.cpp")
35+
target_compile_options(${COMPONENT_LIB} PUBLIC "-DLINUX_TARGET")
36+
else()
37+
# TODO: this is a workaround until IDF-2085 is fixed
38+
idf_component_get_property(mbedtls_lib mbedtls COMPONENT_LIB)
39+
target_link_libraries(${COMPONENT_LIB} PUBLIC ${mbedtls_lib})
40+
endif()
41+
42+
if(CONFIG_NVS_ENCRYPTION)
43+
target_sources(${COMPONENT_LIB} PRIVATE "src/nvs_encrypted_partition.cpp")
44+
idf_component_get_property(mbedtls_lib mbedtls COMPONENT_LIB)
45+
target_link_libraries(${COMPONENT_LIB} PUBLIC ${mbedtls_lib})
46+
endif()
47+
48+
if(${target} STREQUAL "linux")
49+
target_compile_options(${COMPONENT_LIB} PUBLIC --coverage)
50+
target_link_libraries(${COMPONENT_LIB} PUBLIC --coverage)
51+
endif()

components/nvs_flash/README.rst

-234
This file was deleted.

0 commit comments

Comments
 (0)