summaryrefslogtreecommitdiff
path: root/cc3200/FreeRTOS/FreeRTOSConfig.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-06-05 13:01:16 +0100
committerDamien George <damien.p.george@gmail.com>2016-06-28 11:28:53 +0100
commit469c623bb8e504ca78f1964508579ecefec76a98 (patch)
tree3347d3eb3aee396c37fe5069fb028801064366d6 /cc3200/FreeRTOS/FreeRTOSConfig.h
parente098eac19552a5a399ffbfae44e4b329ca623d0d (diff)
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).
Diffstat (limited to 'cc3200/FreeRTOS/FreeRTOSConfig.h')
-rw-r--r--cc3200/FreeRTOS/FreeRTOSConfig.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/cc3200/FreeRTOS/FreeRTOSConfig.h b/cc3200/FreeRTOS/FreeRTOSConfig.h
index c0d50d0c1..2f25bbd7e 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