diff --git a/cpu/esp32/Kconfig b/cpu/esp32/Kconfig index ff8262f4e8..3f6bbd09c6 100644 --- a/cpu/esp32/Kconfig +++ b/cpu/esp32/Kconfig @@ -18,6 +18,8 @@ config CPU_FAM_ESP32 select HAS_ESP_WIFI_ENTERPRISE select HAS_PERIPH_ADC_CTRL + select PACKAGE_ESP32_SDK if TEST_KCONFIG + select PACKAGE_ESP32_SDK_LIBS if TEST_KCONFIG select MODULE_PERIPH_RTT if HAS_PERIPH_RTT && MODULE_PM_LAYERED select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC select MODULE_PS if MODULE_SHELL diff --git a/cpu/esp32/Makefile.dep b/cpu/esp32/Makefile.dep index 3509e734c5..204e240c7b 100644 --- a/cpu/esp32/Makefile.dep +++ b/cpu/esp32/Makefile.dep @@ -2,6 +2,9 @@ include $(RIOTCPU)/esp_common/Makefile.dep +USEPKG += esp32_sdk +USEPKG += esp32_sdk_libs + USEMODULE += esp_idf_driver USEMODULE += esp_idf_esp32 USEMODULE += esp_idf_soc diff --git a/cpu/esp32/Makefile.include b/cpu/esp32/Makefile.include index 0901260925..1c5d66e41d 100644 --- a/cpu/esp32/Makefile.include +++ b/cpu/esp32/Makefile.include @@ -1,12 +1,3 @@ -# check some environment variables first -ifndef ESP32_SDK_DIR - $(info ESP32_SDK_DIR should be defined as /path/to/esp-idf directory) - $(info ESP32_SDK_DIR is set by default to /opt/esp/esp-idf) - export ESP32_SDK_DIR=/opt/esp/esp-idf -endif - -ESP_SDK_DIR = $(ESP32_SDK_DIR) - # ESP32 specific flashing options FLASH_CHIP = esp32 FLASH_MODE ?= dout @@ -35,17 +26,10 @@ INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/esp32 INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/heap INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/spi_flash INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/tcpip_adapter -INCLUDES += -I$(ESP32_SDK_DIR)/components/ -INCLUDES += -I$(ESP32_SDK_DIR)/components/driver/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/esp32/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/heap/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/esp32/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/include INCLUDES += -I$(RIOTCPU)/$(CPU) ifneq (,$(filter esp_eth,$(USEMODULE))) INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/ethernet - INCLUDES += -I$(ESP32_SDK_DIR)/components/ethernet/include endif CFLAGS += -DSDK_NOT_USED -DCONFIG_FREERTOS_UNICORE=1 -DESP_PLATFORM diff --git a/cpu/esp32/doc.txt b/cpu/esp32/doc.txt index a1b812da58..066f4023c9 100644 --- a/cpu/esp32/doc.txt +++ b/cpu/esp32/doc.txt @@ -408,31 +408,13 @@ export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin [Back to table of contents](#esp32_toc) -### Installation of ESP-IDF (Espressif IoT Development Framework) {#esp32_installation_of_esp_idf} +### ESP-IDF (Espressif IoT Development Framework) {#esp32_installation_of_esp_idf} -ESP-IDF, the official SDK from Espressif, can be downloaded and installed as GIT repository. +RIOT-OS uses the ESP-IDF, the official SDK from Espressif, as part of the +build. It is downloaded as a package at build-time and there is no need to +install it separately. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -cd $HOME/esp -git clone https://github.com/espressif/esp-idf.git -cd esp-idf -git checkout f198339ec09e90666150672884535802304d23ec -git submodule init -git submodule update -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -@note Please take care to checkout correct branches which were used for the port. Newer versions - might also work but were not tested. - -Since we only use a few header files, ESP-IDF does not need to be compiled in any way. To use the -installed ESP-IDF, just set the variable `ESP32_SDK_DIR` accordingly. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -export ESP32_SDK_DIR=$HOME/esp/esp-idf -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -[Back to table of contents](#esp32_toc) - -### Installation of esptool.py (ESP flash programmer tool) {#esp32_installation_of_esptool} +### Installation of `esptool.py` (ESP flash programmer tool) {#esp32_installation_of_esptool} The RIOT port does not work with the `esptool.py` ESP flasher program available on [GitHub](https://github.com/espressif/esptool) or diff --git a/cpu/esp32/include/sdk_conf.h b/cpu/esp32/include/sdk_conf.h index 9686b51461..5c3ea3e0ee 100644 --- a/cpu/esp32/include/sdk_conf.h +++ b/cpu/esp32/include/sdk_conf.h @@ -28,6 +28,15 @@ extern "C" { #endif +/** + * @brief SDK version number + * + * Determined with `git describe --tags` in `$ESP32_SDK_DIR` + */ +#if !defined(IDF_VER) || DOXYGEN +#include "esp32_idf_version.h" +#endif + /** * @name Clock configuration * @{ diff --git a/cpu/esp32/startup.c b/cpu/esp32/startup.c index 11d5421b86..8dc69e1b51 100644 --- a/cpu/esp32/startup.c +++ b/cpu/esp32/startup.c @@ -156,6 +156,9 @@ NORETURN void IRAM call_start_cpu0 (void) ets_printf("%02x", cpu_id[i]); } ets_printf("\n"); + + extern char* esp_get_idf_version(void); + LOG_STARTUP("ESP-IDF SDK Version %s\n\n", esp_get_idf_version()); #endif if (reset_reason == DEEPSLEEP_RESET) { diff --git a/cpu/esp32/vendor/esp-idf/esp_funcs.c b/cpu/esp32/vendor/esp-idf/esp_funcs.c index 303bed26b3..81ce4f5d46 100644 --- a/cpu/esp32/vendor/esp-idf/esp_funcs.c +++ b/cpu/esp32/vendor/esp-idf/esp_funcs.c @@ -482,6 +482,11 @@ void IRAM_ATTR esp_restart_noos(void) } } +const char* esp_get_idf_version(void) +{ + return IDF_VER; +} + /* * source: /path/to/esp-idf/components/wpa_supplicant/port/os_xtensa.c */ diff --git a/cpu/esp32/vendor/esp-idf/wpa_supplicant/port/Makefile b/cpu/esp32/vendor/esp-idf/wpa_supplicant/port/Makefile index 4b3204e6a3..16e355bce5 100644 --- a/cpu/esp32/vendor/esp-idf/wpa_supplicant/port/Makefile +++ b/cpu/esp32/vendor/esp-idf/wpa_supplicant/port/Makefile @@ -4,13 +4,13 @@ include $(RIOTBASE)/Makefile.base # we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto # is found first -INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include +PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include +PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include CFLAGS += -D__ets__ include $(RIOTCPU)/$(CPU)/Makefile.include -INCLUDES += -I$(RIOTBASE)/core/include -INCLUDES += -I$(RIOTBASE)/drivers/include -INCLUDES += -I$(RIOTCPU)/$(CPU)/include +# This converts INCLUDES to a simply evaluated variable instead of a recursively +# one but only for this module. +INCLUDES := $(PRE_INCLUDES) $(INCLUDES) diff --git a/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/crypto/Makefile b/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/crypto/Makefile index 7d79826743..2f695b58fa 100644 --- a/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/crypto/Makefile +++ b/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/crypto/Makefile @@ -4,15 +4,16 @@ include $(RIOTBASE)/Makefile.base # we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto # is found first -INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include +PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include +PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1 include $(RIOTCPU)/$(CPU)/Makefile.include -INCLUDES += -I$(RIOTBASE)/core/include -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log -INCLUDES += -I$(RIOTCPU)/$(CPU)/include +# This converts INCLUDES to a simply evaluated variable instead of a recursively +# one but only for this module. +INCLUDES := $(PRE_INCLUDES) $(INCLUDES) diff --git a/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/eap_peer/Makefile b/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/eap_peer/Makefile index 08b06f799f..0a283c17b5 100644 --- a/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/eap_peer/Makefile +++ b/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/eap_peer/Makefile @@ -4,16 +4,17 @@ include $(RIOTBASE)/Makefile.base # we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto # is found first -INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include +PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include +PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1 CFLAGS += -DEAP_PEER_METHOD -DEAP_TLS -DEAP_PEAP -DEAP_TTLS -DEAP_MSCHAPv2 -DUSE_WPA2_TASK include $(RIOTCPU)/$(CPU)/Makefile.include -INCLUDES += -I$(RIOTBASE)/core/include -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log -INCLUDES += -I$(RIOTCPU)/$(CPU)/include +# This converts INCLUDES to a simply evaluated variable instead of a recursively +# one but only for this module. +INCLUDES := $(PRE_INCLUDES) $(INCLUDES) diff --git a/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/tls/Makefile b/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/tls/Makefile index 2cfbec160b..eb9e4bffeb 100644 --- a/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/tls/Makefile +++ b/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/tls/Makefile @@ -4,15 +4,16 @@ include $(RIOTBASE)/Makefile.base # we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto # is found first -INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include +PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include +PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1 include $(RIOTCPU)/$(CPU)/Makefile.include -INCLUDES += -I$(RIOTBASE)/core/include -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log -INCLUDES += -I$(RIOTCPU)/$(CPU)/include +# This converts INCLUDES to a simply evaluated variable instead of a recursively +# one but only for this module. +INCLUDES := $(PRE_INCLUDES) $(INCLUDES) diff --git a/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/utils/Makefile b/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/utils/Makefile index 589e299ab7..6056f6e58a 100644 --- a/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/utils/Makefile +++ b/cpu/esp32/vendor/esp-idf/wpa_supplicant/src/wpa2/utils/Makefile @@ -4,15 +4,16 @@ include $(RIOTBASE)/Makefile.base # we have to do it in that way to avoid that $(RIOTBASE)/sys/include/crypto # is found first -INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include -INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/include/wpa +PRE_INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include +PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/include +PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/wpa_supplicant/port/include CFLAGS += -D__ets__ -DESPRESSIF_USE -DESP32_IDF_CODE=1 include $(RIOTCPU)/$(CPU)/Makefile.include -INCLUDES += -I$(RIOTBASE)/core/include -INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/log -INCLUDES += -I$(RIOTCPU)/$(CPU)/include +# This converts INCLUDES to a simply evaluated variable instead of a recursively +# one but only for this module. +INCLUDES := $(PRE_INCLUDES) $(INCLUDES) diff --git a/cpu/esp_common/Makefile.include b/cpu/esp_common/Makefile.include index 7b7987525c..81da7f73e2 100644 --- a/cpu/esp_common/Makefile.include +++ b/cpu/esp_common/Makefile.include @@ -81,11 +81,11 @@ CFLAGS += $(if $(findstring dout,$(FLASH_MODE)),-DFLASH_MODE_DOUT=1) ARCHIVES += -lhal -lg -lc LINKFLAGS += $(CFLAGS_OPT) $(CFLAGS_DBG) -ifneq ($(CPU),esp8266) +#ifneq ($(CPU),esp8266) # esp8266 flags are added by the SDK pkg in pkg/esp8266_sdk -LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU) -LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)/lib -endif +#LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU) +#LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)/lib +#endif LINKFLAGS += -nostdlib -Wl,-gc-sections -Wl,-static # use the wrapper functions for calloc to add correct overflow detection missing diff --git a/pkg/Kconfig b/pkg/Kconfig index 52c58e7806..f396515be3 100644 --- a/pkg/Kconfig +++ b/pkg/Kconfig @@ -17,6 +17,8 @@ rsource "driver_bme680/Kconfig" rsource "driver_sx126x/Kconfig" rsource "elk/Kconfig" rsource "emlearn/Kconfig" +rsource "esp32_sdk/Kconfig" +rsource "esp32_sdk_libs/Kconfig" rsource "esp8266_sdk/Kconfig" rsource "fff/Kconfig" rsource "gecko_sdk/Kconfig" diff --git a/pkg/esp32_sdk/Kconfig b/pkg/esp32_sdk/Kconfig new file mode 100644 index 0000000000..8b46b88614 --- /dev/null +++ b/pkg/esp32_sdk/Kconfig @@ -0,0 +1,13 @@ +# Copyright (c) 2021 Gunar Schorcht +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +config PACKAGE_ESP32_SDK + bool "ESP32 SDK for the ESP32 MCU support" + depends on TEST_KCONFIG + depends on HAS_ARCH_ESP32 + help + Vendor SDK without libraries for ESP32 MCU support by Espressif diff --git a/pkg/esp32_sdk/Makefile b/pkg/esp32_sdk/Makefile new file mode 100644 index 0000000000..0d0c813b5d --- /dev/null +++ b/pkg/esp32_sdk/Makefile @@ -0,0 +1,32 @@ +PKG_NAME=esp32_sdk +PKG_URL=https://github.com/espressif/esp-idf +# This is a version in the v3.1 beta1 release branch +PKG_VERSION=f198339ec09e90666150672884535802304d23ec +PKG_LICENSE=Apache-2.0 + +include $(RIOTBASE)/pkg/pkg.mk + +# This directory is shared across all apps since there's no need to replicate +# these libraries on each app. +ESP32_SDK_BUILD_DIR = $(PKG_SOURCE_DIR)/build-libs +ESP32_SDK_VER_FILE = $(PKG_SOURCE_DIR)/components/esp32_idf_version.h +ESP32_SDK_VER_CMD = $(shell git -C $(PKG_SOURCE_DIR) describe --tags $(PKG_VERSION)) + +# We need to place all binary libraries shipped with the SDK in a common +# directory. +ESP32_SDK_COMPONENT_LIBS = libhal.a + +ESP32_SDK_LIBS = $(addprefix $(ESP32_SDK_BUILD_DIR)/, $(ESP32_SDK_COMPONENT_LIBS)) + +all: $(ESP32_SDK_LIBS) $(ESP32_SDK_VER_FILE) + +$(ESP32_SDK_BUILD_DIR): + $(Q)mkdir -p $(ESP32_SDK_BUILD_DIR) + +# Set the SDK version from the SDK hash/tag. For example "v3.1-51-g913a06a9". +$(ESP32_SDK_VER_FILE): + $(Q)echo "#define IDF_VER \"$(ESP32_SDK_VER_CMD)\"" > $@ + +$(ESP32_SDK_BUILD_DIR)/lib%.a: \ + $(PKG_SOURCE_DIR)/components/esp32/lib%.a | $(ESP32_SDK_BUILD_DIR) + $(Q)cp $? $(ESP32_SDK_BUILD_DIR) diff --git a/pkg/esp32_sdk/Makefile.dep b/pkg/esp32_sdk/Makefile.dep new file mode 100644 index 0000000000..607e8707ca --- /dev/null +++ b/pkg/esp32_sdk/Makefile.dep @@ -0,0 +1,2 @@ +# This package can only be used with the ESP32 CPU +FEATURES_REQUIRED += arch_esp32 diff --git a/pkg/esp32_sdk/Makefile.include b/pkg/esp32_sdk/Makefile.include new file mode 100644 index 0000000000..35465d6e59 --- /dev/null +++ b/pkg/esp32_sdk/Makefile.include @@ -0,0 +1,23 @@ +# Directory with the SDK source checkout. Some modules in the cpu/esp32 use +# internal parts of the SDK and for that they need access to the +# ESP32_SDK_DIR path. +export ESP32_SDK_DIR = $(PKGDIRBASE)/esp32_sdk + +# Directory where we built the modified libraries and headers. +ESP32_SDK_BUILD_DIR ?= $(ESP32_SDK_DIR)/build-libs + +INCLUDES += -I$(ESP32_SDK_DIR)/components +INCLUDES += -I$(ESP32_SDK_DIR)/components/driver/include +INCLUDES += -I$(ESP32_SDK_DIR)/components/esp32/include +INCLUDES += -I$(ESP32_SDK_DIR)/components/heap/include +INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/esp32/include +INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/include + +PSEUDOMODULES += esp32_sdk + +ifneq (,$(filter esp_eth,$(USEMODULE))) + INCLUDES += -I$(ESP32_SDK_DIR)/components/ethernet/include +endif + +# Modified binary libraries are built here in the Makefile. +LINKFLAGS += -L$(ESP32_SDK_BUILD_DIR) diff --git a/pkg/esp32_sdk/doc.txt b/pkg/esp32_sdk/doc.txt new file mode 100644 index 0000000000..ea60d8e35d --- /dev/null +++ b/pkg/esp32_sdk/doc.txt @@ -0,0 +1,6 @@ +/** + * @defgroup pkg_esp32_sdk ESP32 SDK for the ESP32 MCU support + * @ingroup pkg + * @brief Vendor SDK without libraries for ESP32 MCU support by Espressif + * @see https://github.com/espressif/esp-idf + */ diff --git a/pkg/esp32_sdk_libs/Kconfig b/pkg/esp32_sdk_libs/Kconfig new file mode 100644 index 0000000000..fb210b0aec --- /dev/null +++ b/pkg/esp32_sdk_libs/Kconfig @@ -0,0 +1,13 @@ +# Copyright (c) 2021 Gunar Schorcht +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +config PACKAGE_ESP32_SDK_LIBS + bool "ESP32 SDK libraries for the ESP32 MCU support" + depends on TEST_KCONFIG + depends on HAS_ARCH_ESP32 + help + Vendor SDK libraries for ESP32 MCU support by Espressif diff --git a/pkg/esp32_sdk_libs/Makefile b/pkg/esp32_sdk_libs/Makefile new file mode 100644 index 0000000000..56760a4e25 --- /dev/null +++ b/pkg/esp32_sdk_libs/Makefile @@ -0,0 +1,39 @@ +PKG_NAME=esp32_sdk_libs +PKG_URL=https://github.com/espressif/esp32-wifi-lib +# This is a version in the v3.1 beta1 release branch +PKG_VERSION=534a9b14101af90231d40a4f94924d67bc848d5f +PKG_LICENSE=Apache-2.0 + +include $(RIOTBASE)/pkg/pkg.mk + +ESP32_SDK_DIR = $(PKGDIRBASE)/esp32_sdk + +# Directory where we place the libraries and headers. +ESP32_SDK_BUILD_DIR = $(ESP32_SDK_DIR)/build-libs + +# We need to place all binary libraries shipped with the SDK in a common +# directory. +ESP32_SDK_COMPONENT_LIBS = \ + libcoexist.a \ + libcore.a \ + libespnow.a \ + libmesh.a \ + libnet80211.a \ + libphy.a \ + libpp.a \ + librtc.a \ + libsmartconfig.a \ + libwpa.a \ + libwpa2.a \ + libwps.a + +ESP32_SDK_LIBS = $(addprefix $(ESP32_SDK_BUILD_DIR)/, $(ESP32_SDK_COMPONENT_LIBS)) + +all: $(ESP32_SDK_LIBS) + +$(ESP32_SDK_BUILD_DIR): + $(Q)mkdir -p $(ESP32_SDK_BUILD_DIR) + +$(ESP32_SDK_BUILD_DIR)/lib%.a: \ + $(PKG_SOURCE_DIR)/lib%.a | $(ESP32_SDK_BUILD_DIR) + $(Q)cp $? $(ESP32_SDK_BUILD_DIR) diff --git a/pkg/esp32_sdk_libs/Makefile.dep b/pkg/esp32_sdk_libs/Makefile.dep new file mode 100644 index 0000000000..607e8707ca --- /dev/null +++ b/pkg/esp32_sdk_libs/Makefile.dep @@ -0,0 +1,2 @@ +# This package can only be used with the ESP32 CPU +FEATURES_REQUIRED += arch_esp32 diff --git a/pkg/esp32_sdk_libs/Makefile.include b/pkg/esp32_sdk_libs/Makefile.include new file mode 100644 index 0000000000..911e72ae06 --- /dev/null +++ b/pkg/esp32_sdk_libs/Makefile.include @@ -0,0 +1,13 @@ +# Directory with the SDK source checkout. Some modules in the cpu/esp32 use +# internal parts of the SDK and for that they need access to the +# ESP32_SDK_DIR path. +export ESP32_SDK_DIR = $(PKGDIRBASE)/esp32_sdk + +# Directory where we built the modified libraries and headers. +ESP32_SDK_BUILD_DIR ?= $(ESP32_SDK_DIR)/build-libs + +# Modified binary libraries are built here in the Makefile. +LINKFLAGS += -L$(ESP32_SDK_BUILD_DIR) + +# esp32_sdk_libs doesn't generate any .a +PSEUDOMODULES += esp32_sdk_libs diff --git a/pkg/esp32_sdk_libs/doc.txt b/pkg/esp32_sdk_libs/doc.txt new file mode 100644 index 0000000000..cc10b30871 --- /dev/null +++ b/pkg/esp32_sdk_libs/doc.txt @@ -0,0 +1,6 @@ +/** + * @defgroup pkg_esp32_sdk_libs ESP32 SDK libraries for the ESP32 MCU support + * @ingroup pkg_esp32_sdk + * @brief Vendor SDK libraries for ESP32 MCU support by Espressif + * @see https://github.com/espressif/esp32-wifi-lib + */ diff --git a/pkg/esp8266_sdk/Kconfig b/pkg/esp8266_sdk/Kconfig index c813f19666..234dbb4f21 100644 --- a/pkg/esp8266_sdk/Kconfig +++ b/pkg/esp8266_sdk/Kconfig @@ -6,6 +6,8 @@ # config PACKAGE_ESP8266_SDK - bool "Vendor library for the ESP8266 MCU RTOS support" + bool "ESP8266 RTOS SDK for the ESP8266 MCU support" depends on TEST_KCONFIG depends on HAS_ARCH_ESP8266 + help + Vendor SDK with libraries for ESP8266 MCU support by Espressif diff --git a/pkg/esp8266_sdk/doc.txt b/pkg/esp8266_sdk/doc.txt index 3f1789906c..dab46dc8e0 100644 --- a/pkg/esp8266_sdk/doc.txt +++ b/pkg/esp8266_sdk/doc.txt @@ -1,6 +1,6 @@ /** - * @defgroup pkg_esp8266_sdk Vendor library for the ESP8266 MCU RTOS support + * @defgroup pkg_esp8266_sdk ESP8266 RTOS SDK for the ESP8266 MCU support * @ingroup pkg - * @brief Vendor library for the ESP8266 MCU RTOS support by Espressif + * @brief Vendor SDK with libraries for ESP8266 MCU support by Espressif * @see https://github.com/espressif/ESP8266_RTOS_SDK */