cc3200: Shrink the FreeRTOS heap and place TCB+stack in freed location.
The 16k FreeRTOS heap originally had all TCBs and stacks dynamically allocated within it (plus semaphores and some other things). Now that xTaskCreateStatic is used instead of xTaskCreate, the TCBs and stacks are allocated statically and no longer use any of the FreeRTOS heap. Therefore, the FreeRTOS stack can be shrunk by the amount that has been made static. Furthermore, the TCBs and stack that are now static should be placed in the .rtos_heaps section of RAM because this RAM is treated specially by the bootloader (the bootloader executes from the first 16k of RAM and loads the firmware into the section starting after the 16k). After this patch the FreeRTOS heap (ucHeap) is 7200 bytes. The memory available for the MicroPython heap is 54936 bytes (including GC overhead).
This commit is contained in:
parent
e098eac195
commit
469c623bb8
|
@ -84,7 +84,13 @@
|
||||||
#define configCPU_CLOCK_HZ ( ( unsigned long ) 80000000 )
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 80000000 )
|
||||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 72 )
|
#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 configMAX_TASK_NAME_LEN ( 8 )
|
||||||
#define configUSE_TRACE_FACILITY 0
|
#define configUSE_TRACE_FACILITY 0
|
||||||
#define configUSE_16_BIT_TICKS 0
|
#define configUSE_16_BIT_TICKS 0
|
||||||
|
|
|
@ -50,6 +50,10 @@
|
||||||
DECLARE PRIVATE DATA
|
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
|
DECLARE PUBLIC DATA
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
@ -61,8 +65,8 @@ OsiTaskHandle mpTaskHandle;
|
||||||
uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8)));
|
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
|
// This is the static memory (TCB and stack) for the main MicroPython task
|
||||||
StaticTask_t mpTaskTCB;
|
StaticTask_t mpTaskTCB __attribute__ ((section (".rtos_heap")));
|
||||||
StackType_t mpTaskStack[MICROPY_TASK_STACK_LEN] __attribute__((aligned (8)));
|
StackType_t mpTaskStack[MICROPY_TASK_STACK_LEN] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8)));
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
DEFINE PUBLIC FUNCTIONS
|
DEFINE PUBLIC FUNCTIONS
|
||||||
|
@ -105,9 +109,6 @@ void stoupper (char *str) {
|
||||||
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
|
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
|
||||||
StackType_t **ppxIdleTaskStackBuffer,
|
StackType_t **ppxIdleTaskStackBuffer,
|
||||||
uint32_t *pulIdleTaskStackSize ) {
|
uint32_t *pulIdleTaskStackSize ) {
|
||||||
static StaticTask_t xIdleTaskTCB;
|
|
||||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
|
||||||
|
|
||||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||||
|
|
|
@ -67,8 +67,11 @@ static volatile bool sleep_sockets = false;
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
DECLARE PUBLIC DATA
|
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_user[SERVERS_USER_PASS_LEN_MAX + 1];
|
||||||
char servers_pass[SERVERS_USER_PASS_LEN_MAX + 1];
|
char servers_pass[SERVERS_USER_PASS_LEN_MAX + 1];
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,8 @@ TaskHandle_t xSimpleLinkSpawnTaskHndl = NULL;
|
||||||
#define SL_SPAWN_MAX_WAIT_MS ( 200 )
|
#define SL_SPAWN_MAX_WAIT_MS ( 200 )
|
||||||
|
|
||||||
// This is the static memory (TCB and stack) for the SL spawn task
|
// This is the static memory (TCB and stack) for the SL spawn task
|
||||||
static StaticTask_t spawnTaskTCB;
|
static StaticTask_t spawnTaskTCB __attribute__ ((section (".rtos_heap")));
|
||||||
static portSTACK_TYPE spawnTaskStack[896 / sizeof(portSTACK_TYPE)] __attribute__((aligned (8)));
|
static portSTACK_TYPE spawnTaskStack[896 / sizeof(portSTACK_TYPE)] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8)));
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief This function registers an interrupt in NVIC table
|
\brief This function registers an interrupt in NVIC table
|
||||||
|
|
Loading…
Reference in New Issue