From 870389b3ba548af30cfefc961aa86a03c45d4396 Mon Sep 17 00:00:00 2001 From: wangmengyang Date: Mon, 6 Mar 2017 21:50:54 +0800 Subject: [PATCH] component/bt: optimize stack size of Bluetooth Tasks and make them be configurable according to the CONFIG_NEWLIB_NANO_FORMAT option --- components/bt/bluedroid/osi/include/thread.h | 34 ++++++++++---------- components/esp32/include/esp_task.h | 8 ++++- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/components/bt/bluedroid/osi/include/thread.h b/components/bt/bluedroid/osi/include/thread.h index 61e9487eaf..01df953889 100644 --- a/components/bt/bluedroid/osi/include/thread.h +++ b/components/bt/bluedroid/osi/include/thread.h @@ -20,7 +20,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/queue.h" #include "freertos/task.h" - +#include "esp_task.h" #include "bt_defs.h" #define portBASE_TYPE int @@ -43,25 +43,25 @@ enum { SIG_BTIF_WORK = 0xff }; -#define HCI_HOST_TASK_STACK_SIZE 1500 -#define HCI_HOST_TASK_PRIO (configMAX_PRIORITIES - 2) -#define HCI_HOST_TASK_NAME "hciHostT" -#define HCI_HOST_QUEUE_NUM 40 +#define HCI_HOST_TASK_STACK_SIZE (2048 + BT_TASK_EXTRA_STACK_SIZE) +#define HCI_HOST_TASK_PRIO (configMAX_PRIORITIES - 2) +#define HCI_HOST_TASK_NAME "hciHostT" +#define HCI_HOST_QUEUE_NUM 40 -#define HCI_H4_TASK_STACK_SIZE 1500 -#define HCI_H4_TASK_PRIO (configMAX_PRIORITIES - 3) -#define HCI_H4_TASK_NAME "hciH4T" -#define HCI_H4_QUEUE_NUM 60 +#define HCI_H4_TASK_STACK_SIZE (2048 + BT_TASK_EXTRA_STACK_SIZE) +#define HCI_H4_TASK_PRIO (configMAX_PRIORITIES - 3) +#define HCI_H4_TASK_NAME "hciH4T" +#define HCI_H4_QUEUE_NUM 60 -#define BTU_TASK_STACK_SIZE 4096 -#define BTU_TASK_PRIO (configMAX_PRIORITIES - 4) -#define BTU_TASK_NAME "btuT" -#define BTU_QUEUE_NUM 50 +#define BTU_TASK_STACK_SIZE (3584 + BT_TASK_EXTRA_STACK_SIZE) +#define BTU_TASK_PRIO (configMAX_PRIORITIES - 4) +#define BTU_TASK_NAME "btuT" +#define BTU_QUEUE_NUM 50 -#define BTC_TASK_STACK_SIZE CONFIG_BTC_TASK_STACK_SIZE //by menuconfig -#define BTC_TASK_NAME "btcT" -#define BTC_TASK_PRIO (configMAX_PRIORITIES - 5) -#define BTC_TASK_QUEUE_NUM 20 +#define BTC_TASK_STACK_SIZE (CONFIG_BTC_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) //by menuconfig +#define BTC_TASK_NAME "btcT" +#define BTC_TASK_PRIO (configMAX_PRIORITIES - 5) +#define BTC_TASK_QUEUE_NUM 20 void btu_task_post(uint32_t sig); void hci_host_task_post(void); diff --git a/components/esp32/include/esp_task.h b/components/esp32/include/esp_task.h index 04f3178a19..bd26362649 100644 --- a/components/esp32/include/esp_task.h +++ b/components/esp32/include/esp_task.h @@ -34,7 +34,13 @@ /* Bt contoller Task */ /* controller */ #define ESP_TASK_BT_CONTROLLER_PRIO (ESP_TASK_PRIO_MAX - 1) -#define ESP_TASK_BT_CONTROLLER_STACK 4096 +#ifdef CONFIG_NEWLIB_NANO_FORMAT +#define BT_TASK_EXTRA_STACK_SIZE (0) +#else +#define BT_TASK_EXTRA_STACK_SIZE (512) +#endif +#define ESP_TASK_BT_CONTROLLER_STACK (3584 + BT_TASK_EXTRA_STACK_SIZE) + /* idf task */ #define ESP_TASKD_EVENT_PRIO (ESP_TASK_PRIO_MAX - 5) -- 2.40.0