OVMS3-idf/components/esp32
Hrishikesh Dhayagude f610249bdd Reclaim BT/BTDM BSS and Data in bluetooth memory release function
1. Modify esp_bt_controller_mem_release() to release BTDM BSS and Data to heap if
ESP_BT_MODE_BTDM mode is passed to it
2. Add a new API esp_bt_mem_release() which internally calls
esp_bt_controller_mem_release() with the provided mode and then if mode
is ESP_BT_MODE_BTDM, releases BT BSS and Data to heap.

Background:
For Wi-Fi and BT/BLE applications, for e.g. the usecase is like when
Bluetooth is used for provisioning and once the device is connected to the Wi-Fi
AP, we can turn off Bluetooth completely. In such scenarios, it should be possible to
reclaim all the memory of Bluetooth. Although, currently this does not
happen.

Experiment:
Made the following modifications to examples/bluetooth/gatt_server :
1. Added support of simple_wifi to it
2. Moved all the bluetooth related code under CONFIG_BT_ENABLED config
option
3. Calculated the free heap in 2 similar scenarios:
   i. Disabled BT (CONFIG_BT_ENABLED undefined) and checked the free
heap after STA connected
   ii. Kept BT enabled and disabled it after STA connected and checked
the free heap
Ideally, the numbers for i., ii. above should have been similar. But
there was a delta of almost 30-31K. (i. > ii.)
4. Through make size-components checked the common BSS for libbta.a and libbtdm_app.a
and found it to be almost 30K. Data is around 1K

Solution:
1. Modified the linker script to mark the BSS and Data for these libraries and
free it when ESP_BT_MODE_BTDM mode is passed to mem release APIs.
2. Verified that the free heap is comparable for i. and ii. above.

Note: It is known that once this is done, Bluetooth can only be used
again post reboot.

Signed-off-by: Hrishikesh Dhayagude <hrishi@espressif.com>
2018-07-20 11:33:26 +05:30
..
hwcrypto soc: Change DPORT access 2018-05-14 17:54:57 +05:00
include Merge branch 'bugfix/gcc8_complation_errors' into 'master' 2018-07-09 22:55:52 +08:00
ld Reclaim BT/BTDM BSS and Data in bluetooth memory release function 2018-07-20 11:33:26 +05:30
lib@9b9a3b35f0 esp32: Change channel state information(CSI) data type from unsigned char to signed char 2018-07-04 11:39:14 +08:00
test esp32: fix addresses of some libgcc functions in ROM ld script 2018-07-02 12:49:57 +08:00
brownout.c brownout detector: enable by default 2017-07-10 17:25:55 +08:00
cache_err_int.c esp32: fix cache error interrupt handler 2017-09-08 09:59:09 +08:00
clk.c gcc8_newlib3: Compilation warnings and errors not specific to newlib v3 2018-07-09 13:22:24 +03:00
coexist.c component/esp32 : clear some minor thingsw about PM and coexistence 2018-04-03 20:13:49 +08:00
coexist_internal.h component/esp32 : clear some minor thingsw about PM and coexistence 2018-04-03 20:13:49 +08:00
component.mk esp32: force pure math functions from libgcc to be linked from ROM 2018-07-02 12:49:57 +08:00
core_dump.c freertos: deprecate XT_CLOCK_FREQ 2017-10-18 14:19:19 +08:00
cpu_start.c esp32: Adds GCOV debug stubs support 2018-05-18 16:16:03 +03:00
crosscore_int.c esp32: Move esp_crosscore_isr_handle_yield() to IRAM 2018-06-13 11:36:15 +10:00
dbg_stubs.c esp32: Adds GCOV debug stubs support 2018-05-18 16:16:03 +03:00
dport_access.c dport: Bigfix dport_read code move to IRAM 2018-05-21 22:00:51 +05:00
dport_panic_highint_hdl.S xtensa: remove unused header files 2018-05-31 02:21:36 +00:00
esp_clk_internal.h bugfix/rtc_clk_32k_bootstrap: Fix starting 32k RTC 2018-03-21 13:27:56 +05:00
esp_err_to_name.c example(sdio): example to use sdmmc host to do SDIO communication with SDIO slave 2018-06-20 07:00:05 +00:00
esp_err_to_name.c.in esp32: esp_err_to_name_r: print error code as hex and decimal 2018-06-15 15:49:23 +08:00
esp_timer.c Merge branch 'bugfix/light_sleep_fixes' into 'master' 2018-05-02 20:09:36 +08:00
esp_timer_esp32.c esp_timer: reduce overflow value in unit tests 2018-06-11 02:37:19 +00:00
esp_timer_impl.h sleep: fix deadlock in esp_timer_impl_advance after light sleep 2018-05-09 22:52:50 +08:00
ets_timer_legacy.c wifi/bt coexistence: Fix disabled cache access race when writing to flash 2017-10-16 19:47:33 +08:00
event_default_handlers.c add event SYSTEM_EVENT_AP_STAIPASSIGNED 2018-05-19 13:14:12 +08:00
event_loop.c add mesh feature 2018-04-04 22:57:45 +08:00
fast_crypto_ops.c esp32/wpa_supplicant: fix some bugs introduced by wifi os adapter 2018-05-31 17:09:40 +08:00
freertos_hooks.c freertos,esp32: automatic light sleep support 2018-05-18 03:14:46 +00:00
gdbstub.c Resolve problems found by enabling -Wwrite-strings compilation flag 2018-04-10 08:53:43 +02:00
hw_random.c freertos: deprecate XT_CLOCK_FREQ 2017-10-18 14:19:19 +08:00
int_wdt.c Dump the frame of the other core when interrupt watchdog happens 2018-01-18 23:10:29 +00:00
intr_alloc.c esp32: fix interrupt list insert issue 2018-05-14 14:13:08 +08:00
ipc.c ipc: fix errors for GCC 8 support 2018-07-02 09:05:00 +00:00
Kconfig remove executable permission from source files 2018-05-29 20:07:45 +08:00
lib_printf.c component/esp32 : clear some minor thingsw about PM and coexistence 2018-04-03 20:13:49 +08:00
libhal.a Initial public version 2016-08-17 23:08:22 +08:00
Makefile.projbuild Merge branch 'feature/expansion_space_for_bootloader' into 'master' 2018-06-18 12:34:53 +08:00
panic.c panic: remove extra newline 2018-06-15 15:49:23 +08:00
phy.h esp32: some changes relating to phy v3900 2018-05-22 14:16:09 +08:00
phy_init.c esp32: fix the bug that the first two reboots do full calibration 2018-06-12 15:51:51 +08:00
phy_init_data.h component/esp32 : update phy & rtc 2017-10-17 18:02:42 +08:00
pm_esp32.c freertos,esp32: automatic light sleep support 2018-05-18 03:14:46 +00:00
pm_impl.h pm: initial implementation for ESP32 2017-10-18 14:19:16 +08:00
pm_locks.c pm: initial version of power management APIs 2017-10-18 14:19:16 +08:00
pm_trace.c freertos,esp32: automatic light sleep support 2018-05-18 03:14:46 +00:00
pm_trace.h freertos,esp32: automatic light sleep support 2018-05-18 03:14:46 +00:00
restore.c esp_system: remove link time dependency on WiFi stack 2017-06-15 18:15:36 +08:00
sleep_modes.c sleep: make sure input enable is set for EXT0/EXT1 wakeup 2018-06-12 20:25:15 +08:00
spiram.c Add option to continue running (with less ram) if psram is enabled but not detected 2018-02-12 13:44:11 +08:00
spiram_psram.c soc: Fix description of rtc_config_t.tieh, add macros 2018-05-25 14:58:37 +10:00
spiram_psram.h Add initial SPI RAM support. This adds support for an ESP-PSRAM32 chip connected to the default flash pins and GPIO 16 and 17. The RAM is mapped to address 0x3F800000, but otherwise ignored by esp-idf as of yet. 2017-09-04 12:05:49 +08:00
stack_check.c esp32: Adds Stack Smashing Protection Feature 2017-11-17 12:08:36 +03:00
system_api.c rename clock enable and reset bits for SPI modules 2018-05-14 16:45:03 +08:00
task_wdt.c watchdogs: make sure timer group peripherals are enabled 2017-12-01 20:10:26 +08:00
wifi_init.c wifi: Set default wifi library log level based on sdkconfig 2018-05-02 15:11:21 +10:00
wifi_os_adapter.c Add OS adapter to WiFi driver 2018-05-26 17:22:23 +08:00