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 2022/06/27 07:18:29 UTC

[mynewt-nimble] branch master updated: nimble/ll: Make LL task stack size configurable

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 dc5a32f3 nimble/ll: Make LL task stack size configurable
dc5a32f3 is described below

commit dc5a32f3b8bbc7420926a1b44161fc5b63a243d0
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Mon Jun 20 16:16:22 2022 +0200

    nimble/ll: Make LL task stack size configurable
    
    This commit makes LL stack size configurable. Depending on compiler and
    platform default value may not be enough. It was reported that on nRF52840
    90 words is not enough even if Ext Adv is disabled. To keep things simple
    lets just increase default stack size to 120 word for all usecases (with
    exception of nRF51 where defults to 96 bytes).
---
 babblesim/hw/bsp/nrf52_bsim/syscfg.yml       |  1 +
 nimble/controller/src/ble_ll.c               | 15 ++-------------
 nimble/controller/syscfg.yml                 |  5 +++++
 nimble/drivers/nrf51/pkg.yml                 |  3 +++
 nimble/drivers/nrf51/{pkg.yml => syscfg.yml} | 14 ++------------
 5 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/babblesim/hw/bsp/nrf52_bsim/syscfg.yml b/babblesim/hw/bsp/nrf52_bsim/syscfg.yml
index 5a45e9d0..c73106f3 100644
--- a/babblesim/hw/bsp/nrf52_bsim/syscfg.yml
+++ b/babblesim/hw/bsp/nrf52_bsim/syscfg.yml
@@ -72,3 +72,4 @@ syscfg.vals.BLE_CONTROLLER:
     OS_CPUTIME_FREQ: 32768
     OS_CPUTIME_TIMER_NUM: 5
     BLE_LL_RFMGMT_ENABLE_TIME: 1500
+    BLE_LL_STACK_SIZE: 4000
diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index b4de889e..cb6a6dc4 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -358,21 +358,10 @@ static void ble_ll_event_dbuf_overflow(struct ble_npl_event *ev);
 #endif
 
 #if MYNEWT
-
-#if BABBLESIM
-#define BLE_LL_STACK_SIZE   (4000)
-#else
 /* The BLE LL task data structure */
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-#define BLE_LL_STACK_SIZE   (120)
-#else
-#define BLE_LL_STACK_SIZE   (90)
-#endif
-#endif
-
 struct os_task g_ble_ll_task;
 
-OS_TASK_STACK_DEFINE(g_ble_ll_stack, BLE_LL_STACK_SIZE);
+OS_TASK_STACK_DEFINE(g_ble_ll_stack, MYNEWT_VAL(BLE_LL_STACK_SIZE));
 
 #endif /* MYNEWT */
 
@@ -1991,7 +1980,7 @@ ble_ll_init(void)
     /* Initialize the LL task */
     os_task_init(&g_ble_ll_task, "ble_ll", ble_ll_task, NULL,
                  MYNEWT_VAL(BLE_LL_PRIO), OS_WAIT_FOREVER, g_ble_ll_stack,
-                 BLE_LL_STACK_SIZE);
+                 MYNEWT_VAL(BLE_LL_STACK_SIZE));
 #else
 
 /*
diff --git a/nimble/controller/syscfg.yml b/nimble/controller/syscfg.yml
index 841380f9..45fb461f 100644
--- a/nimble/controller/syscfg.yml
+++ b/nimble/controller/syscfg.yml
@@ -493,6 +493,11 @@ syscfg.defs:
         range: 1..257
         value: 32
 
+    BLE_LL_STACK_SIZE:
+        description: >
+              This is the stack size for LL task.
+        value: 120
+
 syscfg.vals.BLE_LL_CFG_FEAT_LL_EXT_ADV:
     BLE_LL_CFG_FEAT_LE_CSA2: 1
     BLE_HW_WHITELIST_ENABLE: 0
diff --git a/nimble/drivers/nrf51/pkg.yml b/nimble/drivers/nrf51/pkg.yml
index 816a5635..9311093b 100644
--- a/nimble/drivers/nrf51/pkg.yml
+++ b/nimble/drivers/nrf51/pkg.yml
@@ -29,3 +29,6 @@ pkg.apis: ble_driver
 pkg.deps:
     - nimble
     - nimble/controller
+
+# allows to override nimble/controller settings
+pkg.subpriority: 1
diff --git a/nimble/drivers/nrf51/pkg.yml b/nimble/drivers/nrf51/syscfg.yml
similarity index 73%
copy from nimble/drivers/nrf51/pkg.yml
copy to nimble/drivers/nrf51/syscfg.yml
index 816a5635..451742a6 100644
--- a/nimble/drivers/nrf51/pkg.yml
+++ b/nimble/drivers/nrf51/syscfg.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -17,15 +16,6 @@
 # under the License.
 #
 
-pkg.name: nimble/drivers/nrf51
-pkg.description: BLE driver for nRF51 systems.
-pkg.author: "Apache Mynewt <de...@mynewt.apache.org>"
-pkg.homepage: "http://mynewt.apache.org/"
-pkg.keywords:
-    - ble
-    - bluetooth
 
-pkg.apis: ble_driver
-pkg.deps:
-    - nimble
-    - nimble/controller
+syscfg.vals.!BLE_LL_CFG_FEAT_LL_EXT_ADV:
+    BLE_LL_STACK_SIZE: 96