This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TMS570LS3137:性能监视器:如何设置 Cortex-R4F PMCNTENSET.C (周期计数器使能位)

Guru**** 2031750 points
Other Parts Discussed in Thread: HALCOGEN
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/814861/tms570ls3137-performance-monitor-how-to-set-cortex-r4f-pmcntenset-c-cycle-counter-enable-bit

器件型号:TMS570LS3137
主题中讨论的其他器件:HALCOGEN

你(们)好。

我尝试通过在项目中包含 HalCoGen 04.06.00生成的 sys_PMU.asm 和 sys_pmu.h 来使用 PMU。 我的代码结构的形式为:

_pmuInit_();
_pmuEnableCountersGlob_();
_pmuSetCountEvent_(0、0);

while (真) //嵌入式软件:无限循环
{
_pmuResetCyclCounter_();
_pmuStartCounter_(0x1);


[此处提供一些代码...]


_pmuStopCounter_(0x1);
int count=_pmuGetCycleCount_();


[此处提供更多代码...]
}
}

但是、PMCNTENSET.C 位(周期计数使能)始终保持禁用状态、因此计数器不会计数。 如果我使用调试器启用该位、一切看起来都很好。

我是否忘记调用另一个函数来启用该位、或者我对被调用函数的参数是否错误?

谢谢!

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好、Chuck、

    PMU 包含3个事件计数器和1个周期计数器。 它们是不同的计数器。 您的代码不启用周期计数器、但您从周期计数器读取该值。 您为事件#0定义事件计数器0、但启动和停止事件计数器1、 然后读取周期计数器。

    如果 您使用 PMU 对周期进行计数、请使用 以下修改后的代码:

        _pmuInit_();
        _pmuEnableCountersGlobal_();
       _pmuSetCountEvent_(0、0);
     
        while(TRUE)                        // embedded software: endless loop
        {
            _pmuResetCycleCounter_();
            _pmuStartCounters_(0x1);
         _pmuStartCounters_(pmuCYCLE_COUNTER);
            [Some code here ...]
            _pmuStopCounters_(0x1); 
         _pmuStopCounters_(pmuCYCLE_COUNTER);
            int count=_pmuGetCycleCount_();
            [More code here ...]
        }
    }

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 QJ、

    感谢您的深入了解。

    此致。