Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp32: Add initial support to Bluetooth Low Energy #4509

Merged
merged 1 commit into from Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -1170,6 +1182,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 simultaneous connections"
range 1 3
default 1

endmenu # BLE Configuration

menu "Real-Time Timer"
depends on ESP32_RT_TIMER

Expand Down
7 changes: 6 additions & 1 deletion arch/xtensa/src/esp32/Make.defs
Expand Up @@ -231,7 +231,12 @@ 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 -lespnow -lphy -lwpa_supplicant

ifeq ($(CONFIG_ESP32_BLE),y)
CHIP_CSRCS += esp32_ble_adapter.c esp32_ble.c
EXTRA_LIBS += -lbtdm_app -lcoexist
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 = (void *)HEAP_REGION0_START;
size = (size_t)(HEAP_REGION0_END - HEAP_REGION0_START);
umm_addregion(start, size);
Expand Down