From 7f683f099673a42c2e7da5d9f323134f3e4c3b5c Mon Sep 17 00:00:00 2001 From: Harshit Malpani Date: Thu, 12 Jan 2023 10:09:25 +0530 Subject: [PATCH] Remove nvs_flash.h from `protocols/linux_stubs` --- .../protocols/esp_http_client/main/CMakeLists.txt | 2 +- .../protocols/http_server/simple/CMakeLists.txt | 6 +++--- .../http_server/simple/main/CMakeLists.txt | 2 +- .../protocols/linux_stubs/esp_stubs/esp_stubs.c | 7 +------ .../linux_stubs/esp_stubs/include/nvs_flash.h | 14 -------------- .../sockets/tcp_client/main/CMakeLists.txt | 2 +- 6 files changed, 7 insertions(+), 26 deletions(-) delete mode 100644 examples/protocols/linux_stubs/esp_stubs/include/nvs_flash.h diff --git a/examples/protocols/esp_http_client/main/CMakeLists.txt b/examples/protocols/esp_http_client/main/CMakeLists.txt index cc80568867..70ed376538 100644 --- a/examples/protocols/esp_http_client/main/CMakeLists.txt +++ b/examples/protocols/esp_http_client/main/CMakeLists.txt @@ -3,7 +3,7 @@ # (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) set(requires "") if(${IDF_TARGET} STREQUAL "linux") - list(APPEND requires esp_stubs esp-tls esp_http_client protocol_examples_common) + list(APPEND requires esp_stubs esp-tls esp_http_client protocol_examples_common nvs_flash) endif() idf_component_register(SRCS "esp_http_client_example.c" INCLUDE_DIRS "." diff --git a/examples/protocols/http_server/simple/CMakeLists.txt b/examples/protocols/http_server/simple/CMakeLists.txt index 388dd328eb..33574050bb 100644 --- a/examples/protocols/http_server/simple/CMakeLists.txt +++ b/examples/protocols/http_server/simple/CMakeLists.txt @@ -2,12 +2,12 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.16) +set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) + if(${IDF_TARGET} STREQUAL "linux") - set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/" + list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/" "$ENV{IDF_PATH}/examples/protocols/linux_stubs/esp_stubs") set(COMPONENTS main) -else() - set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) endif() include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/examples/protocols/http_server/simple/main/CMakeLists.txt b/examples/protocols/http_server/simple/main/CMakeLists.txt index 3b6650585b..28894fd56e 100644 --- a/examples/protocols/http_server/simple/main/CMakeLists.txt +++ b/examples/protocols/http_server/simple/main/CMakeLists.txt @@ -1,6 +1,6 @@ set(requires "") if(${IDF_TARGET} STREQUAL "linux") - list(APPEND requires esp_stubs esp-tls esp_http_server protocol_examples_common) + list(APPEND requires esp_stubs esp-tls esp_http_server protocol_examples_common nvs_flash) endif() idf_component_register(SRCS "main.c" INCLUDE_DIRS "." diff --git a/examples/protocols/linux_stubs/esp_stubs/esp_stubs.c b/examples/protocols/linux_stubs/esp_stubs/esp_stubs.c index 989162f74e..cd2216f89f 100644 --- a/examples/protocols/linux_stubs/esp_stubs/esp_stubs.c +++ b/examples/protocols/linux_stubs/esp_stubs/esp_stubs.c @@ -15,12 +15,7 @@ esp_err_t esp_netif_init(void) return ESP_OK; } -esp_err_t nvs_flash_init(void) -{ - return ESP_OK; -} - -esp_err_t nvs_flash_erase(void) +esp_err_t example_connect(void) { return ESP_OK; } diff --git a/examples/protocols/linux_stubs/esp_stubs/include/nvs_flash.h b/examples/protocols/linux_stubs/esp_stubs/include/nvs_flash.h deleted file mode 100644 index 87ebc96a33..0000000000 --- a/examples/protocols/linux_stubs/esp_stubs/include/nvs_flash.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Unlicense OR CC0-1.0 - */ -#include "esp_err.h" - -#define ESP_ERR_NVS_BASE 0x1100 /*!< Starting number of error codes */ -#define ESP_ERR_NVS_NO_FREE_PAGES (ESP_ERR_NVS_BASE + 0x0d) /*!< NVS partition doesn't contain any empty pages. This may happen if NVS partition was truncated. Erase the whole partition and call nvs_flash_init again. */ -#define ESP_ERR_NVS_NEW_VERSION_FOUND (ESP_ERR_NVS_BASE + 0x10) /*!< NVS partition contains data in new format and cannot be recognized by this version of code */ - -esp_err_t nvs_flash_init(void); - -esp_err_t nvs_flash_erase(void); diff --git a/examples/protocols/sockets/tcp_client/main/CMakeLists.txt b/examples/protocols/sockets/tcp_client/main/CMakeLists.txt index ce931f8b55..721b9c9316 100644 --- a/examples/protocols/sockets/tcp_client/main/CMakeLists.txt +++ b/examples/protocols/sockets/tcp_client/main/CMakeLists.txt @@ -1,5 +1,5 @@ if(${IDF_TARGET} STREQUAL "linux") - set(requires esp_stubs protocol_examples_common) + set(requires esp_stubs protocol_examples_common nvs_flash) endif() if("${CONFIG_EXAMPLE_IPV4}" STREQUAL y)