reduce task stack size

- ble      task from 512*3 -> 256*5
- loop     task from 512*3 -> 256*4
- callback task from 512*2 -> 256*3
- usbd     task from 150   -> 200
This commit is contained in:
hathach committed 2019-09-19 16:42:36 +07:00
1 parent 8395b5e8e4
commit 2a4185573b
7 files changed
+19 -20

No files matched your search

@@ -34,7 +34,7 @@
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
//--------------------------------------------------------------------+
#define USBD_STACK_SZ (150)
#define USBD_STACK_SZ (200)
// tinyusb function that handles power event (detected, ready, removed)
// We must call it within SD's SOC event handler, or set it as power event handler if SD is not enabled.
-1
View File
@@ -14,7 +14,6 @@ MEMORY
* - Concurrent connection peripheral + central + secure links
* - Event Len, HVN queue, Write CMD queue
*/
/* RAM (rwx) : ORIGIN = 0x20003200, LENGTH = 0x20010000 - 0x20003200 */
RAM (rwx) : ORIGIN = 0x20003400, LENGTH = 0x20010000 - 0x20003400
}
+3 -2
View File
@@ -37,7 +37,8 @@ static TaskHandle_t _loopHandle;
void initVariant() __attribute__((weak));
void initVariant() { }
#define LOOP_STACK_SZ (512*3)
#define LOOP_STACK_SZ (256*4)
#define CALLBACK_STACK_SZ (256*3)
static void loop_task(void* arg)
{
@@ -81,7 +82,7 @@ int main( void )
xTaskCreate( loop_task, "loop", LOOP_STACK_SZ, NULL, TASK_PRIO_LOW, &_loopHandle);
// Initialize callback task
ada_callback_init();
ada_callback_init(CALLBACK_STACK_SZ);
// Start FreeRTOS scheduler.
vTaskStartScheduler();
+1
View File
@@ -94,6 +94,7 @@ void yield(void)
void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName )
{
LOG_LV1("RTOS", "%s Stack Overflow !!!", pcTaskName);
while(1) yield();
}
void vApplicationMallocFailedHook(void)
+2 -2
View File
@@ -134,14 +134,14 @@ void ada_callback_invoke(const void* malloc_data, uint32_t malloc_len, const voi
ada_callback_queue(cb_data);
}
void ada_callback_init(void)
void ada_callback_init(uint32_t stack_sz)
{
// queue to hold "Pointer to callback data"
_cb_qdepth = INITIAL_QUEUE_DEPTH;
_cb_queue = xQueueCreate(_cb_qdepth, sizeof(void*));
TaskHandle_t callback_task_hdl;
xTaskCreate( adafruit_callback_task, "Callback", CFG_CALLBACK_TASK_STACKSIZE, NULL, TASK_PRIO_NORMAL, &callback_task_hdl);
xTaskCreate( adafruit_callback_task, "Callback", stack_sz, NULL, TASK_PRIO_NORMAL, &callback_task_hdl);
}
bool ada_callback_queue_resize(uint32_t new_depth)
+1 -5
View File
@@ -38,10 +38,6 @@
#include "common_inc.h"
#ifndef CFG_CALLBACK_TASK_STACKSIZE
#define CFG_CALLBACK_TASK_STACKSIZE (512*2)
#endif
#ifndef CFG_CALLBACK_TIMEOUT
#define CFG_CALLBACK_TIMEOUT 100
#endif
@@ -107,7 +103,7 @@ typedef void (*adacb_5arg_t) (uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
#define ada_callback(...) _cb_setup(__VA_ARGS__)
void ada_callback_init(void);
void ada_callback_init(uint32_t stack_sz);
void ada_callback_invoke(const void* mdata, uint32_t mlen, const void* func, uint32_t arguments[], uint8_t argcount);
void ada_callback_queue(ada_callback_t* cb_item);
bool ada_callback_queue_resize(uint32_t new_depth);
+11 -9
View File
@@ -38,20 +38,19 @@
#include "utility/bonding.h"
#ifndef CFG_BLE_TX_POWER_LEVEL
#define CFG_BLE_TX_POWER_LEVEL 0
#define CFG_BLE_TX_POWER_LEVEL 0
#endif
#ifndef CFG_DEFAULT_NAME
#define CFG_DEFAULT_NAME "Bluefruit52"
#define CFG_DEFAULT_NAME "Bluefruit52"
#endif
#ifndef CFG_BLE_TASK_STACKSIZE
#define CFG_BLE_TASK_STACKSIZE (512*3)
#define CFG_BLE_TASK_STACKSIZE (256*5)
#endif
#ifndef CFG_SOC_TASK_STACKSIZE
#define CFG_SOC_TASK_STACKSIZE (200)
#define CFG_SOC_TASK_STACKSIZE (200)
#endif
#ifdef USE_TINYUSB
@@ -103,7 +102,6 @@ static void bluefruit_blinky_cb( TimerHandle_t xTimer )
digitalToggle(LED_BLUE);
}
static void nrf_error_cb(uint32_t id, uint32_t pc, uint32_t info)
{
#if CFG_DEBUG
@@ -743,13 +741,14 @@ void adafruit_ble_task(void* arg)
{
(void) arg;
// malloc buffered is algined by 4
uint8_t * ev_buf = (uint8_t*) rtos_malloc(BLE_EVT_LEN_MAX(BLE_GATT_ATT_MTU_MAX));
while (1)
{
if ( xSemaphoreTake(Bluefruit._ble_event_sem, portMAX_DELAY) )
{
uint32_t err = ERROR_NONE;
uint32_t err = NRF_SUCCESS;
// Until no pending events
while( NRF_ERROR_NOT_FOUND != err )
@@ -759,10 +758,13 @@ void adafruit_ble_task(void* arg)
// Get BLE Event
err = sd_ble_evt_get(ev_buf, &ev_len);
// Handle valid event, ignore error
if( ERROR_NONE == err)
// Handle valid event
if( NRF_SUCCESS == err)
{
Bluefruit._ble_handler( (ble_evt_t*) ev_buf );
}else if ( NRF_ERROR_NOT_FOUND != err )
{
LOG_LV1("BLE", "SD event error %s", dbg_err_str(err));
}
}
}