help
Bluedroid memory debug
+config BT_DRAM_RELEASE
+ bool "Release DRAM from Classic BT controller"
+ depends on BT_ENABLED
+ default n
+ help
+ This option should only be used when BLE only.
+ Open this option will release about 30K DRAM from Classic BT.
+ The released DRAM will be used as system heap memory.
+
# Memory reserved at start of DRAM for Bluetooth stack
config BT_RESERVE_DRAM
hex
#if CONFIG_BT_ENABLED
+/* Bluetooth system and controller config */
+#define BTDM_CFG_BT_EM_RELEASE (1<<0)
+#define BTDM_CFG_BT_DATA_RELEASE (1<<1)
+/* Other reserved for future */
+
/* not for user call, so don't put to include file */
extern void btdm_osi_funcs_register(void *osi_funcs);
-extern void btdm_controller_init(void);
+extern void btdm_controller_init(uint32_t config_mask);
extern void btdm_controller_schedule(void);
extern void btdm_controller_deinit(void);
extern int btdm_controller_enable(esp_bt_mode_t mode);
API_vhci_host_register_callback((const vhci_host_callback_t *)callback);
}
+static uint32_t btdm_config_mask_load(void)
+{
+ uint32_t mask = 0x0;
+
+#ifdef CONFIG_BT_DRAM_RELEASE
+ mask |= (BTDM_CFG_BT_EM_RELEASE | BTDM_CFG_BT_DATA_RELEASE);
+#endif
+ return mask;
+}
+
static void bt_controller_task(void *pvParam)
{
+ uint32_t btdm_cfg_mask = 0;
+
btdm_osi_funcs_register(&osi_funcs);
- btdm_controller_init();
+ btdm_cfg_mask = btdm_config_mask_load();
+ btdm_controller_init(btdm_cfg_mask);
+
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
/* Loop */
disable_mem_region((void*)0x3ffe0000, (void*)0x3ffe8000); //knock out ROM data region
#if CONFIG_BT_ENABLED
+#if CONFIG_BT_DRAM_RELEASE
+ disable_mem_region((void*)0x3ffb0000, (void*)0x3ffb3000); //knock out BT data region
+ disable_mem_region((void*)0x3ffb8000, (void*)0x3ffbbb28); //knock out BT data region
+ disable_mem_region((void*)0x3ffbdb28, (void*)0x3ffc0000); //knock out BT data region
+#else
disable_mem_region((void*)0x3ffb0000, (void*)0x3ffc0000); //knock out BT data region
#endif
+#endif
#if CONFIG_MEMMAP_TRACEMEM
#if CONFIG_MEMMAP_TRACEMEM_TWOBANKS