Git Product home page Git Product logo

Comments (6)

Mezamoha avatar Mezamoha commented on May 24, 2024 1

Great.
Thanks a lot
Have a good day

from stmviewer.

klonyyy avatar klonyyy commented on May 24, 2024

Hello, this might be because DWT registers are altered during trace setup. The DWT might be used by the ITM peripheral (as far as I remember it is not used currently). Do you set up the counter by yourself in your code? Why do you want to display the cycles count?

from stmviewer.

Mezamoha avatar Mezamoha commented on May 24, 2024

Thank you for your answer

In fact i'm interested in monitoring real-time counters such as LSUCNT, CPICNT, EXCCNT with Stmviewer. Here is my c code that i'm using with Stmviewer. The purpose is to know how those counters are impacted by our application.
Is it possible to monitor these counters with Stmviewer in real-time ?

#include "core_cm4.h" 

void DWT_Init(void) {
    CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
    DWT->CTRL |= (DWT_CTRL_CYCCNTENA_Msk | DWT_CTRL_CPIEVTENA_Msk | DWT_CTRL_LSUEVTENA_Msk | DWT_CTRL_EXCEVTENA_Msk);
}

volatile void ITM_SendData(int port, unsigned int data) {
    while (ITM->PORT[port].u32 == 0);
    ITM->PORT[port].u32 = data;
}

void Send_DWT_Counters(void) {
    unsigned int cycles = DWT->CYCCNT;
    unsigned int cpi_count = DWT->CPICNT;
    unsigned int lsu_count = DWT->LSUCNT;
    unsigned int exc_count = DWT->EXCCNT;

    ITM_SendData(0, cycles);
    ITM_SendData(1, cpi_count);
    ITM_SendData(2, lsu_count);
    ITM_SendData(3, exc_count);
}

int main(void) {
    ITM_Init();
    DWT_Init();

    while (1) {
        Send_DWT_Counters();
    }
}

from stmviewer.

klonyyy avatar klonyyy commented on May 24, 2024

The main problem is that STMViewer's Trace Viewer module uses the ITM and DWT. If you do not need a synchronous output of the data I'd use the Variable Viewer and just assign these counter values to some global variables and plot them. This way you'll be able to read the counters in real time.

The Trace Viewer aims to be automatic (it sets up the registers by itself), this is why interfering with ITM and DWT in your application results in faulty output.

from stmviewer.

Mezamoha avatar Mezamoha commented on May 24, 2024

Thank you for the clarifications.

I'll try the solution with the variable counters.

And if can i ask you more please ?
I'm interested to know how i can access to those counters via ITM without writing them in my code (since TraceViewer set them automatically)

i suppose that this solution will be suitable in term of overhead

Thanks again

from stmviewer.

klonyyy avatar klonyyy commented on May 24, 2024

Actually the Trace Viewer does not utilize these counters. You can do it by hand in your application, just the display part in STMViewer should be done using VariableViewer, as it does not change the ITM settings.

from stmviewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.