CLI Task Memory

By default, the CLI task stack is 720 bytes (180 4-byte words - see cli_task.h). Variables declared in CLI handlers are allocated from the CLI task's stack, so allocating large data structures inside a CLI handler can result in overflowing the CLI task's stack. When this happens, an assert can occur in cli_task.c after exiting the handler - the assert trace will show the CLI task at 100% use.

It is possible to increase the CLI task stack size, but remember that the CLI source is common across all samples (it is found in /src/common/), and so increasing the CLI stack size to fix one app could cause another memory constrained application to break.  Declaring CLI handler variables as globals  will move their storage to RAM that is statically allocated at compile time, so it is easier to catch allocation problems.