diff --git a/cc3200/FreeRTOS/FreeRTOSConfig.h b/cc3200/FreeRTOS/FreeRTOSConfig.h index c0d50d0c1d..2f25bbd7e8 100644 --- a/cc3200/FreeRTOS/FreeRTOSConfig.h +++ b/cc3200/FreeRTOS/FreeRTOSConfig.h @@ -84,7 +84,13 @@ #define configCPU_CLOCK_HZ ( ( unsigned long ) 80000000 ) #define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 72 ) -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 16384 ) ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( \ + 16384 /* 16kbytes for FreeRTOS data structures and heap */ \ + - sizeof(StaticTask_t) - configMINIMAL_STACK_SIZE * sizeof(StackType_t) /* TCB+stack for idle task */ \ + - sizeof(StaticTask_t) - 1024 /* TCB+stack for servers task */ \ + - sizeof(StaticTask_t) - 6656 /* TCB+stack for main MicroPython task */ \ + - sizeof(StaticTask_t) - 896 /* TCB+stack for simplelink spawn task */ \ + ) ) #define configMAX_TASK_NAME_LEN ( 8 ) #define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 0 diff --git a/cc3200/main.c b/cc3200/main.c index da6c5211b2..06b3604b67 100644 --- a/cc3200/main.c +++ b/cc3200/main.c @@ -50,6 +50,10 @@ DECLARE PRIVATE DATA ******************************************************************************/ +// This is the static memory (TCB and stack) for the idle task +static StaticTask_t xIdleTaskTCB __attribute__ ((section (".rtos_heap"))); +static StackType_t uxIdleTaskStack[configMINIMAL_STACK_SIZE] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8))); + /****************************************************************************** DECLARE PUBLIC DATA ******************************************************************************/ @@ -61,8 +65,8 @@ OsiTaskHandle mpTaskHandle; uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8))); // This is the static memory (TCB and stack) for the main MicroPython task -StaticTask_t mpTaskTCB; -StackType_t mpTaskStack[MICROPY_TASK_STACK_LEN] __attribute__((aligned (8))); +StaticTask_t mpTaskTCB __attribute__ ((section (".rtos_heap"))); +StackType_t mpTaskStack[MICROPY_TASK_STACK_LEN] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8))); /****************************************************************************** DEFINE PUBLIC FUNCTIONS @@ -105,9 +109,6 @@ void stoupper (char *str) { void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) { - static StaticTask_t xIdleTaskTCB; - static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; *ppxIdleTaskStackBuffer = uxIdleTaskStack; *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; diff --git a/cc3200/serverstask.c b/cc3200/serverstask.c index 8bac3a756a..1305afda0b 100644 --- a/cc3200/serverstask.c +++ b/cc3200/serverstask.c @@ -67,8 +67,11 @@ static volatile bool sleep_sockets = false; /****************************************************************************** DECLARE PUBLIC DATA ******************************************************************************/ -StaticTask_t svTaskTCB; -StackType_t svTaskStack[SERVERS_STACK_LEN] __attribute__((aligned (8))); + +// This is the static memory (TCB and stack) for the servers task +StaticTask_t svTaskTCB __attribute__ ((section (".rtos_heap"))); +StackType_t svTaskStack[SERVERS_STACK_LEN] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8))); + char servers_user[SERVERS_USER_PASS_LEN_MAX + 1]; char servers_pass[SERVERS_USER_PASS_LEN_MAX + 1]; diff --git a/cc3200/simplelink/oslib/osi_freertos.c b/cc3200/simplelink/oslib/osi_freertos.c index 90acc2e979..53822add73 100644 --- a/cc3200/simplelink/oslib/osi_freertos.c +++ b/cc3200/simplelink/oslib/osi_freertos.c @@ -62,8 +62,8 @@ TaskHandle_t xSimpleLinkSpawnTaskHndl = NULL; #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))); +static StaticTask_t spawnTaskTCB __attribute__ ((section (".rtos_heap"))); +static portSTACK_TYPE spawnTaskStack[896 / sizeof(portSTACK_TYPE)] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8))); /*! \brief This function registers an interrupt in NVIC table