Browse Source

Merge branch 'feature/esp32c2_optimize_ble_init' into 'master'

Fixed memory leak when RAM free size is insufficient or setting ext scan...

See merge request espressif/esp-idf!21261
Jiang Jiang Jian 3 năm trước cách đây
mục cha
commit
7869f4e151

+ 32 - 10
components/bt/controller/esp32c2/bt.c

@@ -52,6 +52,8 @@
 #include "esp_private/periph_ctrl.h"
 #include "esp_private/periph_ctrl.h"
 #include "esp_sleep.h"
 #include "esp_sleep.h"
 
 
+#include "soc/syscon_reg.h"
+#include "soc/dport_access.h"
 /* Macro definition
 /* Macro definition
  ************************************************************************
  ************************************************************************
  */
  */
@@ -60,7 +62,7 @@
 #define OSI_COEX_VERSION              0x00010006
 #define OSI_COEX_VERSION              0x00010006
 #define OSI_COEX_MAGIC_VALUE          0xFADEBEAD
 #define OSI_COEX_MAGIC_VALUE          0xFADEBEAD
 
 
-#define EXT_FUNC_VERSION             0x20220125
+#define EXT_FUNC_VERSION             0x20221122
 #define EXT_FUNC_MAGIC_VALUE         0xA5A5A5A5
 #define EXT_FUNC_MAGIC_VALUE         0xA5A5A5A5
 
 
 #define BT_ASSERT_PRINT              ets_printf
 #define BT_ASSERT_PRINT              ets_printf
@@ -102,6 +104,7 @@ struct ext_funcs_t {
     int (* _ecc_gen_key_pair)(uint8_t *public, uint8_t *priv);
     int (* _ecc_gen_key_pair)(uint8_t *public, uint8_t *priv);
     int (* _ecc_gen_dh_key)(const uint8_t *remote_pub_key_x, const uint8_t *remote_pub_key_y, const uint8_t *local_priv_key, uint8_t *dhkey);
     int (* _ecc_gen_dh_key)(const uint8_t *remote_pub_key_x, const uint8_t *remote_pub_key_y, const uint8_t *local_priv_key, uint8_t *dhkey);
     void (* _esp_reset_rpa_moudle)(void);
     void (* _esp_reset_rpa_moudle)(void);
+    void (* _esp_bt_track_pll_cap)(void);
     uint32_t magic;
     uint32_t magic;
 };
 };
 
 
@@ -232,7 +235,8 @@ struct ext_funcs_t ext_funcs_ro = {
 
 
 static void IRAM_ATTR esp_reset_rpa_moudle(void)
 static void IRAM_ATTR esp_reset_rpa_moudle(void)
 {
 {
-    periph_module_reset(PERIPH_MODEM_RPA_MODULE);
+    DPORT_SET_PERI_REG_MASK(SYSTEM_CORE_RST_EN_REG, BLE_RPA_REST_BIT);
+    DPORT_CLEAR_PERI_REG_MASK(SYSTEM_CORE_RST_EN_REG, BLE_RPA_REST_BIT);
 }
 }
 
 
 static void IRAM_ATTR osi_assert_wrapper(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2)
 static void IRAM_ATTR osi_assert_wrapper(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2)
@@ -399,7 +403,7 @@ static int ble_hci_unregistered_hook(void*, void*)
 
 
 static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler, void *arg, void **ret_handle_in)
 static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler, void *arg, void **ret_handle_in)
 {
 {
-    int rc = esp_intr_alloc(source, flags, handler, arg, (intr_handle_t *)ret_handle_in);
+    int rc = esp_intr_alloc(source, flags | ESP_INTR_FLAG_IRAM, handler, arg, (intr_handle_t *)ret_handle_in);
     return rc;
     return rc;
 }
 }
 
 
@@ -641,6 +645,8 @@ void ble_rtc_clk_init(void)
 
 
 esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
 esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
 {
 {
+    esp_err_t ret = ESP_OK;
+
     if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
     if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "invalid controller state");
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "invalid controller state");
         return ESP_FAIL;
         return ESP_FAIL;
@@ -659,7 +665,6 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
 
 
     /* Initialize the function pointers for OS porting */
     /* Initialize the function pointers for OS porting */
     npl_freertos_funcs_init();
     npl_freertos_funcs_init();
-
     struct npl_funcs_t *p_npl_funcs = npl_freertos_funcs_get();
     struct npl_funcs_t *p_npl_funcs = npl_freertos_funcs_get();
     if (!p_npl_funcs) {
     if (!p_npl_funcs) {
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl functions get failed");
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl functions get failed");
@@ -668,18 +673,21 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
 
 
     if (esp_register_npl_funcs(p_npl_funcs) != 0) {
     if (esp_register_npl_funcs(p_npl_funcs) != 0) {
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl functions register failed");
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl functions register failed");
-        return ESP_ERR_INVALID_ARG;
+        ret = ESP_ERR_INVALID_ARG;
+        goto free_mem;
     }
     }
 
 
     if (npl_freertos_mempool_init() != 0) {
     if (npl_freertos_mempool_init() != 0) {
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl mempool init failed");
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl mempool init failed");
-        return ESP_ERR_INVALID_ARG;
+        ret = ESP_ERR_INVALID_ARG;
+        goto free_mem;
     }
     }
 
 
     /* Initialize the global memory pool */
     /* Initialize the global memory pool */
     if (os_msys_buf_alloc() != 0) {
     if (os_msys_buf_alloc() != 0) {
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "os msys alloc failed");
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "os msys alloc failed");
-        return ESP_ERR_INVALID_ARG;
+        ret = ESP_ERR_INVALID_ARG;
+        goto free_mem;
     }
     }
 
 
     os_msys_init();
     os_msys_init();
@@ -699,7 +707,8 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
 
 
     if (ble_osi_coex_funcs_register((struct osi_coex_funcs_t *)&s_osi_coex_funcs_ro) != 0) {
     if (ble_osi_coex_funcs_register((struct osi_coex_funcs_t *)&s_osi_coex_funcs_ro) != 0) {
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "osi coex funcs reg failed");
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "osi coex funcs reg failed");
-        return ESP_ERR_INVALID_ARG;
+        ret = ESP_ERR_INVALID_ARG;
+        goto free_phy;
     }
     }
 
 
 #if CONFIG_SW_COEXIST_ENABLE
 #if CONFIG_SW_COEXIST_ENABLE
@@ -708,7 +717,8 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
     int rc = ble_controller_init(cfg);
     int rc = ble_controller_init(cfg);
     if (rc != 0) {
     if (rc != 0) {
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_init failed %d", rc);
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_init failed %d", rc);
-        return ESP_ERR_NO_MEM;
+        ret = ESP_ERR_NO_MEM;
+        goto free_phy;
     }
     }
 
 
     controller_sleep_init();
     controller_sleep_init();
@@ -724,8 +734,20 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
 
 
     ble_hci_trans_cfg_hs((ble_hci_trans_rx_cmd_fn *)ble_hci_unregistered_hook,NULL,
     ble_hci_trans_cfg_hs((ble_hci_trans_rx_cmd_fn *)ble_hci_unregistered_hook,NULL,
                          (ble_hci_trans_rx_acl_fn *)ble_hci_unregistered_hook,NULL);
                          (ble_hci_trans_rx_acl_fn *)ble_hci_unregistered_hook,NULL);
-
     return ESP_OK;
     return ESP_OK;
+free_phy:
+    esp_phy_disable();
+    esp_phy_pd_mem_deinit();
+#if CONFIG_BT_NIMBLE_ENABLED
+    ble_npl_eventq_deinit(nimble_port_get_dflt_eventq());
+#endif // CONFIG_BT_NIMBLE_ENABLED
+free_mem:
+    os_msys_buf_free();
+    npl_freertos_mempool_deinit();
+    esp_unregister_npl_funcs();
+    npl_freertos_funcs_deinit();
+    esp_unregister_ext_funcs();
+    return ret;
 }
 }
 
 
 esp_err_t esp_bt_controller_deinit(void)
 esp_err_t esp_bt_controller_deinit(void)

+ 6 - 2
components/bt/controller/esp32h4/bt.c

@@ -50,6 +50,9 @@
 #include "esp_private/periph_ctrl.h"
 #include "esp_private/periph_ctrl.h"
 #include "esp_sleep.h"
 #include "esp_sleep.h"
 
 
+#include "soc/syscon_reg.h"
+#include "soc/dport_access.h"
+
 /* Macro definition
 /* Macro definition
  ************************************************************************
  ************************************************************************
  */
  */
@@ -216,7 +219,8 @@ struct ext_funcs_t ext_funcs_ro = {
 
 
 static int IRAM_ATTR esp_reset_rpa_moudle(void)
 static int IRAM_ATTR esp_reset_rpa_moudle(void)
 {
 {
-    periph_module_reset(PERIPH_MODEM_RPA_MODULE);
+    DPORT_SET_PERI_REG_MASK(SYSTEM_MODEM_RST_EN_REG, SYSTEM_BLE_SEC_AAR_RST);
+    DPORT_CLEAR_PERI_REG_MASK(SYSTEM_MODEM_RST_EN_REG, SYSTEM_BLE_SEC_AAR_RST);
     return 0;
     return 0;
 }
 }
 
 
@@ -385,7 +389,7 @@ static int ble_hci_unregistered_hook(void*, void*)
 
 
 static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler, void *arg, void **ret_handle_in)
 static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler, void *arg, void **ret_handle_in)
 {
 {
-    int rc = esp_intr_alloc(source, flags, handler, arg, (intr_handle_t *)ret_handle_in);
+    int rc = esp_intr_alloc(source, flags | ESP_INTR_FLAG_IRAM, handler, arg, (intr_handle_t *)ret_handle_in);
     return rc;
     return rc;
 }
 }
 
 

+ 1 - 1
components/bt/controller/lib_esp32c2/esp32c2-bt-lib

@@ -1 +1 @@
-Subproject commit c1f0e3be6c1211cceb94175127e793b77355bbfb
+Subproject commit db13654151c6669edb13c24046c6439620e8cb97

+ 2 - 2
components/bt/porting/mem/bt_osi_mem.c

@@ -36,12 +36,12 @@ IRAM_ATTR void *bt_osi_mem_calloc(size_t n, size_t size)
 
 
 IRAM_ATTR void *bt_osi_mem_malloc_internal(size_t size)
 IRAM_ATTR void *bt_osi_mem_malloc_internal(size_t size)
 {
 {
-    return heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
+    return heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT|MALLOC_CAP_DMA);
 }
 }
 
 
 IRAM_ATTR void *bt_osi_mem_calloc_internal(size_t n, size_t size)
 IRAM_ATTR void *bt_osi_mem_calloc_internal(size_t n, size_t size)
 {
 {
-    return heap_caps_calloc(n, size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
+    return heap_caps_calloc(n, size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT|MALLOC_CAP_DMA);
 }
 }
 
 
 IRAM_ATTR void bt_osi_mem_free(void *ptr)
 IRAM_ATTR void bt_osi_mem_free(void *ptr)

+ 1 - 1
components/bt/porting/nimble/include/nimble/nimble_npl.h

@@ -121,7 +121,7 @@ uint16_t ble_npl_sem_get_count(struct ble_npl_sem *sem);
  * Callouts
  * Callouts
  */
  */
 
 
-void ble_npl_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
+int ble_npl_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
                           ble_npl_event_fn *ev_cb, void *ev_arg);
                           ble_npl_event_fn *ev_cb, void *ev_arg);
 
 
 ble_npl_error_t ble_npl_callout_reset(struct ble_npl_callout *co,
 ble_npl_error_t ble_npl_callout_reset(struct ble_npl_callout *co,

+ 4 - 0
components/bt/porting/nimble/src/os_msys_init.c

@@ -148,6 +148,10 @@ os_msys_buf_alloc(void)
 #if OS_MSYS_2_BLOCK_COUNT > 0
 #if OS_MSYS_2_BLOCK_COUNT > 0
     os_msys_init_2_data = (os_membuf_t *)bt_osi_mem_calloc(1, (sizeof(os_membuf_t) * SYSINIT_MSYS_2_MEMPOOL_SIZE));
     os_msys_init_2_data = (os_membuf_t *)bt_osi_mem_calloc(1, (sizeof(os_membuf_t) * SYSINIT_MSYS_2_MEMPOOL_SIZE));
     if (!os_msys_init_2_data) {
     if (!os_msys_init_2_data) {
+#if OS_MSYS_1_BLOCK_COUNT > 0
+       bt_osi_mem_free(os_msys_init_1_data);
+       os_msys_init_1_data = NULL;
+#endif
         return ESP_FAIL;
         return ESP_FAIL;
     }
     }
 #endif
 #endif

+ 3 - 2
components/bt/porting/npl/freertos/include/nimble/nimble_npl_os.h

@@ -102,7 +102,7 @@ struct npl_funcs_t {
     ble_npl_error_t (*p_ble_npl_sem_pend)(struct ble_npl_sem *, ble_npl_time_t);
     ble_npl_error_t (*p_ble_npl_sem_pend)(struct ble_npl_sem *, ble_npl_time_t);
     ble_npl_error_t (*p_ble_npl_sem_release)(struct ble_npl_sem *);
     ble_npl_error_t (*p_ble_npl_sem_release)(struct ble_npl_sem *);
     uint16_t (*p_ble_npl_sem_get_count)(struct ble_npl_sem *);
     uint16_t (*p_ble_npl_sem_get_count)(struct ble_npl_sem *);
-    void (*p_ble_npl_callout_init)(struct ble_npl_callout *, struct ble_npl_eventq *, ble_npl_event_fn *, void *);
+    int (*p_ble_npl_callout_init)(struct ble_npl_callout *, struct ble_npl_eventq *, ble_npl_event_fn *, void *);
     ble_npl_error_t (*p_ble_npl_callout_reset)(struct ble_npl_callout *, ble_npl_time_t);
     ble_npl_error_t (*p_ble_npl_callout_reset)(struct ble_npl_callout *, ble_npl_time_t);
     void (*p_ble_npl_callout_stop)(struct ble_npl_callout *);
     void (*p_ble_npl_callout_stop)(struct ble_npl_callout *);
     void (*p_ble_npl_callout_deinit)(struct ble_npl_callout *);
     void (*p_ble_npl_callout_deinit)(struct ble_npl_callout *);
@@ -259,12 +259,13 @@ IRAM_ATTR ble_npl_sem_get_count(struct ble_npl_sem *sem)
     return npl_funcs->p_ble_npl_sem_get_count(sem);
     return npl_funcs->p_ble_npl_sem_get_count(sem);
 }
 }
 
 
-static inline void
+static inline int
 IRAM_ATTR ble_npl_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
 IRAM_ATTR ble_npl_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
                      ble_npl_event_fn *ev_cb, void *ev_arg)
                      ble_npl_event_fn *ev_cb, void *ev_arg)
 {
 {
     return npl_funcs->p_ble_npl_callout_init(co, evq, ev_cb, ev_arg);
     return npl_funcs->p_ble_npl_callout_init(co, evq, ev_cb, ev_arg);
 }
 }
+
 static inline void
 static inline void
 IRAM_ATTR ble_npl_callout_deinit(struct ble_npl_callout *co)
 IRAM_ATTR ble_npl_callout_deinit(struct ble_npl_callout *co)
 {
 {

+ 1 - 1
components/bt/porting/npl/freertos/include/nimble/npl_freertos.h

@@ -72,7 +72,7 @@ ble_npl_error_t npl_freertos_sem_pend(struct ble_npl_sem *sem,
 
 
 ble_npl_error_t npl_freertos_sem_release(struct ble_npl_sem *sem);
 ble_npl_error_t npl_freertos_sem_release(struct ble_npl_sem *sem);
 
 
-void npl_freertos_callout_init(struct ble_npl_callout *co,
+int npl_freertos_callout_init(struct ble_npl_callout *co,
                                struct ble_npl_eventq *evq,
                                struct ble_npl_eventq *evq,
                                ble_npl_event_fn *ev_cb, void *ev_arg);
                                ble_npl_event_fn *ev_cb, void *ev_arg);
 
 

+ 64 - 44
components/bt/porting/npl/freertos/src/npl_os_freertos.c

@@ -676,7 +676,7 @@ IRAM_ATTR os_callout_timer_cb(TimerHandle_t timer)
 }
 }
 #endif
 #endif
 
 
-void
+int
 npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
 npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
                       ble_npl_event_fn *ev_cb, void *ev_arg)
                       ble_npl_event_fn *ev_cb, void *ev_arg)
 {
 {
@@ -692,61 +692,82 @@ npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq
         ble_npl_event_init(&callout->ev, ev_cb, ev_arg);
         ble_npl_event_init(&callout->ev, ev_cb, ev_arg);
 
 
 #if CONFIG_BT_NIMBLE_USE_ESP_TIMER
 #if CONFIG_BT_NIMBLE_USE_ESP_TIMER
-	callout->evq = evq;
-
-	esp_timer_create_args_t create_args = {
-		.callback = ble_npl_event_fn_wrapper,
-		.arg = callout,
-		.name = "nimble_timer"
-	};
-
-	ESP_ERROR_CHECK(esp_timer_create(&create_args, &callout->handle));
-
+        callout->evq = evq;
+
+        esp_timer_create_args_t create_args = {
+            .callback = ble_npl_event_fn_wrapper,
+            .arg = callout,
+            .name = "nimble_timer"
+        };
+
+        if (esp_timer_create(&create_args, &callout->handle) != ESP_OK) {
+            ble_npl_event_deinit(&callout->ev);
+            os_memblock_put(&ble_freertos_co_pool,callout);
+            co->co = NULL;
+            return -1;
+        }
 #else
 #else
-	callout->handle = xTimerCreate("co", 1, pdFALSE, callout, os_callout_timer_cb);
-#endif
+        callout->handle = xTimerCreate("co", 1, pdFALSE, callout, os_callout_timer_cb);
 
 
-	BLE_LL_ASSERT(callout->handle);
+        if (!callout->handle) {
+            ble_npl_event_deinit(&callout->ev);
+            os_memblock_put(&ble_freertos_co_pool,callout);
+            co->co = NULL;
+            return -1;
+        }
+#endif // CONFIG_BT_NIMBLE_USE_ESP_TIMER
     } else {
     } else {
-	callout = (struct ble_npl_callout_freertos *)co->co;
-	BLE_LL_ASSERT(callout);
-	callout->evq = evq;
-	ble_npl_event_init(&callout->ev, ev_cb, ev_arg);
+        callout = (struct ble_npl_callout_freertos *)co->co;
+        BLE_LL_ASSERT(callout);
+        callout->evq = evq;
+        ble_npl_event_init(&callout->ev, ev_cb, ev_arg);
     }
     }
 #else
 #else
 
 
     if(!co->co) {
     if(!co->co) {
         co->co = malloc(sizeof(struct ble_npl_callout_freertos));
         co->co = malloc(sizeof(struct ble_npl_callout_freertos));
         callout = (struct ble_npl_callout_freertos *)co->co;
         callout = (struct ble_npl_callout_freertos *)co->co;
-        BLE_LL_ASSERT(callout);
+        if (!callout) {
+            return -1;
+        }
 
 
-	memset(callout, 0, sizeof(*callout));
+        memset(callout, 0, sizeof(*callout));
         ble_npl_event_init(&callout->ev, ev_cb, ev_arg);
         ble_npl_event_init(&callout->ev, ev_cb, ev_arg);
 
 
 #if CONFIG_BT_NIMBLE_USE_ESP_TIMER
 #if CONFIG_BT_NIMBLE_USE_ESP_TIMER
-	callout->evq = evq;
-
-	esp_timer_create_args_t create_args = {
-		.callback = ble_npl_event_fn_wrapper,
-		.arg = callout,
-		.name = "nimble_timer"
-	};
-
-	ESP_ERROR_CHECK(esp_timer_create(&create_args, &callout->handle));
+        callout->evq = evq;
+
+        esp_timer_create_args_t create_args = {
+            .callback = ble_npl_event_fn_wrapper,
+            .arg = callout,
+            .name = "nimble_timer"
+        };
+
+        if (esp_timer_create(&create_args, &callout->handle) != ESP_OK) {
+            ble_npl_event_deinit(&callout->ev);
+            free((void *)callout);
+            co->co = NULL;
+            return -1;
+        }
 #else
 #else
-	callout->handle = xTimerCreate("co", 1, pdFALSE, callout, os_callout_timer_cb);
-#endif
+        callout->handle = xTimerCreate("co", 1, pdFALSE, callout, os_callout_timer_cb);
 
 
-	BLE_LL_ASSERT(callout->handle);
+        if (!callout->handle) {
+            ble_npl_event_deinit(&callout->ev);
+            free((void *)callout);
+            co->co = NULL;
+            return -1;
+        }
+#endif // CONFIG_BT_NIMBLE_USE_ESP_TIMER
     }
     }
     else {
     else {
         callout = (struct ble_npl_callout_freertos *)co->co;
         callout = (struct ble_npl_callout_freertos *)co->co;
         BLE_LL_ASSERT(callout);
         BLE_LL_ASSERT(callout);
-	callout->evq = evq;
-	ble_npl_event_init(&callout->ev, ev_cb, ev_arg);
+        callout->evq = evq;
+        ble_npl_event_init(&callout->ev, ev_cb, ev_arg);
     }
     }
-#endif
-
+#endif // OS_MEM_ALLOC
+    return 0;
 }
 }
 
 
 void
 void
@@ -756,11 +777,14 @@ npl_freertos_callout_deinit(struct ble_npl_callout *co)
 
 
     /* Since we dynamically deinit timers, function can be called for NULL timers. Return for such scenarios */
     /* Since we dynamically deinit timers, function can be called for NULL timers. Return for such scenarios */
     if (!callout) {
     if (!callout) {
-	return;
+        return;
     }
     }
 
 
-    BLE_LL_ASSERT(callout->handle);
+    if (!callout->handle) {
+        return;
+    }
 
 
+    ble_npl_event_deinit(&callout->ev);
 #if CONFIG_BT_NIMBLE_USE_ESP_TIMER
 #if CONFIG_BT_NIMBLE_USE_ESP_TIMER
     esp_err_t err = esp_timer_stop(callout->handle);
     esp_err_t err = esp_timer_stop(callout->handle);
     if(err != ESP_OK) {
     if(err != ESP_OK) {
@@ -773,17 +797,13 @@ npl_freertos_callout_deinit(struct ble_npl_callout *co)
         ESP_LOGW(TAG, "Timer not deleted");
         ESP_LOGW(TAG, "Timer not deleted");
     }
     }
 #else
 #else
-
     xTimerDelete(callout->handle, portMAX_DELAY);
     xTimerDelete(callout->handle, portMAX_DELAY);
-    ble_npl_event_deinit(&callout->ev);
-
 #if OS_MEM_ALLOC
 #if OS_MEM_ALLOC
     os_memblock_put(&ble_freertos_co_pool,callout);
     os_memblock_put(&ble_freertos_co_pool,callout);
 #else
 #else
     free((void *)callout);
     free((void *)callout);
-#endif
-
-#endif
+#endif // OS_MEM_ALLOC
+#endif // CONFIG_BT_NIMBLE_USE_ESP_TIMER
     co->co = NULL;
     co->co = NULL;
     memset(co, 0, sizeof(struct ble_npl_callout));
     memset(co, 0, sizeof(struct ble_npl_callout));
 }
 }

+ 0 - 36
components/esp_rom/esp32c2/ld/esp32c2.rom.ld

@@ -575,8 +575,6 @@ r_ble_hci_trans_buf_alloc = 0x40000ae4;
 r_ble_hci_trans_buf_free = 0x40000ae8;
 r_ble_hci_trans_buf_free = 0x40000ae8;
 r_ble_hci_trans_cfg_hs = 0x40000aec;
 r_ble_hci_trans_cfg_hs = 0x40000aec;
 r_ble_hci_trans_cfg_ll = 0x40000af0;
 r_ble_hci_trans_cfg_ll = 0x40000af0;
-r_ble_hci_trans_deinit = 0x40000af4;
-r_ble_hci_trans_env_init = 0x40000af8;
 r_ble_hci_trans_init = 0x40000afc;
 r_ble_hci_trans_init = 0x40000afc;
 r_ble_hci_uart_acl_tx = 0x40000b00;
 r_ble_hci_uart_acl_tx = 0x40000b00;
 r_ble_hci_uart_cmdevt_tx = 0x40000b04;
 r_ble_hci_uart_cmdevt_tx = 0x40000b04;
@@ -602,8 +600,6 @@ r_ble_hci_uart_sync_lost = 0x40000b50;
 r_ble_hci_uart_trans_reset = 0x40000b54;
 r_ble_hci_uart_trans_reset = 0x40000b54;
 r_ble_hci_uart_tx_char = 0x40000b58;
 r_ble_hci_uart_tx_char = 0x40000b58;
 r_ble_hci_uart_tx_pkt_type = 0x40000b5c;
 r_ble_hci_uart_tx_pkt_type = 0x40000b5c;
-r_ble_hw_driver_deinit = 0x40000b60;
-r_ble_hw_driver_env_init = 0x40000b64;
 r_ble_hw_encrypt_block = 0x40000b68;
 r_ble_hw_encrypt_block = 0x40000b68;
 r_ble_hw_get_public_addr = 0x40000b6c;
 r_ble_hw_get_public_addr = 0x40000b6c;
 r_ble_hw_get_static_addr = 0x40000b70;
 r_ble_hw_get_static_addr = 0x40000b70;
@@ -641,7 +637,6 @@ r_ble_ll_adv_can_chg_whitelist = 0x40000bf0;
 r_ble_ll_adv_chk_rpa_timeout = 0x40000bf4;
 r_ble_ll_adv_chk_rpa_timeout = 0x40000bf4;
 r_ble_ll_adv_clear_all = 0x40000bf8;
 r_ble_ll_adv_clear_all = 0x40000bf8;
 r_ble_ll_adv_conn_req_rxd = 0x40000bfc;
 r_ble_ll_adv_conn_req_rxd = 0x40000bfc;
-r_ble_ll_adv_deinit = 0x40000c00;
 r_ble_ll_adv_enabled = 0x40000c04;
 r_ble_ll_adv_enabled = 0x40000c04;
 r_ble_ll_adv_ext_set_adv_data = 0x40000c0c;
 r_ble_ll_adv_ext_set_adv_data = 0x40000c0c;
 r_ble_ll_adv_ext_set_scan_rsp = 0x40000c18;
 r_ble_ll_adv_ext_set_scan_rsp = 0x40000c18;
@@ -695,7 +690,6 @@ r_ble_ll_adv_update_adv_scan_rsp_data = 0x40000d00;
 r_ble_ll_adv_update_data_mbuf = 0x40000d04;
 r_ble_ll_adv_update_data_mbuf = 0x40000d04;
 r_ble_ll_adv_update_did = 0x40000d08;
 r_ble_ll_adv_update_did = 0x40000d08;
 r_ble_ll_adv_update_periodic_data = 0x40000d0c;
 r_ble_ll_adv_update_periodic_data = 0x40000d0c;
-r_ble_ll_arr_pool_init = 0x40000d10;
 r_ble_ll_auth_pyld_tmo_event_send = 0x40000d14;
 r_ble_ll_auth_pyld_tmo_event_send = 0x40000d14;
 r_ble_ll_calc_offset_ticks_us_for_rampup = 0x40000d18;
 r_ble_ll_calc_offset_ticks_us_for_rampup = 0x40000d18;
 r_ble_ll_calc_session_key = 0x40000d1c;
 r_ble_ll_calc_session_key = 0x40000d1c;
@@ -732,7 +726,6 @@ r_ble_ll_conn_hci_disconnect_cmd = 0x40000da4;
 r_ble_ll_conn_hci_le_ltk_neg_reply = 0x40000da8;
 r_ble_ll_conn_hci_le_ltk_neg_reply = 0x40000da8;
 r_ble_ll_conn_hci_le_ltk_reply = 0x40000dac;
 r_ble_ll_conn_hci_le_ltk_reply = 0x40000dac;
 r_ble_ll_conn_hci_le_rd_phy = 0x40000db0;
 r_ble_ll_conn_hci_le_rd_phy = 0x40000db0;
-r_ble_ll_conn_hci_le_set_phy = 0x40000db4;
 r_ble_ll_conn_hci_le_start_encrypt = 0x40000db8;
 r_ble_ll_conn_hci_le_start_encrypt = 0x40000db8;
 r_ble_ll_conn_hci_param_nrr = 0x40000dbc;
 r_ble_ll_conn_hci_param_nrr = 0x40000dbc;
 r_ble_ll_conn_hci_param_rr = 0x40000dc0;
 r_ble_ll_conn_hci_param_rr = 0x40000dc0;
@@ -813,7 +806,6 @@ r_ble_ll_ctrl_terminate_start = 0x40000f2c;
 r_ble_ll_ctrl_update_features = 0x40000f34;
 r_ble_ll_ctrl_update_features = 0x40000f34;
 r_ble_ll_ctrl_version_ind_make = 0x40000f38;
 r_ble_ll_ctrl_version_ind_make = 0x40000f38;
 r_ble_ll_data_buffer_overflow = 0x40000f3c;
 r_ble_ll_data_buffer_overflow = 0x40000f3c;
-r_ble_ll_deinit = 0x40000f40;
 r_ble_ll_disconn_comp_event_send = 0x40000f44;
 r_ble_ll_disconn_comp_event_send = 0x40000f44;
 r_ble_ll_event_comp_pkts = 0x40000f4c;
 r_ble_ll_event_comp_pkts = 0x40000f4c;
 r_ble_ll_event_dbuf_overflow = 0x40000f50;
 r_ble_ll_event_dbuf_overflow = 0x40000f50;
@@ -826,7 +818,6 @@ r_ble_ll_ext_scan_parse_aux_ptr = 0x40000f68;
 r_ble_ll_flush_pkt_queue = 0x40000f6c;
 r_ble_ll_flush_pkt_queue = 0x40000f6c;
 r_ble_ll_generate_dh_key_v1 = 0x40000f70;
 r_ble_ll_generate_dh_key_v1 = 0x40000f70;
 r_ble_ll_generate_dh_key_v2 = 0x40000f74;
 r_ble_ll_generate_dh_key_v2 = 0x40000f74;
-r_ble_ll_generic_data_init = 0x40000f78;
 r_ble_ll_get_addr_type = 0x40000f7c;
 r_ble_ll_get_addr_type = 0x40000f7c;
 r_ble_ll_get_chan_to_scan = 0x40000f80;
 r_ble_ll_get_chan_to_scan = 0x40000f80;
 r_ble_ll_get_our_devaddr = 0x40000f84;
 r_ble_ll_get_our_devaddr = 0x40000f84;
@@ -842,9 +833,7 @@ r_ble_ll_hci_chk_phy_masks = 0x40000fa8;
 r_ble_ll_hci_cmd_proc = 0x40000fac;
 r_ble_ll_hci_cmd_proc = 0x40000fac;
 r_ble_ll_hci_cmd_rx = 0x40000fb0;
 r_ble_ll_hci_cmd_rx = 0x40000fb0;
 r_ble_ll_hci_ctlr_bb_cmd_proc = 0x40000fb4;
 r_ble_ll_hci_ctlr_bb_cmd_proc = 0x40000fb4;
-r_ble_ll_hci_deinit = 0x40000fb8;
 r_ble_ll_hci_disconnect = 0x40000fbc;
 r_ble_ll_hci_disconnect = 0x40000fbc;
-r_ble_ll_hci_env_init = 0x40000fc0;
 r_ble_ll_hci_ev_conn_update = 0x40000fc4;
 r_ble_ll_hci_ev_conn_update = 0x40000fc4;
 r_ble_ll_hci_ev_databuf_overflow = 0x40000fc8;
 r_ble_ll_hci_ev_databuf_overflow = 0x40000fc8;
 r_ble_ll_hci_ev_datalen_chg = 0x40000fcc;
 r_ble_ll_hci_ev_datalen_chg = 0x40000fcc;
@@ -920,8 +909,6 @@ r_ble_ll_phy_to_phy_mode = 0x400010f4;
 r_ble_ll_qa_enable = 0x400010f8;
 r_ble_ll_qa_enable = 0x400010f8;
 r_ble_ll_rand = 0x400010fc;
 r_ble_ll_rand = 0x400010fc;
 r_ble_ll_rand_data_get = 0x40001100;
 r_ble_ll_rand_data_get = 0x40001100;
-r_ble_ll_rand_deinit = 0x40001104;
-r_ble_ll_rand_env_init = 0x40001108;
 r_ble_ll_rand_init = 0x4000110c;
 r_ble_ll_rand_init = 0x4000110c;
 r_ble_ll_rand_prand_get = 0x40001110;
 r_ble_ll_rand_prand_get = 0x40001110;
 r_ble_ll_rand_sample = 0x40001114;
 r_ble_ll_rand_sample = 0x40001114;
@@ -933,10 +920,8 @@ r_ble_ll_read_supp_states = 0x40001128;
 r_ble_ll_reset = 0x40001130;
 r_ble_ll_reset = 0x40001130;
 r_ble_ll_resolv_clear_all_pl_bit = 0x40001134;
 r_ble_ll_resolv_clear_all_pl_bit = 0x40001134;
 r_ble_ll_resolv_clear_all_wl_bit = 0x40001138;
 r_ble_ll_resolv_clear_all_wl_bit = 0x40001138;
-r_ble_ll_resolv_deinit = 0x4000113c;
 r_ble_ll_resolv_enable_cmd = 0x40001140;
 r_ble_ll_resolv_enable_cmd = 0x40001140;
 r_ble_ll_resolv_enabled = 0x40001144;
 r_ble_ll_resolv_enabled = 0x40001144;
-r_ble_ll_resolv_env_init = 0x40001148;
 r_ble_ll_resolv_gen_rpa = 0x40001150;
 r_ble_ll_resolv_gen_rpa = 0x40001150;
 r_ble_ll_resolv_get_addr_pointer = 0x40001154;
 r_ble_ll_resolv_get_addr_pointer = 0x40001154;
 r_ble_ll_resolv_get_index = 0x40001158;
 r_ble_ll_resolv_get_index = 0x40001158;
@@ -944,7 +929,6 @@ r_ble_ll_resolv_get_irk_pointer = 0x4000115c;
 r_ble_ll_resolv_get_list = 0x40001160;
 r_ble_ll_resolv_get_list = 0x40001160;
 r_ble_ll_resolv_get_priv_addr = 0x40001164;
 r_ble_ll_resolv_get_priv_addr = 0x40001164;
 r_ble_ll_resolv_get_rpa_tmo = 0x40001168;
 r_ble_ll_resolv_get_rpa_tmo = 0x40001168;
-r_ble_ll_resolv_init = 0x4000116c;
 r_ble_ll_resolv_irk_nonzero = 0x40001170;
 r_ble_ll_resolv_irk_nonzero = 0x40001170;
 r_ble_ll_resolv_list_add = 0x40001174;
 r_ble_ll_resolv_list_add = 0x40001174;
 r_ble_ll_resolv_list_chg_allowed = 0x40001178;
 r_ble_ll_resolv_list_chg_allowed = 0x40001178;
@@ -991,7 +975,6 @@ r_ble_ll_scan_get_local_rpa = 0x40001220;
 r_ble_ll_scan_get_next_adv_prim_chan = 0x40001224;
 r_ble_ll_scan_get_next_adv_prim_chan = 0x40001224;
 r_ble_ll_scan_get_peer_rpa = 0x40001228;
 r_ble_ll_scan_get_peer_rpa = 0x40001228;
 r_ble_ll_scan_have_rxd_scan_rsp = 0x4000122c;
 r_ble_ll_scan_have_rxd_scan_rsp = 0x4000122c;
-r_ble_ll_scan_init = 0x40001230;
 r_ble_ll_scan_initiator_start = 0x40001234;
 r_ble_ll_scan_initiator_start = 0x40001234;
 r_ble_ll_scan_is_inside_window = 0x40001238;
 r_ble_ll_scan_is_inside_window = 0x40001238;
 r_ble_ll_scan_move_window_to = 0x4000123c;
 r_ble_ll_scan_move_window_to = 0x4000123c;
@@ -1025,9 +1008,7 @@ r_ble_ll_sync_cancel = 0x400012c4;
 r_ble_ll_sync_cancel_complete_event = 0x400012c8;
 r_ble_ll_sync_cancel_complete_event = 0x400012c8;
 r_ble_ll_sync_check_acad = 0x400012cc;
 r_ble_ll_sync_check_acad = 0x400012cc;
 r_ble_ll_sync_check_failed = 0x400012d0;
 r_ble_ll_sync_check_failed = 0x400012d0;
-r_ble_ll_sync_deinit = 0x400012d8;
 r_ble_ll_sync_enabled = 0x400012dc;
 r_ble_ll_sync_enabled = 0x400012dc;
-r_ble_ll_sync_env_init = 0x400012e0;
 r_ble_ll_sync_established = 0x400012ec;
 r_ble_ll_sync_established = 0x400012ec;
 r_ble_ll_sync_filter_enabled = 0x400012f0;
 r_ble_ll_sync_filter_enabled = 0x400012f0;
 r_ble_ll_sync_find = 0x400012f4;
 r_ble_ll_sync_find = 0x400012f4;
@@ -1060,7 +1041,6 @@ r_ble_ll_sync_terminate = 0x4000136c;
 r_ble_ll_sync_transfer = 0x40001370;
 r_ble_ll_sync_transfer = 0x40001370;
 r_ble_ll_sync_transfer_get = 0x40001374;
 r_ble_ll_sync_transfer_get = 0x40001374;
 r_ble_ll_sync_transfer_received = 0x40001378;
 r_ble_ll_sync_transfer_received = 0x40001378;
-r_ble_ll_task = 0x4000137c;
 r_ble_ll_trace_set_func = 0x40001380;
 r_ble_ll_trace_set_func = 0x40001380;
 r_ble_ll_trace_u32 = 0x40001384;
 r_ble_ll_trace_u32 = 0x40001384;
 r_ble_ll_trace_u32x2 = 0x40001388;
 r_ble_ll_trace_u32x2 = 0x40001388;
@@ -1109,7 +1089,6 @@ r_ble_lll_adv_periodic_event_done = 0x40001440;
 r_ble_lll_adv_periodic_rmvd_from_sched = 0x40001444;
 r_ble_lll_adv_periodic_rmvd_from_sched = 0x40001444;
 r_ble_lll_adv_periodic_schedule_first = 0x40001448;
 r_ble_lll_adv_periodic_schedule_first = 0x40001448;
 r_ble_lll_adv_periodic_start = 0x40001450;
 r_ble_lll_adv_periodic_start = 0x40001450;
-r_ble_lll_adv_periodic_stop = 0x40001454;
 r_ble_lll_adv_pri_schedule_tx_pdu = 0x40001458;
 r_ble_lll_adv_pri_schedule_tx_pdu = 0x40001458;
 r_ble_lll_adv_reschedule_event = 0x4000145c;
 r_ble_lll_adv_reschedule_event = 0x4000145c;
 r_ble_lll_adv_reschedule_periodic_event = 0x40001460;
 r_ble_lll_adv_reschedule_periodic_event = 0x40001460;
@@ -1147,8 +1126,6 @@ r_ble_lll_conn_coex_dpc_update_on_event_scheduled = 0x400014e4;
 r_ble_lll_conn_coex_dpc_update_on_event_started = 0x400014e8;
 r_ble_lll_conn_coex_dpc_update_on_event_started = 0x400014e8;
 r_ble_lll_conn_cth_flow_alloc_credit = 0x400014ec;
 r_ble_lll_conn_cth_flow_alloc_credit = 0x400014ec;
 r_ble_lll_conn_current_sm_over = 0x400014f4;
 r_ble_lll_conn_current_sm_over = 0x400014f4;
-r_ble_lll_conn_env_deinit = 0x400014fc;
-r_ble_lll_conn_env_init = 0x40001500;
 r_ble_lll_conn_event_end = 0x40001504;
 r_ble_lll_conn_event_end = 0x40001504;
 r_ble_lll_conn_event_end_timer_cb = 0x40001508;
 r_ble_lll_conn_event_end_timer_cb = 0x40001508;
 r_ble_lll_conn_event_halt = 0x4000150c;
 r_ble_lll_conn_event_halt = 0x4000150c;
@@ -1181,11 +1158,9 @@ r_ble_lll_conn_update_tx_buffer = 0x40001594;
 r_ble_lll_deinit = 0x40001598;
 r_ble_lll_deinit = 0x40001598;
 r_ble_lll_dtm_calculate_itvl = 0x4000159c;
 r_ble_lll_dtm_calculate_itvl = 0x4000159c;
 r_ble_lll_dtm_ctx_free = 0x400015a0;
 r_ble_lll_dtm_ctx_free = 0x400015a0;
-r_ble_lll_dtm_deinit = 0x400015a4;
 r_ble_lll_dtm_end_test = 0x400015a8;
 r_ble_lll_dtm_end_test = 0x400015a8;
 r_ble_lll_dtm_ev_rx_restart_cb = 0x400015ac;
 r_ble_lll_dtm_ev_rx_restart_cb = 0x400015ac;
 r_ble_lll_dtm_ev_tx_resched_cb = 0x400015b0;
 r_ble_lll_dtm_ev_tx_resched_cb = 0x400015b0;
-r_ble_lll_dtm_init = 0x400015b4;
 r_ble_lll_dtm_reset = 0x400015b8;
 r_ble_lll_dtm_reset = 0x400015b8;
 r_ble_lll_dtm_rx_create_ctx = 0x400015bc;
 r_ble_lll_dtm_rx_create_ctx = 0x400015bc;
 r_ble_lll_dtm_rx_isr_end = 0x400015c0;
 r_ble_lll_dtm_rx_isr_end = 0x400015c0;
@@ -1246,8 +1221,6 @@ r_ble_lll_scan_event_proc = 0x400016bc;
 r_ble_lll_scan_ext_adv_init = 0x400016c0;
 r_ble_lll_scan_ext_adv_init = 0x400016c0;
 r_ble_lll_scan_halt = 0x400016c4;
 r_ble_lll_scan_halt = 0x400016c4;
 r_ble_lll_scan_has_sent_scan_req = 0x400016c8;
 r_ble_lll_scan_has_sent_scan_req = 0x400016c8;
-r_ble_lll_scan_init = 0x400016cc;
-r_ble_lll_scan_npl_init = 0x400016d0;
 r_ble_lll_scan_npl_reset = 0x400016d4;
 r_ble_lll_scan_npl_reset = 0x400016d4;
 r_ble_lll_scan_npl_restore = 0x400016d8;
 r_ble_lll_scan_npl_restore = 0x400016d8;
 r_ble_lll_scan_npl_store = 0x400016dc;
 r_ble_lll_scan_npl_store = 0x400016dc;
@@ -1266,9 +1239,7 @@ r_ble_lll_sched_adv_reschedule = 0x40001724;
 r_ble_lll_sched_aux_scan = 0x40001728;
 r_ble_lll_sched_aux_scan = 0x40001728;
 r_ble_lll_sched_conn_overlap = 0x4000172c;
 r_ble_lll_sched_conn_overlap = 0x4000172c;
 r_ble_lll_sched_conn_reschedule = 0x40001730;
 r_ble_lll_sched_conn_reschedule = 0x40001730;
-r_ble_lll_sched_deinit = 0x40001734;
 r_ble_lll_sched_dtm = 0x40001738;
 r_ble_lll_sched_dtm = 0x40001738;
-r_ble_lll_sched_env_init = 0x4000173c;
 r_ble_lll_sched_execute_item = 0x40001744;
 r_ble_lll_sched_execute_item = 0x40001744;
 r_ble_lll_sched_init = 0x40001748;
 r_ble_lll_sched_init = 0x40001748;
 r_ble_lll_sched_insert_if_empty = 0x4000174c;
 r_ble_lll_sched_insert_if_empty = 0x4000174c;
@@ -1318,7 +1289,6 @@ r_ble_phy_disable_irq = 0x400017fc;
 r_ble_phy_disable_whitening = 0x40001800;
 r_ble_phy_disable_whitening = 0x40001800;
 r_ble_phy_enable_whitening = 0x40001804;
 r_ble_phy_enable_whitening = 0x40001804;
 r_ble_phy_encrypt_disable = 0x40001808;
 r_ble_phy_encrypt_disable = 0x40001808;
-r_ble_phy_env_init = 0x4000180c;
 r_ble_phy_get_current_phy = 0x40001810;
 r_ble_phy_get_current_phy = 0x40001810;
 r_ble_phy_get_packet_counter = 0x40001814;
 r_ble_phy_get_packet_counter = 0x40001814;
 r_ble_phy_get_packet_status = 0x40001818;
 r_ble_phy_get_packet_status = 0x40001818;
@@ -1329,9 +1299,7 @@ r_ble_phy_max_data_pdu_pyld = 0x40001830;
 r_ble_phy_mode_config = 0x40001834;
 r_ble_phy_mode_config = 0x40001834;
 r_ble_phy_mode_convert = 0x40001838;
 r_ble_phy_mode_convert = 0x40001838;
 r_ble_phy_mode_write = 0x4000183c;
 r_ble_phy_mode_write = 0x4000183c;
-r_ble_phy_module_deinit = 0x40001840;
 r_ble_phy_module_init = 0x40001844;
 r_ble_phy_module_init = 0x40001844;
-r_ble_phy_monitor_bb_sync = 0x40001848;
 r_ble_phy_reset_bb_monitor = 0x4000184c;
 r_ble_phy_reset_bb_monitor = 0x4000184c;
 r_ble_phy_resolv_list_disable = 0x40001850;
 r_ble_phy_resolv_list_disable = 0x40001850;
 r_ble_phy_resolv_list_enable = 0x40001854;
 r_ble_phy_resolv_list_enable = 0x40001854;
@@ -1396,10 +1364,7 @@ r_get_max_skip = 0x40001950;
 r_get_peer_id_offset = 0x40001954;
 r_get_peer_id_offset = 0x40001954;
 r_get_peer_irk_offset = 0x40001958;
 r_get_peer_irk_offset = 0x40001958;
 r_get_peer_rpa_offset = 0x4000195c;
 r_get_peer_rpa_offset = 0x4000195c;
-r_hal_rtc_intr_init = 0x40001960;
-r_hal_rtc_irq_handler = 0x40001964;
 r_hal_timer_disable_irq = 0x4000196c;
 r_hal_timer_disable_irq = 0x4000196c;
-r_hal_timer_env_init = 0x40001970;
 r_hal_timer_process = 0x40001978;
 r_hal_timer_process = 0x40001978;
 r_hal_timer_read = 0x4000197c;
 r_hal_timer_read = 0x4000197c;
 r_hal_timer_read_tick = 0x40001980;
 r_hal_timer_read_tick = 0x40001980;
@@ -1416,7 +1381,6 @@ r_mem_malloc_mempool = 0x400019ac;
 r_mem_malloc_mempool_ext = 0x400019b0;
 r_mem_malloc_mempool_ext = 0x400019b0;
 r_mem_malloc_mempool_gen = 0x400019b4;
 r_mem_malloc_mempool_gen = 0x400019b4;
 r_mem_pullup_obj = 0x400019b8;
 r_mem_pullup_obj = 0x400019b8;
-r_mem_split_frag = 0x400019bc;
 r_os_cputime_get32 = 0x400019c0;
 r_os_cputime_get32 = 0x400019c0;
 r_os_cputime_ticks_to_usecs = 0x400019c4;
 r_os_cputime_ticks_to_usecs = 0x400019c4;
 r_os_cputime_timer_init = 0x400019c8;
 r_os_cputime_timer_init = 0x400019c8;