Merge branch 'feature/config_wifi_bt' into 'master'

Clean up WiFi & Bluetooth config options

* Splits "WiFi" configuration out from ESP32 configuration submenu to its own menu.
* Renames "BT" to "Bluetooth", enabling Bluetooth is now in this option not the ESP32 submenu.

* Also disables compiling/linking of BT stack if Bluetooth is disabled, saves some build time.

See merge request !397
This commit is contained in:
Ivan Grokhotkov 2017-01-11 18:38:30 +08:00
commit 5fbea86a9e
11 changed files with 154 additions and 220 deletions

View file

@ -1,41 +1,24 @@
menu "BT config" menuconfig BT_ENABLED
visible if MEMMAP_BT bool "Bluetooth"
config BT_ENABLED
bool
depends on ESP32_ENABLE_STACK_BT
help help
This compiles in the low-level BT stack. Select this option to enable Bluetooth stack and show the submenu with Bluetooth configuration choices.
config BTC_TASK_STACK_SIZE config BTC_TASK_STACK_SIZE
int "BT event (callback to application) task stack size" int "Bluetooth event (callback to application) task stack size"
depends on BT_ENABLED
default 3072 default 3072
help help
This select btc task stack size This select btc task stack size
config BLUEDROID_MEM_DEBUG config BLUEDROID_MEM_DEBUG
bool "Bluedroid memory debug" bool "Bluedroid memory debug"
default no depends on BT_ENABLED
default n
help help
Bluedroid memory debug Bluedroid memory debug
#config BT_BTLE
# bool "Enable BTLE"
# depends on BT_ENABLED
# help
# This compiles BTLE support
#
#config BT_BT
# bool "Enable classic BT"
# depends on BT_ENABLED
# help
# This enables classic BT support
endmenu
# Memory reserved at start of DRAM for Bluetooth stack # Memory reserved at start of DRAM for Bluetooth stack
config BT_RESERVE_DRAM config BT_RESERVE_DRAM
hex hex
default 0x10000 if MEMMAP_BT default 0x10000 if BT_ENABLED
default 0 default 0

View file

@ -1,6 +1,7 @@
# #
# Component Makefile # Component Makefile
# #
ifdef CONFIG_BT_ENABLED
COMPONENT_ADD_INCLUDEDIRS := bluedroid/bta/include \ COMPONENT_ADD_INCLUDEDIRS := bluedroid/bta/include \
bluedroid/bta/sys/include \ bluedroid/bta/sys/include \
@ -71,3 +72,5 @@ COMPONENT_SRCDIRS := bluedroid/bta/dm \
. .
COMPONENT_SUBMODULES += lib COMPONENT_SUBMODULES += lib
endif

View file

@ -7,3 +7,5 @@ COMPONENT_ADD_INCLUDEDIRS := port/include port/include/coap libcoap/include libc
COMPONENT_OBJS = libcoap/src/address.o libcoap/src/async.o libcoap/src/block.o libcoap/src/coap_time.o libcoap/src/debug.o libcoap/src/encode.o libcoap/src/hashkey.o libcoap/src/mem.o libcoap/src/net.o libcoap/src/option.o libcoap/src/pdu.o libcoap/src/resource.o libcoap/src/str.o libcoap/src/subscribe.o libcoap/src/uri.o port/coap_io_socket.o COMPONENT_OBJS = libcoap/src/address.o libcoap/src/async.o libcoap/src/block.o libcoap/src/coap_time.o libcoap/src/debug.o libcoap/src/encode.o libcoap/src/hashkey.o libcoap/src/mem.o libcoap/src/net.o libcoap/src/option.o libcoap/src/pdu.o libcoap/src/resource.o libcoap/src/str.o libcoap/src/subscribe.o libcoap/src/uri.o port/coap_io_socket.o
COMPONENT_SRCDIRS := libcoap/src libcoap port COMPONENT_SRCDIRS := libcoap/src libcoap port
COMPONENT_SUBMODULES += libcoap

View file

@ -20,41 +20,6 @@ config ESP32_DEFAULT_CPU_FREQ_MHZ
default 160 if ESP32_DEFAULT_CPU_FREQ_160 default 160 if ESP32_DEFAULT_CPU_FREQ_160
default 240 if ESP32_DEFAULT_CPU_FREQ_240 default 240 if ESP32_DEFAULT_CPU_FREQ_240
#choice ESP32_WIFI_OR_BT
# prompt "Select stack to enable (WiFi or BT)"
# default ESP32_ENABLE_WIFI
# help
# Temporarily, WiFi and BT stacks can not be used at the same time.
# Select which stack to enable.
config ESP32_ENABLE_STACK_WIFI
bool "WiFi"
select WIFI_ENABLED if ESP32_ENABLE_STACK_WIFI
config ESP32_ENABLE_STACK_BT
bool "BT"
select MEMMAP_BT if ESP32_ENABLE_STACK_BT
select BT_ENABLED if ESP32_ENABLE_STACK_BT
#config ESP32_ENABLE_STACK_NONE
# bool "None"
#endchoice
config SW_COEXIST_ENABLE
bool "Software do control of wifi/bt coexisit"
depends on ESP32_ENABLE_STACK_BT && ESP32_ENABLE_STACK_WIFI
default "n"
help
Software do something control of wifi/bt coexist. For some heavy traffic senario,
do sotware coexist, may be better.
config MEMMAP_BT
bool
depends on ESP32_ENABLE_STACK_BT
help
The Bluetooth stack uses memory that cannot be used as generic memory anymore. This
reserves the space for that within the memory map of the compiled binary.
This option is required to enable BT stack.
Temporarily, this option is not compatible with WiFi stack.
config MEMMAP_SMP config MEMMAP_SMP
bool "Reserve memory for two cores" bool "Reserve memory for two cores"
default "y" default "y"
@ -95,19 +60,10 @@ config MEMMAP_SPISRAM
depends on ESP32_NEEDS_NEW_SILICON_REV depends on ESP32_NEEDS_NEW_SILICON_REV
default "n" default "n"
help help
The ESP32 can control an external SPI SRAM chip, adding the memory it contains to the The ESP32 can control an external SPI SRAM chip, adding the memory it contains to the
main memory map. Enable this if you have this hardware and want to use it in the same main memory map. Enable this if you have this hardware and want to use it in the same
way as on-chip RAM. way as on-chip RAM.
config WIFI_ENABLED
bool
default "y"
depends on ESP32_ENABLE_STACK_WIFI
help
This compiles in the low-level WiFi stack.
Temporarily, this option is not compatible with BT stack.
config SYSTEM_EVENT_QUEUE_SIZE config SYSTEM_EVENT_QUEUE_SIZE
int "System event queue size" int "System event queue size"
default 32 default 32
@ -145,7 +101,7 @@ config NEWLIB_NANO_FORMAT
ESP32 ROM contains parts of newlib C library, including printf/scanf family ESP32 ROM contains parts of newlib C library, including printf/scanf family
of functions. These functions have been compiled with so-called "nano" of functions. These functions have been compiled with so-called "nano"
formatting option. This option doesn't support 64-bit integer formats and C99 formatting option. This option doesn't support 64-bit integer formats and C99
features, such as positional arguments. features, such as positional arguments.
For more details about "nano" formatting option, please see newlib readme file, For more details about "nano" formatting option, please see newlib readme file,
search for '--enable-newlib-nano-formatted-io': search for '--enable-newlib-nano-formatted-io':
@ -180,42 +136,42 @@ config CONSOLE_UART_NONE
endchoice endchoice
choice CONSOLE_UART_NUM choice CONSOLE_UART_NUM
prompt "UART peripheral to use for console output (0-1)" prompt "UART peripheral to use for console output (0-1)"
depends on CONSOLE_UART_CUSTOM depends on CONSOLE_UART_CUSTOM
default CONSOLE_UART_CUSTOM_NUM_0 default CONSOLE_UART_CUSTOM_NUM_0
help help
Due of a ROM bug, UART2 is not supported for console output Due of a ROM bug, UART2 is not supported for console output
via ets_printf. via ets_printf.
config CONSOLE_UART_CUSTOM_NUM_0 config CONSOLE_UART_CUSTOM_NUM_0
bool "UART0" bool "UART0"
config CONSOLE_UART_CUSTOM_NUM_1 config CONSOLE_UART_CUSTOM_NUM_1
bool "UART1" bool "UART1"
endchoice endchoice
config CONSOLE_UART_NUM config CONSOLE_UART_NUM
int int
default 0 if CONSOLE_UART_DEFAULT || CONSOLE_UART_NONE default 0 if CONSOLE_UART_DEFAULT || CONSOLE_UART_NONE
default 0 if CONSOLE_UART_CUSTOM_NUM_0 default 0 if CONSOLE_UART_CUSTOM_NUM_0
default 1 if CONSOLE_UART_CUSTOM_NUM_1 default 1 if CONSOLE_UART_CUSTOM_NUM_1
config CONSOLE_UART_TX_GPIO config CONSOLE_UART_TX_GPIO
int "UART TX on GPIO#" int "UART TX on GPIO#"
depends on CONSOLE_UART_CUSTOM depends on CONSOLE_UART_CUSTOM
range 0 33 range 0 33
default 19 default 19
config CONSOLE_UART_RX_GPIO config CONSOLE_UART_RX_GPIO
int "UART RX on GPIO#" int "UART RX on GPIO#"
depends on CONSOLE_UART_CUSTOM depends on CONSOLE_UART_CUSTOM
range 0 39 range 0 39
default 21 default 21
config CONSOLE_UART_BAUDRATE config CONSOLE_UART_BAUDRATE
int "UART console baud rate" int "UART console baud rate"
depends on !CONSOLE_UART_NONE depends on !CONSOLE_UART_NONE
default 115200 default 115200
range 1200 4000000 range 1200 4000000
config ULP_COPROC_ENABLED config ULP_COPROC_ENABLED
bool "Enable Ultra Low Power (ULP) Coprocessor" bool "Enable Ultra Low Power (ULP) Coprocessor"
@ -246,13 +202,13 @@ choice ESP32_PANIC
prompt "Panic handler behaviour" prompt "Panic handler behaviour"
default ESP32_PANIC_PRINT_REBOOT default ESP32_PANIC_PRINT_REBOOT
help help
If FreeRTOS detects unexpected behaviour or an unhandled exception, the panic handler is If FreeRTOS detects unexpected behaviour or an unhandled exception, the panic handler is
invoked. Configure the panic handlers action here. invoked. Configure the panic handlers action here.
config ESP32_PANIC_PRINT_HALT config ESP32_PANIC_PRINT_HALT
bool "Print registers and halt" bool "Print registers and halt"
help help
Outputs the relevant registers over the serial port and halt the Outputs the relevant registers over the serial port and halt the
processor. Needs a manual reset to restart. processor. Needs a manual reset to restart.
config ESP32_PANIC_PRINT_REBOOT config ESP32_PANIC_PRINT_REBOOT
@ -335,8 +291,8 @@ config TASK_WDT_CHECK_IDLE_TASK
help help
With this turned on, the task WDT can detect if the idle task is not called within the task With this turned on, the task WDT can detect if the idle task is not called within the task
watchdog timeout period. The idle task not being called usually is a symptom of another watchdog timeout period. The idle task not being called usually is a symptom of another
task hoarding the CPU. It is also a bad thing because FreeRTOS household tasks depend on the task hoarding the CPU. It is also a bad thing because FreeRTOS household tasks depend on the
idle task getting some runtime every now and then. Take Care: With this disabled, this idle task getting some runtime every now and then. Take Care: With this disabled, this
watchdog will trigger if no tasks register themselves within the timeout value. watchdog will trigger if no tasks register themselves within the timeout value.
config TASK_WDT_CHECK_IDLE_TASK_CPU1 config TASK_WDT_CHECK_IDLE_TASK_CPU1
@ -353,7 +309,7 @@ config BROWNOUT_DET
default y default y
depends on NEEDS_ESP32_NEW_SILICON_REV depends on NEEDS_ESP32_NEW_SILICON_REV
help help
The ESP32 has a built-in brownout detector which can detect if the voltage is lower than The ESP32 has a built-in brownout detector which can detect if the voltage is lower than
a specific value. If this happens, it will reset the chip in order to prevent unintended a specific value. If this happens, it will reset the chip in order to prevent unintended
behaviour. behaviour.
@ -407,25 +363,25 @@ config BROWNOUT_DET_RESETDELAY
choice ESP32_TIME_SYSCALL choice ESP32_TIME_SYSCALL
prompt "Timers used for gettimeofday function" prompt "Timers used for gettimeofday function"
default ESP32_TIME_SYSCALL_USE_RTC_FRC1 default ESP32_TIME_SYSCALL_USE_RTC_FRC1
help help
This setting defines which hardware timers are used to This setting defines which hardware timers are used to
implement 'gettimeofday' and 'time' functions in C library. implement 'gettimeofday' and 'time' functions in C library.
- If only FRC1 timer is used, gettimeofday will provide time at - If only FRC1 timer is used, gettimeofday will provide time at
microsecond resolution. Time will not be preserved when going microsecond resolution. Time will not be preserved when going
into deep sleep mode. into deep sleep mode.
- If both FRC1 and RTC timers are used, timekeeping will - If both FRC1 and RTC timers are used, timekeeping will
continue in deep sleep. Time will be reported at 1 microsecond continue in deep sleep. Time will be reported at 1 microsecond
resolution. resolution.
- If only RTC timer is used, timekeeping will continue in - If only RTC timer is used, timekeeping will continue in
deep sleep, but time will be measured at 6.(6) microsecond deep sleep, but time will be measured at 6.(6) microsecond
resolution. Also the gettimeofday function itself may take resolution. Also the gettimeofday function itself may take
longer to run. longer to run.
- If no timers are used, gettimeofday and time functions - If no timers are used, gettimeofday and time functions
return -1 and set errno to ENOSYS. return -1 and set errno to ENOSYS.
config ESP32_TIME_SYSCALL_USE_RTC config ESP32_TIME_SYSCALL_USE_RTC
bool "RTC" bool "RTC"
config ESP32_TIME_SYSCALL_USE_RTC_FRC1 config ESP32_TIME_SYSCALL_USE_RTC_FRC1
@ -437,85 +393,102 @@ config ESP32_TIME_SYSCALL_USE_NONE
endchoice endchoice
choice ESP32_RTC_CLOCK_SOURCE choice ESP32_RTC_CLOCK_SOURCE
prompt "RTC clock source" prompt "RTC clock source"
default ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC default ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC
help help
Choose which clock is used as RTC clock source. Choose which clock is used as RTC clock source.
The only available option for now is to use internal The only available option for now is to use internal
150kHz RC oscillator. 150kHz RC oscillator.
config ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC config ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC
bool "Internal RC" bool "Internal RC"
config ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL config ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
bool "External 32kHz crystal" bool "External 32kHz crystal"
depends on DOCUMENTATION_FOR_RTC_CNTL depends on DOCUMENTATION_FOR_RTC_CNTL
endchoice endchoice
config ESP32_DEEP_SLEEP_WAKEUP_DELAY config ESP32_DEEP_SLEEP_WAKEUP_DELAY
int "Extra delay in deep sleep wake stub (in us)" int "Extra delay in deep sleep wake stub (in us)"
default 0 default 0
range 0 5000 range 0 5000
help help
When ESP32 exits deep sleep, the CPU and the flash chip are powered on When ESP32 exits deep sleep, the CPU and the flash chip are powered on
at the same time. CPU will run deep sleep stub first, and then at the same time. CPU will run deep sleep stub first, and then
proceed to load code from flash. Some flash chips need sufficient proceed to load code from flash. Some flash chips need sufficient
time to pass between power on and first read operation. By default, time to pass between power on and first read operation. By default,
without any extra delay, this time is approximately 900us. without any extra delay, this time is approximately 900us.
If you are using a flash chip which needs more than 900us to become
ready after power on, set this parameter to add extra delay
to the default deep sleep stub.
If you are seeing "flash read err, 1000" message printed to the
console after deep sleep reset, try increasing this value.
If you are using a flash chip which needs more than 900us to become
ready after power on, set this parameter to add extra delay
to the default deep sleep stub.
config ESP32_PHY_AUTO_INIT If you are seeing "flash read err, 1000" message printed to the
bool "Initialize PHY in startup code" console after deep sleep reset, try increasing this value.
default y
help
If enabled, PHY will be initialized in startup code, before
app_main function runs.
If this is undesired, disable this option and call esp_phy_init
from the application before enabling WiFi or BT.
If this option is enabled, startup code will also initialize
NVS prior to initializing PHY.
If unsure, choose 'y'.
config ESP32_PHY_INIT_DATA_IN_PARTITION
bool "Use a partition to store PHY init data"
default n
help
If enabled, PHY init data will be loaded from a partition.
When using a custom partition table, make sure that PHY data
partition is included (type: 'data', subtype: 'phy').
With default partition tables, this is done automatically.
If PHY init data is stored in a partition, it has to be flashed there,
otherwise runtime error will occur.
If this option is not enabled, PHY init data will be embedded
into the application binary.
If unsure, choose 'n'.
config ESP32_PHY_MAX_TX_POWER
int "Max TX power (dBm)"
range 0 20
default 20
help
Set maximum transmit power. Actual transmit power for high
data rates may be lower than this setting.
config ESP32_WIFI_RX_BUFFER_NUM
int "Max number of WiFi RX buffers"
range 2 25
default 25
help
Set the number of WiFi rx buffers. Each buffer takes approximately 1.6KB of RAM.
Larger number for higher throughput but more memory. Smaller number for lower
throughput but less memory.
endmenu endmenu
menuconfig WIFI_ENABLED
bool "WiFi"
default y
help
Select this option to enable WiFi stack and show the submenu with WiFi configuration choices.
config SW_COEXIST_ENABLE
bool "Software controls WiFi/Bluetooth coexistence"
depends on WIFI_ENABLED && BT_ENABLED
default n
help
If enabled, WiFi & Bluetooth coexistence is controlled by software rather than hardware.
Recommended for heavy traffic scenarios. Both coexistence configuration options are
automatically managed, no user intervention is required.
config ESP32_PHY_AUTO_INIT
bool "Initialize PHY in startup code"
depends on WIFI_ENABLED
default y
help
If enabled, PHY will be initialized in startup code, before
app_main function runs.
If this is undesired, disable this option and call esp_phy_init
from the application before enabling WiFi or BT.
If this option is enabled, startup code will also initialize
NVS prior to initializing PHY.
If unsure, choose 'y'.
config ESP32_PHY_INIT_DATA_IN_PARTITION
bool "Use a partition to store PHY init data"
depends on WIFI_ENABLED
default n
help
If enabled, PHY init data will be loaded from a partition.
When using a custom partition table, make sure that PHY data
partition is included (type: 'data', subtype: 'phy').
With default partition tables, this is done automatically.
If PHY init data is stored in a partition, it has to be flashed there,
otherwise runtime error will occur.
If this option is not enabled, PHY init data will be embedded
into the application binary.
If unsure, choose 'n'.
config ESP32_PHY_MAX_TX_POWER
int "Max TX power (dBm)"
range 0 20
default 20
depends on WIFI_ENABLED
help
Set maximum transmit power. Actual transmit power for high
data rates may be lower than this setting.
config ESP32_WIFI_RX_BUFFER_NUM
int "Max number of WiFi RX buffers"
depends on WIFI_ENABLED
range 2 25
default 25
help
Set the number of WiFi rx buffers. Each buffer takes approximately 1.6KB of RAM.
Larger number for higher throughput but more memory. Smaller number for lower
throughput but less memory.

View file

@ -192,7 +192,7 @@ void heap_alloc_caps_init() {
// TODO: this region should be checked, since we don't need to knock out all region finally // TODO: this region should be checked, since we don't need to knock out all region finally
disable_mem_region((void*)0x3ffe0000, (void*)0x3ffe8000); //knock out ROM data region disable_mem_region((void*)0x3ffe0000, (void*)0x3ffe8000); //knock out ROM data region
#if CONFIG_MEMMAP_BT #if CONFIG_BT_ENABLED
disable_mem_region((void*)0x3ffb0000, (void*)0x3ffc0000); //knock out BT data region disable_mem_region((void*)0x3ffb0000, (void*)0x3ffc0000); //knock out BT data region
#endif #endif

View file

@ -1,8 +1,8 @@
menuconfig ETHERNET menuconfig ETHERNET
bool "Enable Ethernet" bool "Ethernet"
default n default n
help help
Enable this option to enable ethernet driver and show the menu with ethernet features. Select this option to enable ethernet driver and show the submenu with ethernet features.
config DMA_RX_BUF_NUM config DMA_RX_BUF_NUM
int "DMA Rx Buf Num" int "DMA Rx Buf Num"

View file

@ -32,6 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/_types.h> #include <sys/_types.h>
#include <stdint.h>
#if __has_extension(c_atomic) || __has_extension(cxx_atomic) #if __has_extension(c_atomic) || __has_extension(cxx_atomic)
#define __CLANG_ATOMICS #define __CLANG_ATOMICS

View file

@ -5,10 +5,3 @@
# BT config # BT config
# #
CONFIG_BT_ENABLED=y CONFIG_BT_ENABLED=y
#
# ESP32-specific config
#
CONFIG_ESP32_ENABLE_STACK_BT=y
# CONFIG_ESP32_ENABLE_STACK_NONE is not set
CONFIG_MEMMAP_BT=y

View file

@ -5,10 +5,3 @@
# BT config # BT config
# #
CONFIG_BT_ENABLED=y CONFIG_BT_ENABLED=y
#
# ESP32-specific config
#
CONFIG_ESP32_ENABLE_STACK_BT=y
# CONFIG_ESP32_ENABLE_STACK_NONE is not set
CONFIG_MEMMAP_BT=y

View file

@ -5,10 +5,3 @@
# BT config # BT config
# #
CONFIG_BT_ENABLED=y CONFIG_BT_ENABLED=y
#
# ESP32-specific config
#
CONFIG_ESP32_ENABLE_STACK_BT=y
# CONFIG_ESP32_ENABLE_STACK_NONE is not set
CONFIG_MEMMAP_BT=y

View file

@ -5,10 +5,3 @@
# BT config # BT config
# #
CONFIG_BT_ENABLED=y CONFIG_BT_ENABLED=y
#
# ESP32-specific config
#
CONFIG_ESP32_ENABLE_STACK_BT=y
# CONFIG_ESP32_ENABLE_STACK_NONE is not set
CONFIG_MEMMAP_BT=y