TI-RTOS

An overview of the (in CCS hidden) structure of SYS/BIOS and XDC can be found here.

…are some of the most frustrating and frequent runtime errors, if you forget about them!

Always check if all task stack sizes, as well as system stack are well above their peak values during runtime. In debug mode, check out the ROV (RTOS object viewer) from Tools → ROV. Navigate to “Viewable Modules” → “Task” → “Detailed” to see the individual task stack sizes and peaks. Always keep a good safety margin, but make sure there is enough total stack for the system. Task stack sizes are changed right at the task definition section (in the *.cfg file or in your main() function).

Also in the ROV, double-check the heap size under “HeapMem” → “Detailed” and make sure to have more than zero free heap space. If you need to increase it, do this in the *.cfg file (ctrl+f for heap).

More details on stack and heap sizes can be found on the TI wiki

Some interesting sections in the ROV concerning timers that are currently running:

Considering our System clock is running at 48MHz, one clock cycle is around 20ns. Context Switch for tasks need in the order of 300 cycles (6us), HWI around 100 cycles (2us). More information on these timing benchmarks can be found here.

By default, the Task_sleep timing mechanism is based on the Clock module. The default granularity of the kernel's Clock tick is 1 ms

These numbers should be kept in mind when there is a wait period in the code and the developper wonders whether calling Task_sleep() would be useful or not.