Skip to content
Permalink
Browse files

esp32: Enable NimBLE support on all builds (IDF 3.3 and 4.0).

This commit updates the IDFv3 version to v3.3.1, and enables the
"ubluetooth" module by default on IDFv3 builds.
  • Loading branch information
jimmo authored and dpgeorge committed Dec 16, 2019
1 parent c14ff61 commit 3032ae1155db4bd89786f715f5227967d2cb71cf
Showing with 65 additions and 11 deletions.
  1. +1 −1 .travis.yml
  2. +53 −10 ports/esp32/Makefile
  3. +1 −0 ports/esp32/boards/sdkconfig.base
  4. +10 −0 ports/esp32/boards/sdkconfig.ble
@@ -213,7 +213,7 @@ jobs:
- make ${MAKEOPTS} -C mpy-cross
# IDF v3 build
- git -C esp-idf checkout $(grep "ESPIDF_SUPHASH_V3 :=" ports/esp32/Makefile | cut -d " " -f 3)
- git -C esp-idf submodule update --init components/json/cJSON components/esp32/lib components/esptool_py/esptool components/expat/expat components/lwip/lwip components/mbedtls/mbedtls components/micro-ecc/micro-ecc components/nghttp/nghttp2
- git -C esp-idf submodule update --init components/json/cJSON components/esp32/lib components/esptool_py/esptool components/expat/expat components/lwip/lwip components/mbedtls/mbedtls components/micro-ecc/micro-ecc components/nghttp/nghttp2 components/nimble components/bt
- make ${MAKEOPTS} -C ports/esp32 submodules
- make ${MAKEOPTS} -C ports/esp32
# clean
@@ -51,8 +51,9 @@ OBJDUMP = $(CROSS_COMPILE)objdump
SDKCONFIG_COMBINED = $(BUILD)/sdkconfig.combined
SDKCONFIG_H = $(BUILD)/sdkconfig.h

# the git hash of the currently supported ESP IDF version
ESPIDF_SUPHASH_V3 := 6ccb4cf5b7d1fdddb8c2492f9cbc926abaf230df
# The git hash of the currently supported ESP IDF version.
# These correspond to v3.3.1 and v4.0-beta1.
ESPIDF_SUPHASH_V3 := 143d26aa49df524e10fb8e41a71d12e731b9b71d
ESPIDF_SUPHASH_V4 := 310beae373446ceb9a4ad9b36b5428d7fdf2705f

define print_supported_git_hash
@@ -112,15 +113,13 @@ $(info Add the xtensa toolchain to your PATH. See README.md)
$(error C compiler missing)
endif

# Support BLE by default when building with IDF 4.x.
# Support BLE by default.
# Can be explicitly disabled on the command line or board config.
ifeq ($(ESPIDF_CURHASH),$(ESPIDF_SUPHASH_V4))
MICROPY_PY_BLUETOOTH ?= 1
ifeq ($(MICROPY_PY_BLUETOOTH),1)
SDKCONFIG += boards/sdkconfig.ble
MICROPY_BLUETOOTH_NIMBLE = 1
endif
endif

# include sdkconfig to get needed configuration values
include $(SDKCONFIG)
@@ -158,6 +157,7 @@ INC_ESPCOMP += -I$(ESPCOMP)/tcpip_adapter/include
INC_ESPCOMP += -I$(ESPCOMP)/lwip/lwip/src/include
INC_ESPCOMP += -I$(ESPCOMP)/lwip/port/esp32/include
INC_ESPCOMP += -I$(ESPCOMP)/lwip/include/apps
INC_ESPCOMP += -I$(ESPCOMP)/lwip/include/apps/sntp
INC_ESPCOMP += -I$(ESPCOMP)/mbedtls/mbedtls/include
INC_ESPCOMP += -I$(ESPCOMP)/mbedtls/port/include
INC_ESPCOMP += -I$(ESPCOMP)/mdns/include
@@ -218,9 +218,28 @@ INC_ESPCOMP += -I$(ESPCOMP)/json/port/include
INC_ESPCOMP += -I$(ESPCOMP)/micro-ecc/micro-ecc
INC_ESPCOMP += -I$(ESPCOMP)/nghttp/port/include
INC_ESPCOMP += -I$(ESPCOMP)/nghttp/nghttp2/lib/includes
ifeq ($(CONFIG_NIMBLE_ENABLED),y)
INC_ESPCOMP += -I$(ESPCOMP)/bt/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/porting/nimble/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/port/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/ans/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/bas/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/gap/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/gatt/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/ias/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/lls/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/tps/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/util/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/store/ram/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/store/config/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/porting/npl/freertos/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/ext/tinycrypt/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/esp-hci/include
endif
endif

ifeq ($(ESPIDF_CURHASH),$(ESPIDF_SUPHASH_V4))
ifeq ($(MICROPY_PY_BLUETOOTH),1)
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH=1
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE=1
@@ -229,7 +248,6 @@ ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1)
CFLAGS_MOD += -DMICROPY_BLUETOOTH_NIMBLE=1
endif
endif
endif

# these flags are common to C and C++ compilation
CFLAGS_COMMON = -Os -ffunction-sections -fdata-sections -fstrict-volatile-bitfields \
@@ -421,6 +439,7 @@ ESPIDF_SOC_O = $(patsubst %.c,%.o,\
$(wildcard $(ESPCOMP)/soc/src/hal/*.c) \
)

$(BUILD)/$(ESPCOMP)/cxx/cxx_guards.o: CXXFLAGS += -Wno-error=sign-compare
ESPIDF_CXX_O = $(patsubst %.cpp,%.o,$(wildcard $(ESPCOMP)/cxx/*.cpp))

ESPIDF_PTHREAD_O = $(patsubst %.c,%.o,$(wildcard $(ESPCOMP)/pthread/*.c))
@@ -458,6 +477,7 @@ ESPIDF_APP_UPDATE_O = $(patsubst %.c,%.o,$(wildcard $(ESPCOMP)/app_update/*.c))

ESPIDF_NEWLIB_O = $(patsubst %.c,%.o,$(wildcard $(ESPCOMP)/newlib/*.c))

$(BUILD)/$(ESPCOMP)/nvs_flash/src/nvs_api.o: CXXFLAGS += -Wno-error=sign-compare
ESPIDF_NVS_FLASH_O = $(patsubst %.cpp,%.o,$(wildcard $(ESPCOMP)/nvs_flash/src/*.cpp))

ESPIDF_SMARTCONFIG_ACK_O = $(patsubst %.c,%.o,$(wildcard $(ESPCOMP)/smartconfig_ack/*.c))
@@ -546,6 +566,29 @@ ESPIDF_ETHERNET_O = $(patsubst %.c,%.o,\
$(wildcard $(ESPCOMP)/ethernet/*.c) \
$(wildcard $(ESPCOMP)/ethernet/eth_phy/*.c) \
)

ifeq ($(CONFIG_NIMBLE_ENABLED),y)
ESPIDF_BT_NIMBLE_O = $(patsubst %.c,%.o,\
$(wildcard $(ESPCOMP)/bt/*.c) \
$(wildcard $(ESPCOMP)/nimble/esp-hci/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/ext/tinycrypt/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/services/ans/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/services/bas/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/services/gap/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/services/gatt/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/services/ias/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/services/lls/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/services/tps/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/store/config/src/ble_store_config.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/store/config/src/ble_store_nvs.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/store/ram/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/host/util/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/nimble/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/porting/nimble/src/*.c) \
$(wildcard $(ESPCOMP)/nimble/nimble/porting/npl/freertos/src/*.c) \
)
endif
endif

OBJ_ESPIDF =
@@ -587,14 +630,12 @@ $(eval $(call gen_espidf_lib_rule,mbedtls,$(ESPIDF_MBEDTLS_O)))
$(eval $(call gen_espidf_lib_rule,mdns,$(ESPIDF_MDNS_O)))
$(eval $(call gen_espidf_lib_rule,wpa_supplicant,$(ESPIDF_WPA_SUPPLICANT_O)))
$(eval $(call gen_espidf_lib_rule,sdmmc,$(ESPIDF_SDMMC_O)))
$(eval $(call gen_espidf_lib_rule,bt_nimble,$(ESPIDF_BT_NIMBLE_O)))

ifeq ($(ESPIDF_CURHASH),$(ESPIDF_SUPHASH_V4))
$(eval $(call gen_espidf_lib_rule,esp_common,$(ESPIDF_ESP_COMMON_O)))
$(eval $(call gen_espidf_lib_rule,esp_event,$(ESPIDF_ESP_EVENT_O)))
$(eval $(call gen_espidf_lib_rule,esp_wifi,$(ESPIDF_ESP_WIFI_O)))
ifeq ($(CONFIG_BT_NIMBLE_ENABLED),y)
$(eval $(call gen_espidf_lib_rule,bt_nimble,$(ESPIDF_BT_NIMBLE_O)))
endif
$(eval $(call gen_espidf_lib_rule,esp_eth,$(ESPIDF_ESP_ETH_O)))
$(eval $(call gen_espidf_lib_rule,xtensa,$(ESPIDF_XTENSA_O)))
else
@@ -714,6 +755,7 @@ APP_LD_ARGS += -L$(ESPCOMP)/bt/controller/lib -lbtdm_app
APP_LD_ARGS += -L$(ESPCOMP)/esp_wifi/lib_esp32 -lcore -lmesh -lnet80211 -lphy -lrtc -lpp -lsmartconfig -lcoexist
else
APP_LD_ARGS += $(ESPCOMP)/esp32/libhal.a
APP_LD_ARGS += -L$(ESPCOMP)/bt/lib -lbtdm_app
APP_LD_ARGS += -L$(ESPCOMP)/esp32/lib -lcore -lmesh -lnet80211 -lphy -lrtc -lpp -lwpa -lsmartconfig -lcoexist -lwps -lwpa2
endif
APP_LD_ARGS += $(OBJ)
@@ -769,6 +811,7 @@ BOOTLOADER_LIB_BOOTLOADER_SUPPORT_OBJ = $(addprefix $(BUILD)/bootloader/$(ESPCOM
bootloader_support/src/bootloader_clock.o \
bootloader_support/src/bootloader_common.o \
bootloader_support/src/bootloader_flash.o \
bootloader_support/src/bootloader_flash_config.o \
bootloader_support/src/bootloader_init.o \
bootloader_support/src/bootloader_random.o \
bootloader_support/src/bootloader_utility.o \
@@ -2,6 +2,7 @@
# The following options override the defaults

CONFIG_IDF_TARGET="esp32"
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000

# Application manager
CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=y
@@ -12,3 +12,13 @@ CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4
CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=n
CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y
CONFIG_BT_NIMBLE_PINNED_TO_CORE=1

# v3.3-only (renamed in 4.0)
CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y
CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY=
CONFIG_BTDM_CONTROLLER_MODE_BTDM=
CONFIG_BLUEDROID_ENABLED=n
CONFIG_NIMBLE_ENABLED=y
CONFIG_NIMBLE_MAX_CONNECTIONS=4
CONFIG_NIMBLE_PINNED_TO_CORE_0=n
CONFIG_NIMBLE_PINNED_TO_CORE_1=y

0 comments on commit 3032ae1

Please sign in to comment.
You can’t perform that action at this time.