OVMS3-idf/components/esp32/ld
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
..
elf_to_ld.sh Initial public version 2016-08-17 23:08:22 +08:00
esp32.common.ld Reclaim BT/BTDM BSS and Data in bluetooth memory release function 2018-07-20 11:33:26 +05:30
esp32.ld esp32: Change 192KB runtime static limit workaround to a 176KB link time workaround 2017-12-27 11:59:54 +11:00
esp32.peripherals.ld CAN Driver 2018-07-04 14:01:57 +08:00
esp32.rom.ld esp32: force pure math functions from libgcc to be linked from ROM 2018-07-02 12:49:57 +08:00
esp32.rom.libgcc.ld esp32: force pure math functions from libgcc to be linked from ROM 2018-07-02 12:49:57 +08:00
esp32.rom.nanofmt.ld newlib: add "full" formatting support, add missing functions 2016-12-08 11:04:54 +08:00
esp32.rom.spiflash.ld spiflash ROM functions: Remove Quad I/O mode enable/disable code from flash ROM functions 2017-04-13 17:54:42 +10:00
esp32.rom.spiram_incompatible_fns.ld 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
esp32.spiram.rom-functions-dram.ld Make sure functions that are in ROM in the non-external-ram-workaround version, are in RAM (and not in flash) in the ext-ram workaround version. 2017-09-13 10:36:56 +08:00
esp32.spiram.rom-functions-iram.ld Make sure functions that are in ROM in the non-external-ram-workaround version, are in RAM (and not in flash) in the ext-ram workaround version. 2017-09-13 10:36:56 +08:00