From e098eac19552a5a399ffbfae44e4b329ca623d0d Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 5 Jun 2016 12:57:18 +0100 Subject: [PATCH] cc3200: Start the simplelink spawn task using the static task creator. In VStartSimpleLinkSpawnTask we change xTaskCreate to xTaskCreateStatic so that the task is created using statically allocated memory for the TCB and stack. This means that xTaskCreate function is no longer needed (the static version is now used exclusively). --- cc3200/simplelink/oslib/osi_freertos.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cc3200/simplelink/oslib/osi_freertos.c b/cc3200/simplelink/oslib/osi_freertos.c index 0475359d09..90acc2e979 100644 --- a/cc3200/simplelink/oslib/osi_freertos.c +++ b/cc3200/simplelink/oslib/osi_freertos.c @@ -61,6 +61,10 @@ TaskHandle_t xSimpleLinkSpawnTaskHndl = NULL; #define slQUEUE_SIZE ( 3 ) #define SL_SPAWN_MAX_WAIT_MS ( 200 ) +// This is the static memory (TCB and stack) for the SL spawn task +static StaticTask_t spawnTaskTCB; +static portSTACK_TYPE spawnTaskStack[896 / sizeof(portSTACK_TYPE)] __attribute__((aligned (8))); + /*! \brief This function registers an interrupt in NVIC table @@ -453,8 +457,19 @@ OsiReturnVal_e VStartSimpleLinkSpawnTask(unsigned portBASE_TYPE uxPriority) xSimpleLinkSpawnQueue = xQueueCreate( slQUEUE_SIZE, sizeof( tSimpleLinkSpawnMsg ) ); ASSERT (xSimpleLinkSpawnQueue != NULL); + /* + // This is the original code to create a task dynamically ASSERT (pdPASS == xTaskCreate( vSimpleLinkSpawnTask, ( portCHAR * ) "SLSPAWN",\ 896 / sizeof(portSTACK_TYPE), NULL, uxPriority, &xSimpleLinkSpawnTaskHndl )); + */ + + // This code creates the task using static memory for the TCB and stack + xSimpleLinkSpawnTaskHndl = xTaskCreateStatic( + vSimpleLinkSpawnTask, ( portCHAR * ) "SLSPAWN", + 896 / sizeof(portSTACK_TYPE), NULL, uxPriority, + spawnTaskStack, &spawnTaskTCB); + + ASSERT(xSimpleLinkSpawnTaskHndl != NULL); return OSI_OK; }