mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
pkg/esp32_sdk: add ESP32 SDK without libraries as package
The vendor binary libraries of ESP-IDF are provided as a separate GIT repository. These libraries are defined as separate package for two reasons: 1. RIOT packages don't support to clone GIT repositories recursively; 2. ESP-IDF pulls a lot of other GIT repositories that are not needed when it is cloned recursively.
This commit is contained in:
parent
7addf3ae5b
commit
d6c2926933
@ -18,6 +18,7 @@ config CPU_FAM_ESP32
|
||||
select HAS_ESP_WIFI_ENTERPRISE
|
||||
select HAS_PERIPH_ADC_CTRL
|
||||
|
||||
select PACKAGE_ESP32_SDK 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
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
include $(RIOTCPU)/esp_common/Makefile.dep
|
||||
|
||||
USEPKG += esp32_sdk
|
||||
USEMODULE += esp_idf_driver
|
||||
USEMODULE += esp_idf_esp32
|
||||
USEMODULE += esp_idf_soc
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -17,6 +17,7 @@ rsource "driver_bme680/Kconfig"
|
||||
rsource "driver_sx126x/Kconfig"
|
||||
rsource "elk/Kconfig"
|
||||
rsource "emlearn/Kconfig"
|
||||
rsource "esp32_sdk/Kconfig"
|
||||
rsource "esp8266_sdk/Kconfig"
|
||||
rsource "fff/Kconfig"
|
||||
rsource "gecko_sdk/Kconfig"
|
||||
|
||||
13
pkg/esp32_sdk/Kconfig
Normal file
13
pkg/esp32_sdk/Kconfig
Normal file
@ -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
|
||||
32
pkg/esp32_sdk/Makefile
Normal file
32
pkg/esp32_sdk/Makefile
Normal file
@ -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)
|
||||
2
pkg/esp32_sdk/Makefile.dep
Normal file
2
pkg/esp32_sdk/Makefile.dep
Normal file
@ -0,0 +1,2 @@
|
||||
# This package can only be used with the ESP32 CPU
|
||||
FEATURES_REQUIRED += arch_esp32
|
||||
23
pkg/esp32_sdk/Makefile.include
Normal file
23
pkg/esp32_sdk/Makefile.include
Normal file
@ -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)
|
||||
6
pkg/esp32_sdk/doc.txt
Normal file
6
pkg/esp32_sdk/doc.txt
Normal file
@ -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
|
||||
*/
|
||||
Loading…
x
Reference in New Issue
Block a user