You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2020/11/13 14:29:26 UTC

[mynewt-nimble] branch master updated: nimble/ll: Do LL task sanity check on HCI Reset

This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new ee75702  nimble/ll: Do LL task sanity check on HCI Reset
ee75702 is described below

commit ee75702877d73960dc8a64a4ad4afc0b23f63af1
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Tue Nov 26 17:00:15 2019 +0100

    nimble/ll: Do LL task sanity check on HCI Reset
    
    This allows to catch LL task stack overflows easily.
---
 nimble/controller/src/ble_ll.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index 55cb60c..09f1e4c 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -1363,6 +1363,20 @@ ble_ll_mbuf_init(struct os_mbuf *m, uint8_t pdulen, uint8_t hdr)
     ble_hdr->txinfo.hdr_byte = hdr;
 }
 
+static void
+ble_ll_validate_task(void)
+{
+#ifdef MYNEWT
+#ifndef NDEBUG
+    struct os_task_info oti;
+
+    os_task_info_get(&g_ble_ll_task, &oti);
+
+    BLE_LL_ASSERT(oti.oti_stkusage < oti.oti_stksize);
+#endif
+#endif
+}
+
 /**
  * Called to reset the controller. This performs a "software reset" of the link
  * layer; it does not perform a HW reset of the controller nor does it reset
@@ -1379,6 +1393,9 @@ ble_ll_reset(void)
     int rc;
     os_sr_t sr;
 
+    /* do sanity check on LL task stack */
+    ble_ll_validate_task();
+
     OS_ENTER_CRITICAL(sr);
     ble_phy_disable();
     ble_ll_sched_stop();