Merge branch 'bugfix/netif_test_rules' into 'master'

esp_netif various fixes: dependency cleanup, default flags, CI rules

Closes IDF-5550, IDFGH-7023, IDF-1261, and IDF-2155

See merge request espressif/esp-idf!20301
pull/10469/head
David Čermák 2022-12-16 21:26:05 +08:00
commit a3dd334081
28 zmienionych plików z 150 dodań i 73 usunięć

Wyświetl plik

@ -92,6 +92,7 @@
/components/esp_lcd/ @esp-idf-codeowners/peripherals
/components/esp_local_ctrl/ @esp-idf-codeowners/app-utilities
/components/esp_netif/ @esp-idf-codeowners/network
/components/esp_netif_stack/ @esp-idf-codeowners/network
/components/esp_partition/ @esp-idf-codeowners/storage
/components/esp_phy/ @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154
/components/esp_pm/ @esp-idf-codeowners/power-management @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/system

Wyświetl plik

@ -6,9 +6,9 @@ components/esp_netif/test_apps/test_app_esp_netif:
temporary: true
reason: target esp32c6 is not supported yet
disable_test:
- if: IDF_TARGET != "esp32s2"
temporary: true
reason: lack of runners
- if: IDF_TARGET not in ["esp32s2", "esp32c3"]
temporary: false
reason: Not needed to test on all targets (chosen two, one for each architecture)
components/esp_netif/test_apps/test_app_vfs_l2tap:
disable:

Wyświetl plik

@ -6,48 +6,52 @@ if(${target} STREQUAL "linux")
return()
endif()
set(srcs_lwip
"lwip/esp_netif_lwip.c"
"lwip/esp_netif_lwip_defaults.c"
"lwip/netif/wlanif.c"
"lwip/netif/ethernetif.c"
"lwip/netif/esp_pbuf_ref.c")
set(srcs
"esp_netif_handlers.c"
"esp_netif_objects.c"
"esp_netif_defaults.c"
"lwip/esp_netif_lwip.c"
"lwip/esp_netif_lwip_defaults.c"
"lwip/netif/wlanif.c"
"lwip/netif/ethernetif.c"
"lwip/netif/esp_pbuf_ref.c" )
"esp_netif_defaults.c")
set(include_dirs "include")
set(priv_include_dirs "lwip" "private_include")
set(priv_include_dirs "private_include")
if(CONFIG_PPP_SUPPORT)
list(APPEND srcs
"lwip/esp_netif_lwip_ppp.c")
list(APPEND srcs_lwip lwip/esp_netif_lwip_ppp.c)
endif()
if(CONFIG_LWIP_NETIF_LOOPBACK)
list(APPEND srcs
"loopback/esp_netif_loopback.c")
endif()
if(CONFIG_ESP_NETIF_L2_TAP)
list(APPEND srcs
"vfs_l2tap/esp_vfs_l2tap.c")
list(APPEND srcs vfs_l2tap/esp_vfs_l2tap.c)
endif()
if(CONFIG_ESP_NETIF_BRIDGE_EN)
list(APPEND srcs
"lwip/esp_netif_br_glue.c")
list(APPEND srcs_lwip lwip/esp_netif_br_glue.c)
endif()
if(CONFIG_ESP_NETIF_LOOPBACK)
list(APPEND srcs loopback/esp_netif_loopback.c)
elseif(CONFIG_ESP_NETIF_TCPIP_LWIP)
list(APPEND srcs ${srcs_lwip})
list(APPEND priv_include_dirs lwip)
endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES esp_event
PRIV_REQUIRES lwip
PRIV_REQUIRES esp_netif_stack
LDFRAGMENTS linker.lf)
if(CONFIG_ESP_NETIF_L2_TAP OR CONFIG_ESP_NETIF_BRIDGE_EN)
idf_component_optional_requires(PRIVATE esp_eth vfs)
endif()
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

Wyświetl plik

@ -20,6 +20,7 @@ menu "ESP NETIF Adapter"
Choose the TCP/IP Stack to work, for example, LwIP, uIP, etc.
config ESP_NETIF_TCPIP_LWIP
bool "LwIP"
select ESP_NETIF_USES_TCPIP_WITH_BSD_API
help
lwIP is a small independent implementation of the TCP/IP protocol suite.
@ -31,6 +32,9 @@ menu "ESP NETIF Adapter"
endchoice
config ESP_NETIF_USES_TCPIP_WITH_BSD_API
bool # Set to true if the chosen TCP/IP stack provides BSD socket API
config ESP_NETIF_L2_TAP
bool "Enable netif L2 TAP support"
select ETH_TRANSMIT_MUTEX

Wyświetl plik

@ -5,7 +5,6 @@
*/
#include "esp_netif.h"
#include "lwip/esp_netif_net_stack.h"
//
// Purpose of this module is to provide
@ -31,4 +30,6 @@ const esp_netif_inherent_config_t _g_esp_netif_inherent_ap_config = ESP_NETIF_IN
const esp_netif_inherent_config_t _g_esp_netif_inherent_eth_config = ESP_NETIF_INHERENT_DEFAULT_ETH();
#ifdef CONFIG_PPP_SUPPORT
const esp_netif_inherent_config_t _g_esp_netif_inherent_ppp_config = ESP_NETIF_INHERENT_DEFAULT_PPP();
#endif

Wyświetl plik

@ -17,9 +17,16 @@ extern "C" {
// Macros to assemble master configs with partial configs from netif, stack and driver
//
// If GARP enabled in menuconfig (default), make it also a default config for common netifs
#ifdef CONFIG_LWIP_ESP_GRATUITOUS_ARP
#define ESP_NETIF_DEFAULT_ARP_FLAGS (ESP_NETIF_FLAG_GARP)
#else
#define ESP_NETIF_DEFAULT_ARP_FLAGS (0)
#endif
#define ESP_NETIF_INHERENT_DEFAULT_WIFI_STA() \
{ \
.flags = (esp_netif_flags_t)(ESP_NETIF_DHCP_CLIENT | ESP_NETIF_FLAG_GARP | ESP_NETIF_FLAG_EVENT_IP_MODIFIED), \
.flags = (esp_netif_flags_t)(ESP_NETIF_DHCP_CLIENT | ESP_NETIF_DEFAULT_ARP_FLAGS | ESP_NETIF_FLAG_EVENT_IP_MODIFIED), \
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(mac) \
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(ip_info) \
.get_ip_event = IP_EVENT_STA_GOT_IP, \
@ -47,7 +54,7 @@ extern "C" {
#define ESP_NETIF_INHERENT_DEFAULT_ETH() \
{ \
.flags = (esp_netif_flags_t)(ESP_NETIF_DHCP_CLIENT | ESP_NETIF_FLAG_GARP | ESP_NETIF_FLAG_EVENT_IP_MODIFIED), \
.flags = (esp_netif_flags_t)(ESP_NETIF_DHCP_CLIENT | ESP_NETIF_DEFAULT_ARP_FLAGS | ESP_NETIF_FLAG_EVENT_IP_MODIFIED), \
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(mac) \
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(ip_info) \
.get_ip_event = IP_EVENT_ETH_GOT_IP, \
@ -58,6 +65,7 @@ extern "C" {
.bridge_info = NULL \
}
#ifdef CONFIG_PPP_SUPPORT
#define ESP_NETIF_INHERENT_DEFAULT_PPP() \
{ \
.flags = ESP_NETIF_FLAG_IS_PPP, \
@ -70,13 +78,14 @@ extern "C" {
.route_prio = 20, \
.bridge_info = NULL \
}
#endif /* CONFIG_PPP_SUPPORT */
#define ESP_NETIF_INHERENT_DEFAULT_BR() \
{ \
.flags = (esp_netif_flags_t)(ESP_NETIF_DHCP_CLIENT | ESP_NETIF_FLAG_GARP | ESP_NETIF_FLAG_EVENT_IP_MODIFIED | ESP_NETIF_FLAG_IS_BRIDGE), \
.flags = (esp_netif_flags_t)(ESP_NETIF_DHCP_CLIENT | ESP_NETIF_DEFAULT_ARP_FLAGS | ESP_NETIF_FLAG_EVENT_IP_MODIFIED | ESP_NETIF_FLAG_IS_BRIDGE), \
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(mac) \
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(ip_info) \
.get_ip_event = IP_EVENT_ETH_GOT_IP, \
@ -119,6 +128,7 @@ extern "C" {
.stack = ESP_NETIF_NETSTACK_DEFAULT_WIFI_STA, \
}
#ifdef CONFIG_PPP_SUPPORT
/**
* @brief Default configuration reference of PPP client
*/
@ -128,6 +138,7 @@ extern "C" {
.driver = NULL, \
.stack = ESP_NETIF_NETSTACK_DEFAULT_PPP, \
}
#endif /* CONFIG_PPP_SUPPORT */
/**
* @brief Default base config (esp-netif inherent) of WIFI STA
@ -146,10 +157,12 @@ extern "C" {
*/
#define ESP_NETIF_BASE_DEFAULT_ETH &_g_esp_netif_inherent_eth_config
#ifdef CONFIG_PPP_SUPPORT
/**
* @brief Default base config (esp-netif inherent) of ppp interface
*/
#define ESP_NETIF_BASE_DEFAULT_PPP &_g_esp_netif_inherent_ppp_config
#endif
#define ESP_NETIF_NETSTACK_DEFAULT_ETH _g_esp_netif_netstack_default_eth
@ -158,7 +171,9 @@ extern "C" {
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
#define ESP_NETIF_NETSTACK_DEFAULT_WIFI_AP _g_esp_netif_netstack_default_wifi_ap
#endif
#ifdef CONFIG_PPP_SUPPORT
#define ESP_NETIF_NETSTACK_DEFAULT_PPP _g_esp_netif_netstack_default_ppp
#endif
//
// Include default network stacks configs
@ -172,8 +187,9 @@ extern const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_sta
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
extern const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_ap;
#endif
#ifdef CONFIG_PPP_SUPPORT
extern const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_ppp;
#endif
//
// Include default common configs inherent to esp-netif
// - These inherent configs are defined in esp_netif_defaults.c and describe
@ -184,8 +200,9 @@ extern const esp_netif_inherent_config_t _g_esp_netif_inherent_sta_config;
extern const esp_netif_inherent_config_t _g_esp_netif_inherent_ap_config;
#endif
extern const esp_netif_inherent_config_t _g_esp_netif_inherent_eth_config;
#ifdef CONFIG_PPP_SUPPORT
extern const esp_netif_inherent_config_t _g_esp_netif_inherent_ppp_config;
#endif
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
extern const esp_netif_ip_info_t _g_esp_netif_soft_ap_ip;
#endif

Wyświetl plik

@ -10,7 +10,9 @@
#include "lwip/netif.h"
#include "esp_netif_ppp.h"
#if defined(CONFIG_ESP_NETIF_TCPIP_LWIP)
#ifdef __cplusplus
extern "C" {
#endif
typedef err_t (*init_fn_t)(struct netif*);
typedef void (*input_fn_t)(void *netif, void *buffer, size_t len, void *eb);
@ -72,4 +74,6 @@ err_t wlanif_init_sta(struct netif *netif);
*/
void wlanif_input(void *h, void *buffer, size_t len, void* l2_buff);
#endif // CONFIG_ESP_NETIF_TCPIP_LWIP
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -32,6 +32,11 @@ static bool s_netif_up = false;
*
*
*/
#ifndef NETIF_MAX_HWADDR_LEN
#define NETIF_MAX_HWADDR_LEN 6U
#endif
struct esp_netif_obj {
// default interface addresses
uint8_t mac[NETIF_MAX_HWADDR_LEN];
@ -112,9 +117,9 @@ static esp_err_t esp_netif_init_configuration(esp_netif_t *esp_netif, const esp_
// Configure general esp-netif properties
memcpy(esp_netif->mac, cfg->base->mac, NETIF_MAX_HWADDR_LEN);
if (cfg->base->ip_info == NULL) {
ip4_addr_set_zero(&esp_netif->ip_info->ip);
ip4_addr_set_zero(&esp_netif->ip_info->gw);
ip4_addr_set_zero(&esp_netif->ip_info->netmask);
esp_netif->ip_info->ip.addr = 0;
esp_netif->ip_info->gw.addr = 0;
esp_netif->ip_info->netmask.addr = 0;
} else {
memcpy(esp_netif->ip_info, cfg->base->ip_info, sizeof(esp_netif_ip_info_t));
}
@ -450,7 +455,7 @@ esp_err_t esp_netif_leave_ip6_multicast_group(esp_netif_t *esp_netif, const esp_
return ESP_ERR_NOT_SUPPORTED;
}
esp_err_t esp_netif_add_ip6_address(esp_netif_t *esp_netif, const esp_ip6_addr_t *addr, uint8_t preference)
esp_err_t esp_netif_add_ip6_address(esp_netif_t *esp_netif, const ip_event_add_ip6_t *addr)
{
return ESP_ERR_NOT_SUPPORTED;
}

Wyświetl plik

@ -17,8 +17,6 @@
#include "esp_netif_private.h"
#include "esp_random.h"
#if defined(CONFIG_ESP_NETIF_TCPIP_LWIP)
#include "lwip/tcpip.h"
#include "lwip/dhcp.h"
#include "lwip/ip_addr.h"
@ -2275,5 +2273,3 @@ esp_err_t esp_netif_remove_ip6_address(esp_netif_t *esp_netif, const esp_ip6_add
_RUN_IN_LWIP_TASK(esp_netif_remove_ip6_address_api, esp_netif, addr)
#endif // CONFIG_LWIP_IPV6
#endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */

Wyświetl plik

@ -7,9 +7,9 @@
#include "esp_netif.h"
#include "esp_netif_lwip_internal.h"
#include "lwip/esp_netif_net_stack.h"
#if defined(CONFIG_PPP_SUPPORT)
#include "esp_netif_lwip_ppp.h"
#if defined(CONFIG_ESP_NETIF_TCPIP_LWIP)
#endif
#if CONFIG_ESP_NETIF_BRIDGE_EN
#include "netif/bridgeif.h"
@ -48,6 +48,7 @@ static const struct esp_netif_netstack_config s_wifi_netif_config_sta = {
}
};
#if defined(CONFIG_PPP_SUPPORT)
static const struct esp_netif_netstack_config s_netif_config_ppp = {
.lwip_ppp = {
.input_fn = esp_netif_lwip_ppp_input,
@ -57,10 +58,9 @@ static const struct esp_netif_netstack_config s_netif_config_ppp = {
}
}
};
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_ppp = &s_netif_config_ppp;
#endif // CONFIG_PPP_SUPPORT
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_eth = &s_eth_netif_config;
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_sta = &s_wifi_netif_config_sta;
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_ap = &s_wifi_netif_config_ap;
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_ppp = &s_netif_config_ppp;
#endif /*CONFIG_ESP_NETIF_TCPIP_LWIP*/

Wyświetl plik

@ -11,8 +11,6 @@
#include "lwip/netif.h"
#include "dhcpserver/dhcpserver.h"
#if defined(CONFIG_ESP_NETIF_TCPIP_LWIP)
struct esp_netif_api_msg_s;
typedef int (*esp_netif_api_fn)(struct esp_netif_api_msg_s *msg);
@ -108,5 +106,3 @@ struct esp_netif_obj {
uint8_t max_ports;
#endif // CONFIG_ESP_NETIF_BRIDGE_EN
};
#endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */

Wyświetl plik

@ -7,8 +7,6 @@
#include "esp_netif.h"
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
#include "lwip/dns.h"
#include "netif/ppp/pppapi.h"
#include "netif/ppp/pppos.h"
@ -325,5 +323,3 @@ esp_err_t esp_netif_ppp_get_params(esp_netif_t *netif, esp_netif_ppp_config_t *c
config->ppp_error_event_enabled = obj->ppp_error_event_enabled;
return ESP_OK;
}
#endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */

Wyświetl plik

@ -6,6 +6,7 @@ from pytest_embedded import Dut
@pytest.mark.esp32s2
@pytest.mark.esp32c3
@pytest.mark.generic
def test_esp_netif(dut: Dut) -> None:
dut.expect_unity_test_output()

Wyświetl plik

@ -0,0 +1 @@
idf_component_register(REQUIRES lwip)

Wyświetl plik

@ -0,0 +1,20 @@
# ESP-NETIF stack component
This component is a direct dependency of ESP-NETIF and it defines a required dependency on lwIP.
## Purpose
Purpose of this component is to pull specific TCP/IP stack (lwIP) into the list of dependencies when using component ESP-NETIF.
By means of `esp_netif_stack` component, we can define these two
dependency scenarios:
1) Defines a required dependency on lwIP via this component (default)
2) In case a non-lwip build is required.
## Configure ESP-NETIF for building without lwIP
In order to use ESP-NETIF without lwIP (e.g. when using custom TCP/IP stack), follow these steps
* unselect `CONFIG_ESP_NETIF_TCPIP_LWIP` in `esp_netif` component configuration
* add a component `esp_netif_stack` to your private component paths
* register an empty component `idf_component_register()` in the component's CMakeLists.txt

Wyświetl plik

@ -20,12 +20,16 @@ if(CONFIG_ESP32_WIFI_ENABLED)
"src/coexist.c"
"src/mesh_event.c"
"src/smartconfig.c"
"src/smartconfig_ack.c"
"src/wifi_init.c"
"src/wifi_default.c"
"src/wifi_netif.c"
"src/wifi_default_ap.c"
"${idf_target}/esp_adapter.c")
if(CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API)
list(APPEND srcs
"src/smartconfig_ack.c")
endif()
endif()
idf_component_register(SRCS "${srcs}"

Wyświetl plik

@ -16,10 +16,8 @@
#include "esp_wifi.h"
#include "esp_event.h"
#if CONFIG_ESP_NETIF_TCPIP_LWIP
#include <string.h>
#include "lwip/sockets.h"
#include "sys/socket.h"
#include "esp_smartconfig.h"
#include "smartconfig_ack.h"
@ -231,5 +229,3 @@ void sc_send_ack_stop(void)
{
s_sc_ack_send = false;
}
#endif

Wyświetl plik

@ -11,8 +11,6 @@
#include <mbedtls/build_info.h>
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
#if !defined(MBEDTLS_NET_C)
#if defined(MBEDTLS_PLATFORM_C)
@ -427,5 +425,3 @@ void mbedtls_net_free( mbedtls_net_context *ctx )
}
#endif /* MBEDTLS_NET_C */
#endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */

Wyświetl plik

@ -8,6 +8,8 @@ The purpose of ESP-NETIF library is twofold:
ESP-IDF currently implements ESP-NETIF for the lwIP TCP/IP stack only. However, the adapter itself is TCP/IP implementation agnostic and different implementations are possible.
It is also possible to use a custom TCP/IP stack with ESP-IDF, provided it implements BSD API. For more information on building ESP-IDF without lwIP, please refer to :idf_file:`components/esp_netif_stack/README.md`.
Some ESP-NETIF API functions are intended to be called by application code, for example to get/set interface IP addresses, configure DHCP. Other functions are intended for internal ESP-IDF use by the network driver layer.
In many cases, applications do not need to call ESP-NETIF APIs directly as they are called from the default network event handlers.

Wyświetl plik

@ -9,6 +9,7 @@
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <netdb.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"

Wyświetl plik

@ -46,10 +46,12 @@ static void test_wifi_init_custom(void)
s_init_wifi_netif(&esp_netif_config);
}
#ifdef CONFIG_PPP_SUPPORT
{
esp_netif_inherent_config_t esp_netif_config = ESP_NETIF_INHERENT_DEFAULT_PPP();
s_init_wifi_netif(&esp_netif_config);
}
#endif
}
static void test_common_init_field(void)

Wyświetl plik

@ -45,10 +45,12 @@ static void test_wifi_init_custom(void)
s_init_wifi_netif(esp_netif_config);
}
#ifdef CONFIG_PPP_SUPPORT
{
esp_netif_inherent_config_t esp_netif_config = ESP_NETIF_INHERENT_DEFAULT_PPP();
s_init_wifi_netif(esp_netif_config);
}
#endif
}
static void test_common_init_field(void)

Wyświetl plik

@ -0,0 +1 @@
CONFIG_LWIP_PPP_SUPPORT=y

Wyświetl plik

@ -6,30 +6,48 @@ cmake_minimum_required(VERSION 3.16)
set(driver_components esp_eth esp_wifi openthread)
# General rules for all these tests
# * No optional dependencies
# * Forbidden dependencies are only driver components
set(forbidden_deps ${driver_components})
set(optional_deps)
# Check manually if the ESP_NETIF is configured in sdkconfig
# Note that we cannot use Kconfig values at this stage, and therefore we have to parse
# the sdkconfig manually for the relevant "config" (CONFIG_TESTAPP_COMPONENT_...),
# in case the sdkconfig doesn't exist (clean build), we choose the default.
message(STATUS "Checking if sdkconfig contains CONFIG_TESTAPP_COMPONENT related config:")
set(config_file "${CMAKE_CURRENT_SOURCE_DIR}/sdkconfig")
if(EXISTS ${config_file})
# If the config file exists, check for the non-default settings - LWIP
# If the config file exists, check for the non-default settings - LWIP or ESP-NETIF-without-LWIP
# otherwise (file missing or defalut settings) go with ESP_NETIF
file(READ ${config_file} config_file_content)
string(FIND "${config_file_content}" "CONFIG_TESTAPP_COMPONENT_LWIP=y" match)
if(NOT ${match} EQUAL -1)
set(CONFIG_IS_LWIP 1)
string(FIND "${config_file_content}" "CONFIG_TESTAPP_COMPONENT_LWIP=y" match_lwip)
string(FIND "${config_file_content}" "CONFIG_TESTAPP_COMPONENT_ESP_NETIF_WITHOUT_LWIP=y" match_netif_no_lwip)
if(NOT ${match_lwip} EQUAL -1)
set(CHECK_DEPS_FOR_LWIP 1)
elseif(NOT ${match_netif_no_lwip} EQUAL -1)
set(CHECK_DEPS_FOR_ESP_NETIF_WITHOUT_LWIP 1)
endif()
endif()
if(CONFIG_IS_LWIP)
message(STATUS "CONFIG_TESTAPP_COMPONENT_ESP_LWIP")
if(CHECK_DEPS_FOR)
message(STATUS "CONFIG_TESTAPP_COMPONENT_LWIP")
set(component_under_test lwip)
set(expected_build_components lwip)
elseif(CHECK_DEPS_FOR_ESP_NETIF_WITHOUT_LWIP)
message(STATUS "CONFIG_TESTAPP_COMPONENT_ESP_NETIF_WITHOUT_LWIP")
set(component_under_test esp_netif)
set(expected_build_components esp_netif)
list(APPEND optional_deps mbedtls)
list(APPEND forbidden_deps lwip) # lwip mustn't be pulled in, in "esp-netif without lwip" setup
list(APPEND EXTRA_COMPONENT_DIRS "esp_netif_stack")
else()
message(STATUS "CONFIG_TESTAPP_COMPONENT_ESP_NETIF")
set(component_under_test esp_netif)
set(expected_build_components esp_netif lwip)
endif()
set(COMPONENTS ${component_under_test} main)
set(COMPONENTS ${component_under_test} main ${optional_deps})
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
@ -45,8 +63,8 @@ foreach(comp ${build_components})
message(STATUS "${comp}")
endforeach()
# Check for all driver components, these shall not be included
foreach(comp ${driver_components})
# Check for all the components, these shall not be included
foreach(comp ${forbidden_deps})
if(${comp} IN_LIST build_components)
message(FATAL_ERROR "Component ${comp} shall not be included when building only ${component_under_test}")
else()

Wyświetl plik

@ -5,6 +5,8 @@
This test application checks the list of components included into the build when:
* `esp_netif` component is added to the build.
- with default network stack, i.e. `lwip`
- without lwip using empty `esp-netif-stack` component
* `lwip` component is added to the build.
The test checks that driver components are not included in the build
@ -17,12 +19,12 @@ The test checks that driver components are not included in the build
# Troubleshooting
If you get a build error in this example, please check there's no dependency from the tested component (either `esp_netif` or `lwip`) to any defined driver component.
If you get a build error in this example, please check there's no dependency from the tested component (either `esp_netif` or `lwip`) to any defined component listed in `${forbidden_deps}`, that must not be included.
Please open the project `CMakeLists.txt` to view the expected dependencies and driver's components that must not be included in the list:
* CMake variable `driver_components` contains list of driver's components
* CMake variable `expected_build_components` contains list expected dependecies
* CMake variable `forbidden_deps` contains list of components that must not be included.
* CMake variable `expected_build_components` contains list expected dependencies
Note that this project creates `component_deps.dot`, a simpified dependecy graph that could be used to display and troubleshoot component dependencies.
Note that this project creates `component_deps.dot`, a simplified dependency graph that could be used to display and troubleshoot component dependencies.
Note that this test is executed for one target only in CI (ESP32), but shall work correctly for all IDF supported targets.

Wyświetl plik

@ -0,0 +1 @@
idf_component_register()

Wyświetl plik

@ -11,6 +11,10 @@ menu "TestApp Configuration"
config TESTAPP_COMPONENT_LWIP
bool "lwip"
config TESTAPP_COMPONENT_ESP_NETIF_WITHOUT_LWIP
bool "esp_netif without lwip"
depends on ESP_NETIF_LOOPBACK
endchoice
endmenu

Wyświetl plik

@ -0,0 +1,2 @@
CONFIG_TESTAPP_COMPONENT_ESP_NETIF_WITHOUT_LWIP=y
CONFIG_ESP_NETIF_LOOPBACK=y