diff options
author | JF <jf@codingfield.com> | 2020-07-11 21:09:34 +0200 |
---|---|---|
committer | JF <jf@codingfield.com> | 2020-07-11 21:09:34 +0200 |
commit | 64c14274fc2f025fc48d3df47a1640f08eb968cd (patch) | |
tree | 262cf8b4e84c556748f42bbf778b48a68210921d /src/libs/mynewt-nimble/porting | |
parent | 0bcaf9c22d6183ba8072e10abb9da7aea578b8db (diff) | |
parent | 6309719a62436fd746a7a8b228205e93b419ca26 (diff) |
Merge branch 'develop'
# Conflicts:
# CMakeLists.txt
Diffstat (limited to 'src/libs/mynewt-nimble/porting')
-rw-r--r-- | src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c | 4 | ||||
-rw-r--r-- | src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c b/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c index 8ee3475a..64196b36 100644 --- a/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c +++ b/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c @@ -37,7 +37,7 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn) * provided by NimBLE and in case of FreeRTOS it does not need to be wrapped * since it has compatible prototype. */ - xTaskCreate(nimble_port_ll_task_func, "ll", configMINIMAL_STACK_SIZE + 400, + xTaskCreate(nimble_port_ll_task_func, "ll", configMINIMAL_STACK_SIZE + 100, NULL, configMAX_PRIORITIES - 1, &ll_task_h); #endif @@ -46,6 +46,6 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn) * have separate task for NimBLE host, but since something needs to handle * default queue it is just easier to make separate task which does this. */ - xTaskCreate(host_task_fn, "ble", configMINIMAL_STACK_SIZE + 400, + xTaskCreate(host_task_fn, "ble", configMINIMAL_STACK_SIZE + 200, NULL, tskIDLE_PRIORITY + 1, &host_task_h); } diff --git a/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c b/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c index 2bbcc598..eb3b4c99 100644 --- a/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c +++ b/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c @@ -20,7 +20,6 @@ #include <assert.h> #include <stddef.h> #include <string.h> -#include <sdk/components/libraries/log/nrf_log.h> #include "nimble/nimble_npl.h" static inline bool @@ -269,10 +268,16 @@ void npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq, ble_npl_event_fn *ev_cb, void *ev_arg) { + // I added this 'if' because nimble seems to never delete the timers. I assume it wants to recycle them. + // This condition ensure that a new timer is created only if 'co' points to an uninitialized structure. + // If the struct contains an existing timer, no new timer is created, which prevent a significant memory leak. + // TODO Ensure that this workaround is valid and does not generate bad side-effect. + if(co->handle == NULL) { memset(co, 0, sizeof(*co)); co->handle = xTimerCreate("co", 1, pdFALSE, co, os_callout_timer_cb); co->evq = evq; ble_npl_event_init(&co->ev, ev_cb, ev_arg); + } } ble_npl_error_t |