Skip to content

Commit

Permalink
esp32: Add initial support to Bluetooth Low Energy
Browse files Browse the repository at this point in the history
  • Loading branch information
acassis committed Sep 14, 2021
1 parent 41e1696 commit dabcbbb
Show file tree
Hide file tree
Showing 16 changed files with 3,785 additions and 8 deletions.
2 changes: 1 addition & 1 deletion arch/xtensa/include/esp32/irq.h
Expand Up @@ -396,7 +396,7 @@

#define ESP32_NCPUINTS 32
#define ESP32_CPUINT_MAX (ESP32_NCPUINTS - 1)
#define ESP32_CPUINT_PERIPHSET 0xdffe773f
#define ESP32_CPUINT_PERIPHSET 0xdffe741f
#define ESP32_CPUINT_INTERNALSET 0x200188c0

/* Priority 1: 0-10, 12-13, 17-18 (15)
Expand Down
41 changes: 40 additions & 1 deletion arch/xtensa/src/esp32/Kconfig
Expand Up @@ -509,6 +509,13 @@ config ESP32_WIRELESS
---help---
Enable Wireless support

config ESP32_BLE
bool "BLE"
default n
select ESP32_WIRELESS
---help---
Enable BLE support

config ESP32_I2C0
bool "I2C 0"
default n
Expand All @@ -525,11 +532,16 @@ config ESP32_AES_ACCELERATOR

endmenu # ESP32 Peripheral Selection

menuconfig ESP32_WIFI_BT_COEXIST
bool "Wi-Fi and BT coexist"
default n
depends on ESP32_WIRELESS && ESP32_BLE

menu "Memory Configuration"

config ESP32_BT_RESERVE_DRAM
int "Reserved BT DRAM"
default 0
default 65536

config ESP32_TRACEMEM_RESERVE_DRAM
int "Reserved trace memory DRAM"
Expand Down Expand Up @@ -1162,6 +1174,33 @@ endchoice

endmenu # ESP32_WIRELESS

menu "BLE Configuration"
depends on ESP32_BLE

config ESP32_BLE_PKTBUF_NUM
int "BLE netcard packet buffer number per netcard"
default 16

config ESP32_BLE_TTY_NAME
string "BLE TTY device name"
default "/dev/ttyHCI0"
depends on UART_BTH4

config ESP32_BLE_TASK_STACK_SIZE
int "Controller task stack size"
default 4096

config ESP32_BLE_TASK_PRIORITY
int "Controller task priority"
default 110

config ESP32_BLE_MAX_CONN
int "Maximum BLE simultaneos connections"
range 1 3
default 1

endmenu # BLE Configuration

menu "Real-Time Timer"
depends on ESP32_RT_TIMER

Expand Down
8 changes: 7 additions & 1 deletion arch/xtensa/src/esp32/Make.defs
Expand Up @@ -229,7 +229,13 @@ INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wire
CHIP_CSRCS += esp32_wlan.c esp32_wifi_utils.c esp32_wifi_adapter.c

EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)libs$(DELIM)esp32
EXTRA_LIBS += -lcore -lrtc -lnet80211 -lpp -lsmartconfig -lcoexist -lespnow -lphy -lwpa_supplicant
#EXTRA_LIBS += -lcore -lrtc -lnet80211 -lpp -lsmartconfig -lcoexist -lespnow -lphy -lwpa_supplicant
EXTRA_LIBS += -lcore -lrtc -lnet80211 -lpp -lsmartconfig -lespnow -lphy -lwpa_supplicant

ifeq ($(CONFIG_ESP32_BLE),y)
CHIP_CSRCS += esp32_ble_adapter.c esp32_ble.c
EXTRA_LIBS += -lbtdm_app -lrtc -lcoexist #-lbtbb
endif

# Due to some Wi-Fi related libraries, the option is need to avoid linking too much
# unused functions.
Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/src/esp32/esp32_allocateheap.c
Expand Up @@ -133,7 +133,7 @@ void xtensa_add_region(void)
#endif
#endif

#ifndef CONFIG_ESP32_QEMU_IMAGE
#if !defined(CONFIG_ESP32_QEMU_IMAGE) && !defined(CONFIG_ESP32_BLE)
start = (FAR void *)HEAP_REGION0_START;
size = (size_t)(HEAP_REGION0_END - HEAP_REGION0_START);
umm_addregion(start, size);
Expand Down

0 comments on commit dabcbbb

Please sign in to comment.