refactor(linux): excluded all non-Linux components from build

* All components which won't build (yet) on Linux are excluded.
  This enables switching to Linux in an application without
  explicitly setting COMPONENTS to main in the main
  CMakeLists.txt.
* ESP Timer provides headers for Linux now
* automatically disabling LWIP in Kconfig if it is not available

doc(linux): brought section
  "Component Linux/Mock Support Overview" up to date
This commit is contained in:
Jakob Hasse 2023-08-28 14:02:08 +08:00
parent 4f3e05f6a8
commit 548022fbe6
51 changed files with 295 additions and 14 deletions

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs
"app_trace.c"
"app_trace_util.c"

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_component_register(SRCS "esp_ota_ops.c" "esp_ota_app_desc.c"
INCLUDE_DIRS "include"
REQUIRES partition_table bootloader_support esp_app_format esp_bootloader_format esp_partition

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_component_register(PRIV_REQUIRES partition_table esptool_py)
# Do not generate flash file when building bootloader or is in early expansion of the build

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs
"src/bootloader_common.c"
"src/bootloader_common_loader.c"

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
# API headers that are used in the docs are also compiled
# even if CONFIG_BT_ENABLED=n as long as CONFIG_IDF_DOC_BUILD=y

View File

@ -1,3 +1,10 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is currently not supported by the POSIX/Linux simulator, but we may support it in the
# future (TODO: IDF-8103)
endif()
set(argtable_srcs argtable3/arg_cmd.c
argtable3/arg_date.c
argtable3/arg_dbl.c

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not necessary on the POSIX/Linux simulator
endif()
idf_component_register(SRCS "cxx_exception_stubs.cpp"
"cxx_guards.cpp"
# Make sure that pthread is in component list

View File

@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
# Always compiled source files
set(srcs
"gpio/gpio.c"

View File

@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
if(CONFIG_EFUSE_VIRTUAL)
message(STATUS "Efuse virtual mode is enabled. If Secure boot or Flash encryption is on"
" it does not provide any security. FOR TESTING ONLY!")

View File

@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(includes "include" "interface" "${target}/include" "deprecated/include")
set(srcs "adc_cali.c"

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
if(NOT BOOTLOADER_BUILD)
set(src "esp_app_desc.c")
else()

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_component_register(SRCS "esp_bootloader_desc.c"
INCLUDE_DIRS "include")

View File

@ -1,5 +1,9 @@
idf_build_get_property(idf_target IDF_TARGET)
if(${idf_target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
if(CONFIG_ESP_COEX_SW_COEXIST_ENABLE OR CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE)
if(CONFIG_APP_NO_BLOBS)
set(link_binary_libs 0)

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_build_get_property(components_to_build BUILD_COMPONENTS)
set(srcs)

View File

@ -1,4 +1,10 @@
set(srcs "src/gdbstub.c"
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs "src/gdbstub.c"
"src/gdbstub_transport.c"
"src/packet.c")

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs "src/esp_hidd.c"
"src/esp_hidh.c"
"src/esp_hid_common.c")

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_component_register(SRCS "src/esp_https_ota.c"
INCLUDE_DIRS "include"
REQUIRES esp_http_client bootloader_support esp_app_format esp_event

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs "src/esp_lcd_common.c"
"src/esp_lcd_panel_io.c"
"src/esp_lcd_panel_io_i2c_v1.c"

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(include_dirs include)
set(priv_include_dirs proto-c src ../protocomm/proto-c)
set(srcs "src/esp_local_ctrl.c"

View File

@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(includes "include")
# Note: requires spi_flash for cache_utils, will be refactored

View File

@ -21,6 +21,7 @@ menu "ESP NETIF Adapter"
config ESP_NETIF_TCPIP_LWIP
bool "LwIP"
select ESP_NETIF_USES_TCPIP_WITH_BSD_API
depends on LWIP_ENABLE
help
lwIP is a small independent implementation of the TCP/IP protocol suite.

View File

@ -270,13 +270,13 @@ void esp_netif_free_rx_buffer(void *h, void* buffer)
esp_err_t esp_netif_transmit(esp_netif_t *esp_netif, void* data, size_t len)
{
ESP_LOGV(TAG, "Transmitting data: ptr:%p, size:%d", data, len);
ESP_LOGV(TAG, "Transmitting data: ptr:%p, size:%lu", data, (long unsigned int) len);
return (esp_netif->driver_transmit)(esp_netif->driver_handle, data, len);
}
esp_err_t esp_netif_receive(esp_netif_t *esp_netif, void *buffer, size_t len, void *eb)
{
ESP_LOGV(TAG, "Received data: ptr:%p, size:%d", buffer, len);
ESP_LOGV(TAG, "Received data: ptr:%p, size:%lu", buffer, (long unsigned int) len);
esp_netif_transmit(esp_netif, buffer, len);
if (eb) {
esp_netif_free_rx_buffer(esp_netif, eb);

View File

@ -1,5 +1,9 @@
idf_build_get_property(idf_target IDF_TARGET)
if(${idf_target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
if(IDF_TARGET STREQUAL "esp32p4")
# TODO: IDF-7460
return()

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_component_register(SRCS "pm_locks.c" "pm_trace.c" "pm_impl.c"
INCLUDE_DIRS include
PRIV_REQUIRES esp_system driver esp_timer

View File

@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(includes "include")
set(priv_requires heap spi_flash esp_mm)

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_component_register(SRCS "ringbuf.c"
INCLUDE_DIRS "include"
LDFRAGMENTS linker.lf)

View File

@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
idf_component_register(INCLUDE_DIRS include)
else()
set(srcs "src/esp_timer.c"
"src/ets_timer_legacy.c"
"src/system_time.c"
@ -20,3 +24,5 @@ idf_component_register(SRCS "${srcs}"
PRIV_INCLUDE_DIRS private_include
REQUIRES esp_common
PRIV_REQUIRES soc driver)
endif()

View File

@ -1,5 +1,10 @@
idf_build_get_property(idf_target IDF_TARGET)
if(${idf_target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
if(CONFIG_ESP_WIFI_ENABLED)
idf_build_get_property(idf_target IDF_TARGET)
if(CONFIG_APP_NO_BLOBS)
set(link_binary_libs 0)

View File

@ -1,4 +1,10 @@
set(srcs "src/core_dump_common.c"
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs "src/core_dump_common.c"
"src/core_dump_checksum.c"
"src/core_dump_flash.c"
"src/core_dump_uart.c"

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_component_register(REQUIRES bootloader PRIV_REQUIRES partition_table)
if(NOT BOOTLOADER_BUILD)

View File

@ -1,3 +1,7 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_component_register(INCLUDE_DIRS "include" "include/${target}")

View File

@ -1,4 +1,8 @@
idf_build_get_property(idf_target IDF_TARGET)
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs "")
set(include "include")

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
if(BOOTLOADER_BUILD)
# Bootloader builds need the platform_include directory (for assert.h), but nothing else
idf_component_register(INCLUDE_DIRS platform_include)

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_component_register(SRCS "nvs_sec_provider.c"
INCLUDE_DIRS include
PRIV_REQUIRES bootloader_support efuse esp_partition nvs_flash)

View File

@ -1,11 +1,17 @@
idf_build_get_property(idf_target IDF_TARGET)
if(${idf_target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
if(CONFIG_OPENTHREAD_ENABLED OR CONFIG_IDF_DOC_BUILD)
set(public_include_dirs
"include"
"openthread/include")
endif()
if(CONFIG_OPENTHREAD_ENABLED)
idf_build_get_property(idf_target IDF_TARGET)
set(private_include_dirs
"openthread/examples/platforms"

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_build_get_property(arch IDF_TARGET_ARCH)
if(NOT "${arch}" STREQUAL "xtensa")

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(include_dirs include/common
include/security
include/transports)

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
idf_component_register(SRCS "sdmmc_cmd.c"
"sdmmc_common.c"
"sdmmc_init.c"

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(TOUCH_ELEMENT_COMPATIBLE_TARGETS "esp32s2" "esp32s3")
if(IDF_TARGET IN_LIST TOUCH_ELEMENT_COMPATIBLE_TARGETS)

View File

@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs "")
set(includes "")

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs)
set(include)
set(priv_include)

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
list(APPEND sources "vfs.c"
"vfs_eventfd.c"
"vfs_uart.c"

View File

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs "src/wifi_config.c"
"src/wifi_scan.c"
"src/wifi_ctrl.c"

View File

@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs "port/os_xtensa.c"
"port/eloop.c"
"src/ap/ap_config.c"

View File

@ -82,6 +82,9 @@ Note that any "Yes" here does not necessarily mean a full implementation or mock
* - Component
- Mock
- Simulation
* - cmock
- No
- Yes
* - driver
- Yes
- No
@ -91,12 +94,27 @@ Note that any "Yes" here does not necessarily mean a full implementation or mock
* - esp_event
- Yes
- Yes
* - esp_http_client
- No
- Yes
* - esp_http_server
- No
- Yes
* - esp_https_server
- No
- Yes
* - esp_hw_support
- Yes
- Yes
* - esp_netif
- Yes
- Yes
* - esp_netif_stack
- No
- Yes
* - esp_partition
- Yes
- No
- Yes
* - esp_rom
- No
- Yes
@ -108,7 +126,10 @@ Note that any "Yes" here does not necessarily mean a full implementation or mock
- No
* - esp_tls
- Yes
- Yes
* - fatfs
- No
- Yes
* - freertos
- Yes
- Yes
@ -120,19 +141,49 @@ Note that any "Yes" here does not necessarily mean a full implementation or mock
- Yes
* - http_parser
- Yes
- Yes
* - json
- No
- Yes
* - linux
- No
- Yes
* - log
- No
- Yes
* - lwip
- Yes
- Yes
* - mbedtls
- No
- Yes
* - mqtt
- No
- Yes
* - nvs_flash
- No
- Yes
* - partition_table
- No
- Yes
* - protobuf-c
- No
- Yes
* - pthread
- No
- Yes
* - soc
- No
- Yes
* - spiffs
- No
- Yes
* - spi_flash
- Yes
- No
* - tcp_transport
- Yes
- No
* - unity
- No
- Yes

View File

@ -1,10 +1,5 @@
# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
if("${IDF_TARGET}" STREQUAL "linux")
set(COMPONENTS main)
endif()
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(simple)

View File

@ -1 +1,3 @@
CONFIG_LWIP_ENABLE=y
CONFIG_EXAMPLE_IPV4_ADDR="127.0.0.1"
CONFIG_EXAMPLE_CONNECT_LWIP_TAPIF=n

View File

@ -3,5 +3,5 @@
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(COMPONENTS main)
project(hello_world)