To set hardware tracepoints in the source code and collect trace data on the Kinetis Cortex M0+ project:
#include "derivative.h" /* include peripheral declarations */ #define MAX_IT 5 #define SIMPLE typedef int(*FUNC_TYPE)(int); void Launch(FUNC_TYPE, int); void entry(); void InterruptTest(); int PerformanceWork(int); void Performance1(void); int Recursive(int); volatile char iteration = 0; void InterruptTest() { } void Launch(FUNC_TYPE f, int arg) { f(arg); } void entry() { Performance1(); Recursive(1); Performance1(); for (;iteration < MAX_IT;) { InterruptTest(); Recursive(1); Performance1(); Launch(PerformanceWork, iteration++); } for (;;) { if (iteration >= 255) iteration = 0; } /* loop forever */ } int PerformanceWork (int iteration) { int ret = 0; if ( iteration & 1) { Performance1(); ret = 1; } else { Recursive(1); ret = 2; } return ret; } void Performance1(void) { #ifndef SIMPLE int vecSize = 10; int vec[]={10,9,8,7,6,5,4,3,2,1}; int i,aux; for (i=0; i<(vecSize/2) ;i++) { aux = vec[i]; vec[i] = vec[vecSize-i-1]; vec[vecSize-i-1] = aux; } #endif } int Recursive(int n) { /* Recursively calculates 0 + 1 + 2 + ... + n */ if (n <= 0) { return 0; } else { return (n + Recursive(n-1)); } } int main(void) { entry(); /* please make sure that you never leave main */ }

The Software Analysis view appears.