Reply
Highlighted
Posts: 73
Registered: ‎06-17-2014
Accepted Solution

Problem: energyProfiler - code correlation

[ Edited ]

Hi!

 

Has anyone of you a step by step instruction to get the code correlation to work? I followed the README from the energyProfiler but it doesn't work.

 

Regards,

 

Michael

Posts: 51
Registered: ‎04-12-2013

Re: Problem: energyProfiler - code correlation

[ Edited ]

Hi, could you please post a screenshot of the profiler showing the failure ? 

Also, does the code correlation work for you when you profile a demo or example ?

Thanks !

 

Ling

Posts: 73
Registered: ‎06-17-2014

Re: Problem: energyProfiler - code correlation

It doesn't work with my Tiny Gecko STK but with my Giant Gecko STK.

 

regards

 

michael

Posts: 15
Registered: ‎09-09-2014

Re: Problem: energyProfiler - code correlation

Hi Michael

 

I was wondering if you found a way for code correlation.

 

Amir

Posts: 15
Registered: ‎09-09-2014

Re: Problem: energyProfiler - code correlation

Have you called BSP_TraceSwoSetup() at the beginning of main()?

Posts: 73
Registered: ‎06-17-2014

Re: Problem: energyProfiler - code correlation

Yes

Posts: 51
Registered: ‎04-12-2013

Re: Problem: energyProfiler - code correlation

Hi Michael, 

 

Do you mean the demos for Tiny Gecko don't have source correlation, or just your own project ?

Thanks !

 

Ling 

Posts: 73
Registered: ‎06-17-2014

Re: Problem: energyProfiler - code correlation

Hi Ling,

 

Both. It doesn't work when I try it with a demo or with my own program.

 

Should code correlation work with a Zero Gecko STK when I debug an external Tiny Gecko board?

 

Regards!

 

Michael

Posts: 51
Registered: ‎04-12-2013

Re: Problem: energyProfiler - code correlation

Hi Michael,

 

Could you post a screenshot showing the failure ? 

 

Also what do you mean by "with a Zero Gecko STK when I debug an external Tiny Gecko board" ?  you use Zero Gecko STK as adapter only ?

 

Thanks !

Ling

Posts: 73
Registered: ‎06-17-2014

Re: Problem: energyProfiler - code correlation

Hi Ling,

 

You find the screenshot in the attachments.

 

I mean when I'm only using the J-Link Debugger from the Zero Gecko STK (Debug OUT) to debug my own Tiny Gecko board. 

 

Regards!

 

Michael

Posts: 51
Registered: ‎04-12-2013

Re: Problem: energyProfiler - code correlation

Hi Michael,

 

Sorry for the late reply. From your screenshot it looks like a bug we recently found and fixed. Please try this and see if it helps.

 

Do this with your own project. In the function BSP_TraceSwoSetup() in bp_trace.c (quick way to find the file in Studio is type Ctrl-r and enter the file name bp_trace) , you should see code like this:

 

// Check if trace already enabled, if so assume that an external debugger
// is in control and skip further setup.
if ( !( CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA_Msk ) ) {

    /* Enable trace in core debug */ 
   CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;

   ....

 

 

Disable that "if ()" check, say, comment it out, so that the code in the block is unconditionally executed. The rebuild and profile your project.

 

Thanks !

 

Ling

Posts: 73
Registered: ‎06-17-2014

Re: Problem: energyProfiler - code correlation

Hi Ling,

 

I don't understand why this solution should work, because I have never used the file bsp_trace.c in my applications. I only copied the code from the README:

 

void BSP_TraceSwoSetup(void)
{
/* Enable GPIO Clock. */
CMU->HFPERCLKEN0 |= CMU_HFPERCLKEN0_GPIO;
/* Enable Serial wire output pin */
GPIO->ROUTE |= GPIO_ROUTE_SWOPEN;
#if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY) || defined(_EFM32_LEOPARD_FAMILY)
/* Set location 0 */
GPIO->ROUTE = (GPIO->ROUTE & ~(_GPIO_ROUTE_SWLOCATION_MASK)) | GPIO_ROUTE_SWLOCATION_LOC0;

/* Enable output on pin - GPIO Port F, Pin 2 */
GPIO->P[5].MODEL &= ~(_GPIO_P_MODEL_MODE2_MASK);
GPIO->P[5].MODEL |= GPIO_P_MODEL_MODE2_PUSHPULL;
#else
/* Set location 1 */
GPIO->ROUTE = (GPIO->ROUTE & ~(_GPIO_ROUTE_SWLOCATION_MASK)) | GPIO_ROUTE_SWLOCATION_LOC1;
/* Enable output on pin */
GPIO->P[2].MODEH &= ~(_GPIO_P_MODEH_MODE15_MASK);
GPIO->P[2].MODEH |= GPIO_P_MODEH_MODE15_PUSHPULL;
#endif
/* Enable debug clock AUXHFRCO */
CMU->OSCENCMD = CMU_OSCENCMD_AUXHFRCOEN;

while(!(CMU->STATUS & CMU_STATUS_AUXHFRCORDY));

/* Enable trace in core debug */
CoreDebug->DHCSR |= 1;
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;

/* Enable PC and IRQ sampling output */
DWT->CTRL = 0x400113FF;
/* Set TPIU prescaler to 16. */
TPI->ACPR = 0xf;
/* Set protocol to NRZ */
TPI->SPPR = 2;
/* Disable continuous formatting */
TPI->FFCR = 0x100;
/* Unlock ITM and output data */
ITM->LAR = 0xC5ACCE55;
ITM->TCR = 0x10009;

 

However I tried your solution with an demo application where the bsp_trace.c is used, but it didn't work.

 

Best regards

 

Michael

Posts: 51
Registered: ‎04-12-2013

Re: Problem: energyProfiler - code correlation

Ok, Michael,  could you post the screenshot of the whole Studio window while it's profiling a demo ?  Is your Tiny Gecko board  a customized board instead of a reference board from Silicon Labs thus you cannot directly connect it to PC ? You mentioned Giant Gecko board worked for you,  did you connect the Giant Gecko board directly to you PC or via a Zero Gecko board ? 

Thanks !

Posts: 73
Registered: ‎06-17-2014

Re: Problem: energyProfiler - code correlation

Hi Ling.

I found out why the code cortelation didn't work with my own EFM32 Boards.
I used PF2 as SWO pin (LOC0). However the Init code for code correlation uses PC15 as SWO pin. So I changed the configuration and now it works.

Kind regards

Michael
Posts: 51
Registered: ‎04-12-2013

Re: Problem: energyProfiler - code correlation

Cool, nice to know. Thanks for the update, Michael !