OVMS3-idf/components
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
..
app_trace gcc8_newlib3: Compilation warnings and errors not specific to newlib v3 2018-07-09 13:22:24 +03:00
app_update remove executable permission from source files 2018-05-29 20:07:45 +08:00
aws_iot aws_iot: add support for MQTT TLS over port 443 2018-04-23 18:27:28 +05:30
bootloader bootloader: move iram_seg 1k up to have better looking idf_monitor output 2018-07-04 12:33:11 +08:00
bootloader_support spi_flash: fix errors for GCC 8 support 2018-07-02 09:05:00 +00:00
bt Reclaim BT/BTDM BSS and Data in bluetooth memory release function 2018-07-20 11:33:26 +05:30
coap gcc8_newlib3: Compilation warnings and errors not specific to newlib v3 2018-07-09 13:22:24 +03:00
console gcc8_newlib3: Compilation warnings and errors not specific to newlib v3 2018-07-09 13:22:24 +03:00
cxx gcc8_newlib3: Compilation warnings and errors not specific to newlib v3 2018-07-09 13:22:24 +03:00
driver Merge branch 'bugfix/gcc8_complation_errors' into 'master' 2018-07-09 22:55:52 +08:00
esp-tls Merge branch 'bugfix/esp_tls_error_logging' into 'master' 2018-04-23 20:18:30 +08:00
esp32 Reclaim BT/BTDM BSS and Data in bluetooth memory release function 2018-07-20 11:33:26 +05:30
esp_adc_cal bugfix/Fix BLK3_RESERVED_FLAG register and other minor bugs 2018-03-16 15:51:36 +08:00
esp_http_client esp_http_client: Fix content-type header overwritten by esp_http_client_set_post_field 2018-06-20 10:49:26 +05:30
espcoredump bugfix: fixed path to esptool when there is no compiled python module for it 2017-03-21 13:30:38 +03:00
esptool_py Merge branch 'feature/expansion_space_for_bootloader' into 'master' 2018-06-18 12:34:53 +08:00
ethernet remove executable permission from source files 2018-05-29 20:07:45 +08:00
expat gcc8_newlib3: Compilation warnings and errors not specific to newlib v3 2018-07-09 13:22:24 +03:00
fatfs fatfs: fix errors for GCC 8 support and some indentation 2018-07-02 09:05:00 +00:00
freertos gcc8_newlib3: Compilation warnings and errors not specific to newlib v3 2018-07-09 13:22:24 +03:00
heap assert: Fix. Move useful functions from wrapped assert functions 2018-06-22 15:17:55 +05:00
idf_test test: add mesh basic function test cases 2018-06-20 05:59:54 +00:00
jsmn Add jsmn JSON parser component 2017-03-07 10:18:47 +11:00
json cJSON : Include only source file objects 2018-04-30 13:51:54 +05:30
libsodium gcc8_newlib3: Compilation warnings and errors not specific to newlib v3 2018-07-09 13:22:24 +03:00
log doc: fix the level inconsistent issue in Kconfig document 2018-06-05 10:36:18 +00:00
lwip Merge branch 'bugfix/tw23667_tcp_pcb_purge_assert' into 'master' 2018-07-10 10:16:47 +08:00
mbedtls gcc8_newlib3: Compilation warnings and errors not specific to newlib v3 2018-07-09 13:22:24 +03:00
mdns fix(mdns): add the maximum number of services 2018-06-21 10:31:09 +08:00
micro-ecc micro-ecc: update to v1.0 2018-06-10 21:20:55 +08:00
newlib Merge branch 'feature/clock_gettime' into 'master' 2018-07-04 18:09:04 +08:00
nghttp gcc8_newlib3: Compilation warnings and errors not specific to newlib v3 2018-07-09 13:22:24 +03:00
nvs_flash nvs_partition_generator: Add support for base64 representation of Binary data 2018-07-02 15:40:21 +05:30
openssl remove executable permission from source files 2018-05-29 20:07:45 +08:00
partition_table partition_table: Warn if the partition table name doesn't match type & subtype 2018-06-22 17:51:34 +10:00
pthread pthread: implement local storage using pvTaskGetThreadLocalStoragePointer 2018-04-19 18:28:55 +05:30
sdmmc remove executable permission from source files 2018-05-29 20:07:45 +08:00
smartconfig_ack smartconfig_ack.c : Fixed the declaration of remote_ip in sc_ack_send_task() 2018-07-03 16:28:24 +05:30
soc CAN Driver 2018-07-04 14:01:57 +08:00
spi_flash Merge branch 'bugfix/spi_flash_deadlock' into 'master' 2018-07-02 18:39:16 +08:00
spiffs partition_table: Warn if the partition table name doesn't match type & subtype 2018-06-22 17:51:34 +10:00
tcpip_adapter remove executable permission from source files 2018-05-29 20:07:45 +08:00
ulp remove executable permission from source files 2018-05-29 20:07:45 +08:00
vfs Merge branch 'feature/fs_truncate_support' into 'master' 2018-06-14 13:56:39 +08:00
wear_levelling partition_table: Warn if the partition table name doesn't match type & subtype 2018-06-22 17:51:34 +10:00
wpa_supplicant gcc8_newlib3: Compilation warnings and errors not specific to newlib v3 2018-07-09 13:22:24 +03:00
xtensa-debug-module remove executable permission from source files 2018-05-29 20:07:45 +08:00