Update esp_http_client example to build for linux target

This commit is contained in:
Harshit Malpani
2022-11-08 16:31:52 +05:30
parent e215ede439
commit 5c728e94a7
9 changed files with 141 additions and 36 deletions

View File

@@ -2,9 +2,14 @@
# CMakeLists in this exact order for cmake to work correctly # CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
# (Not part of the boilerplate) if(${IDF_TARGET} STREQUAL "linux")
# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/"
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) "$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) include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(esp_http_client_example) project(esp_http_client_example)

View File

@@ -1,7 +1,12 @@
# Embed the server root certificate into the final binary # Embed the server root certificate into the final binary
# #
# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) # (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)
endif()
idf_component_register(SRCS "esp_http_client_example.c" idf_component_register(SRCS "esp_http_client_example.c"
INCLUDE_DIRS "." INCLUDE_DIRS "."
REQUIRES ${requires}
EMBED_TXTFILES howsmyssl_com_root_cert.pem EMBED_TXTFILES howsmyssl_com_root_cert.pem
postman_root_cert.pem) postman_root_cert.pem)

View File

@@ -9,10 +9,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_system.h"
#include "nvs_flash.h" #include "nvs_flash.h"
#include "esp_event.h" #include "esp_event.h"
#include "esp_netif.h" #include "esp_netif.h"
@@ -22,6 +19,12 @@
#include "esp_crt_bundle.h" #include "esp_crt_bundle.h"
#endif #endif
#if !CONFIG_IDF_TARGET_LINUX
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#endif
#include "esp_http_client.h" #include "esp_http_client.h"
#define MAX_HTTP_RECV_BUFFER 512 #define MAX_HTTP_RECV_BUFFER 512
@@ -144,7 +147,7 @@ static void http_rest_with_url(void)
// GET // GET
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP GET Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP GET Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -160,7 +163,7 @@ static void http_rest_with_url(void)
esp_http_client_set_post_field(client, post_data, strlen(post_data)); esp_http_client_set_post_field(client, post_data, strlen(post_data));
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -172,7 +175,7 @@ static void http_rest_with_url(void)
esp_http_client_set_method(client, HTTP_METHOD_PUT); esp_http_client_set_method(client, HTTP_METHOD_PUT);
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP PUT Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP PUT Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -185,7 +188,7 @@ static void http_rest_with_url(void)
esp_http_client_set_post_field(client, NULL, 0); esp_http_client_set_post_field(client, NULL, 0);
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP PATCH Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP PATCH Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -197,7 +200,7 @@ static void http_rest_with_url(void)
esp_http_client_set_method(client, HTTP_METHOD_DELETE); esp_http_client_set_method(client, HTTP_METHOD_DELETE);
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP DELETE Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP DELETE Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -209,7 +212,7 @@ static void http_rest_with_url(void)
esp_http_client_set_method(client, HTTP_METHOD_HEAD); esp_http_client_set_method(client, HTTP_METHOD_HEAD);
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP HEAD Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP HEAD Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -232,7 +235,7 @@ static void http_rest_with_hostname_path(void)
// GET // GET
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP GET Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP GET Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -246,7 +249,7 @@ static void http_rest_with_hostname_path(void)
esp_http_client_set_post_field(client, post_data, strlen(post_data)); esp_http_client_set_post_field(client, post_data, strlen(post_data));
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -258,7 +261,7 @@ static void http_rest_with_hostname_path(void)
esp_http_client_set_method(client, HTTP_METHOD_PUT); esp_http_client_set_method(client, HTTP_METHOD_PUT);
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP PUT Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP PUT Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -271,7 +274,7 @@ static void http_rest_with_hostname_path(void)
esp_http_client_set_post_field(client, NULL, 0); esp_http_client_set_post_field(client, NULL, 0);
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP PATCH Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP PATCH Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -283,7 +286,7 @@ static void http_rest_with_hostname_path(void)
esp_http_client_set_method(client, HTTP_METHOD_DELETE); esp_http_client_set_method(client, HTTP_METHOD_DELETE);
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP DELETE Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP DELETE Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -295,7 +298,7 @@ static void http_rest_with_hostname_path(void)
esp_http_client_set_method(client, HTTP_METHOD_HEAD); esp_http_client_set_method(client, HTTP_METHOD_HEAD);
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP HEAD Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP HEAD Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -325,7 +328,7 @@ static void http_auth_basic(void)
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP Basic Auth Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP Basic Auth Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -344,7 +347,7 @@ static void http_auth_basic_redirect(void)
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP Basic Auth redirect Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP Basic Auth redirect Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -365,7 +368,7 @@ static void http_auth_digest(void)
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP Digest Auth Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP Digest Auth Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -387,7 +390,7 @@ static void https_with_url(void)
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTPS Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTPS Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -410,7 +413,7 @@ static void https_with_hostname_path(void)
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTPS Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTPS Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -429,7 +432,7 @@ static void http_relative_redirect(void)
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP Relative path redirect Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP Relative path redirect Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -448,7 +451,7 @@ static void http_absolute_redirect(void)
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP Absolute path redirect Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP Absolute path redirect Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -468,7 +471,7 @@ static void http_absolute_redirect_manual(void)
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP Absolute path redirect (manual) Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP Absolute path redirect (manual) Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -488,7 +491,7 @@ static void http_redirect_to_https(void)
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP redirect to HTTPS Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP redirect to HTTPS Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -508,7 +511,7 @@ static void http_download_chunk(void)
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP chunk encoding Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP chunk encoding Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -544,7 +547,7 @@ static void http_perform_as_stream_reader(void)
buffer[read_len] = 0; buffer[read_len] = 0;
ESP_LOGD(TAG, "read_len = %d", read_len); ESP_LOGD(TAG, "read_len = %d", read_len);
} }
ESP_LOGI(TAG, "HTTP Stream reader Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP Stream reader Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
esp_http_client_close(client); esp_http_client_close(client);
@@ -576,7 +579,7 @@ static void https_async(void)
} }
} }
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTPS Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTPS Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -595,7 +598,7 @@ static void https_with_invalid_url(void)
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTPS Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTPS Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -631,7 +634,7 @@ static void http_native_request(void)
} else { } else {
int data_read = esp_http_client_read_response(client, output_buffer, MAX_HTTP_OUTPUT_BUFFER); int data_read = esp_http_client_read_response(client, output_buffer, MAX_HTTP_OUTPUT_BUFFER);
if (data_read >= 0) { if (data_read >= 0) {
ESP_LOGI(TAG, "HTTP GET Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP GET Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
ESP_LOG_BUFFER_HEX(TAG, output_buffer, data_read); ESP_LOG_BUFFER_HEX(TAG, output_buffer, data_read);
@@ -661,7 +664,7 @@ static void http_native_request(void)
} else { } else {
int data_read = esp_http_client_read_response(client, output_buffer, MAX_HTTP_OUTPUT_BUFFER); int data_read = esp_http_client_read_response(client, output_buffer, MAX_HTTP_OUTPUT_BUFFER);
if (data_read >= 0) { if (data_read >= 0) {
ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
ESP_LOG_BUFFER_HEX(TAG, output_buffer, strlen(output_buffer)); ESP_LOG_BUFFER_HEX(TAG, output_buffer, strlen(output_buffer));
@@ -687,7 +690,7 @@ static void http_partial_download(void)
esp_http_client_set_header(client, "Range", "bytes=10-"); esp_http_client_set_header(client, "Range", "bytes=10-");
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -698,7 +701,7 @@ static void http_partial_download(void)
esp_http_client_set_header(client, "Range", "bytes=-10"); esp_http_client_set_header(client, "Range", "bytes=-10");
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -709,7 +712,7 @@ static void http_partial_download(void)
esp_http_client_set_header(client, "Range", "bytes=11-20"); esp_http_client_set_header(client, "Range", "bytes=11-20");
err = esp_http_client_perform(client); err = esp_http_client_perform(client);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTP Status = %d, content_length = %lld", ESP_LOGI(TAG, "HTTP Status = %d, content_length = %"PRIu64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} else { } else {
@@ -749,7 +752,9 @@ static void http_test_task(void *pvParameters)
#endif #endif
ESP_LOGI(TAG, "Finish http example"); ESP_LOGI(TAG, "Finish http example");
#if !CONFIG_IDF_TARGET_LINUX
vTaskDelete(NULL); vTaskDelete(NULL);
#endif
} }
void app_main(void) void app_main(void)
@@ -760,6 +765,7 @@ void app_main(void)
ret = nvs_flash_init(); ret = nvs_flash_init();
} }
ESP_ERROR_CHECK(ret); ESP_ERROR_CHECK(ret);
ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default()); ESP_ERROR_CHECK(esp_event_loop_create_default());
@@ -770,5 +776,9 @@ void app_main(void)
ESP_ERROR_CHECK(example_connect()); ESP_ERROR_CHECK(example_connect());
ESP_LOGI(TAG, "Connected to AP, begin http example"); ESP_LOGI(TAG, "Connected to AP, begin http example");
#if CONFIG_IDF_TARGET_LINUX
http_test_task(NULL);
#else
xTaskCreate(&http_test_task, "http_test_task", 8192, NULL, 5, NULL); xTaskCreate(&http_test_task, "http_test_task", 8192, NULL, 5, NULL);
#endif
} }

View File

@@ -0,0 +1,2 @@
idf_component_register(SRCS esp_stubs.c
INCLUDE_DIRS "include")

View File

@@ -0,0 +1,42 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include <stdlib.h>
#include "esp_err.h"
#include "esp_log.h"
extern void app_main(void);
esp_err_t esp_event_loop_create_default(void)
{
return ESP_OK;
}
esp_err_t esp_netif_init(void)
{
return ESP_OK;
}
esp_err_t example_connect(void)
{
return ESP_OK;
}
esp_err_t nvs_flash_init(void)
{
return ESP_OK;
}
esp_err_t nvs_flash_erase(void)
{
return ESP_OK;
}
int main()
{
app_main();
return 0;
}

View File

@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include "esp_err.h"
esp_err_t esp_event_loop_create_default(void);

View File

@@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include <sys/ioctl.h>
#include <net/if.h>
#include <ifaddrs.h>
#include "esp_err.h"
esp_err_t esp_netif_init(void);

View File

@@ -0,0 +1,14 @@
/*
* 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);

View File

@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include "esp_err.h"
esp_err_t example_connect(void);