User manual

UM0036 STice features
Doc ID 7705 Rev 11 279/385
Detecting dead code
When you run a coverage and profiling session, the areas of code that are not executed are
associated with a gray icon on the Functions/Instructions View tab in the Coverage and
Profiling Analysis window. There are two complementary methods for detecting dead
code:
By building the code. During the build, the linker removes any unused functions. This is
a static analysis.
By running a coverage and profiling session. This dynamic coverage analysis shows
the functions or logical blocks of code that are dependent upon conditions that never
occur.
Monitoring stack space usage
Run a coverage and profiling session with the option Data coverage and occurrence
profiling. In the Data View tab of the Coverage and Profiling Analysis window, click on
the Stack memory item and expand it to see detailed information on stack usage.
Figure 212. Stack memory in Data View tab of the Coverage and Profiling Analysis
Figure 213. Stack space details
By moving to the bottom of the stack, you can see how many bytes of stack have been used.
If you are sure you have executed your application in the case of maximum stack use, you
can decide to allocate some of your variables to the unused stack zone should the data
memory dedicated to variables be full.
This can also help you to know if your function nesting level can be increased or not.