Reply
Highlighted
Posts: 1
Registered: ‎03-20-2017

Simplicity Studio v4 Energy Profiler Code Correlation

Hello,

 

I've been working with Simplicity Studio v4 for a few days now. I am trying out the energy profiler for my EFM32 Giant Gecko STK3700.

 

When I open a demo program, for example STK3700_energy, I can measure the powerconsumption over the code. I can see the code correlation in the window below.

 

When I define my own custom function for example "void IAmAFunction()" with a body of {int a = 0; a += 1} I want to see the power consumption over this function. However this is not working, I am getting a code correlation of "<Unknow function> 100%" As to see in the screenshot below.

 

I have set the SWO and the function for BSP is set in my main (as to see in the code I have added below)

 

I need to get this working. What do I do?

 

code snippet:

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
/* CMSIS package */
#include "em_device.h"
/* emlib */
#include "em_cmu.h"
#include "em_chip.h"
/* STK Board Support Package */
#include "bsp.h"
#include "bsp_trace.h"

void iAmAfunction()
{
	int a = 0;
	a += 1;
}

/**************************************************************************//**
 * @brief  Main function
 *****************************************************************************/
int main(void)
{
  /* Chip errata */
  CHIP_Init();

  /* If first word of user data page is non-zero, enable eA Profiler trace */
  BSP_TraceProfilerSetup();
  iAmAfunction();

  return 0;
}

 

I have searched for more information about this problem

Posts: 5
Registered: ‎12-02-2016

Re: Simplicity Studio v4 Energy Profiler Code Correlation

[ Edited ]

Hi Nikita,

The reason the profiler is showing 100% Unknown function is because the test function being used doesn't do much processing and so all of the time is being shown as spent in support functions that aren't instrumented.

Sticking with the Energy example and adding this nonsense function to the energy.c file

int iAmAfunction()
{
    int a = 0;
    while( a<1000000)
    {
        a += 1;
    }
    return a/1000;
}
 

then modifying the end of main() like this:

    value = iAmAfunction();
    Delay(value/10);
//    Delay(100);
    delayCount++;
  }
and the profiler will show a lot of time spent in iAmAfunction() if bytes are periodically received on the serial port associated with the development board.

EnergyProfiler.PNG

Thank you,

jpitt