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.

[参考译文] HALCOGEN:HalCoGen 为 TMS5701227生成缺少 asm 指令的 sys_PMU.asm

Guru**** 2536080 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/1007467/halcogen-halcogen-generates-sys_pmu-asm-with-missing-asm-instructions-for-tms5701227

器件型号:HALCOGEN

HalCogen 会自动生成/提供其 HAL 层、由于奇怪的原因、它仅为1227生成了 ME 错误/缺少 ASM、而不是为0714或0914生成。  
(只是通过删除此 asm 文件并再次生成进行了重新测试)

这用于设置/获取事件计数器。  它为1227生成的是:

;-------------------------------------------------------------------------------
; Set Count event
; SourceId : PMU_SourceId_009
; DesignId : PMU_DesignId_009
; Requirements : HL_SR485

    .def     _pmuSetCountEvent_
    .asmfunc

_pmuSetCountEvent_

        mcr   p15, #0, r0, c9, c12, #5 ; select counter
        mcr   p15, #0, r1, c9, c13, #1 ; select event
        bx    lr

    .endasmfunc

;-------------------------------------------------------------------------------
; Get Event Counter Count Value
; SourceId : PMU_SourceId_011
; DesignId : PMU_DesignId_011
; Requirements : HL_SR486

    .def     _pmuGetEventCount_
    .asmfunc

_pmuGetEventCount_

        mcr   p15, #0, r0, c9, c12, #5 ; select counter
        mrc   p15, #0, r0, c9, c13, #2 ; read event counter
        bx    lr

这在事件计数器选择上有一点离一、 但它缺失

 lsr r0, r0, #1

作为这些调用的第一行。   奇怪的是,它确实为0714和0914代码插入了它... 不知道我的1227配置是什么

.e2e.ti.com/.../tms570_5F00_ls1227_5F00_zwt_5F00_.tar

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

    您好!

    此功能没有问题。 调用此函数时、应提供两个函数参数、一个是 r0、另一个是 R1。  

    要使用计数器0、r0=0x0;要使用计数器1、r0=0x1;要使用计数器2、r0=0x2

    R1用于选择事件编号

    请参阅 ARM Cortex-R4 TRM。

    下面是我使用 PMU 的示例:

    http://software-dl.ti.com/hercules/hercules_docs/latest/hercules/Examples/Examples.html#using-performance-monitoring-unit-pmu-to-evaluate-code-efficiency

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

    您首先需要了解 TI HalCoGen 提供的 API :

    /** @fn void _pmuSetCountEvent_(uint32 counter, uint32 event)
    *   @brief Set event counter count event
    *   @param[in] counter - Counter select 0..2
    *   @param[in] event   - Count event
    */
    void _pmuSetCountEvent_(uint32 counter, uint32 event);
    
    /** @fn uint32 _pmuGetCycleCount_(void)
    *   @brief Returns current cycle counter value
    *
    *   @return cycle count.
    */
    
    uint32 _pmuGetEventCount_(uint32 counter);
    
    /** @fn uint32 _pmuGetOverflow_(void)
    *   @brief Returns current overflow register and clear flags
    *
    *   @return overflow flags.
    */

    特别是在 uint32 _pmuGetEventCount_(uint32计数器);。

    也可以查看名为"为 Hercules ARMRegistered安全执行时间测量"的 TI 应用手册/报告
    MCU "。

    之后、可能会将我退回到 ARM 的 TRM。  (或修复 API)

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [引用 userid="45190" URL"~/support/microcontrollers/other-microcontrollers-group/other/f/other-microcontrollers-forum/1007467/halcogen-halcogen-generates-sys_pmu-asm-with-missing-asm-instructions-for-tms5701227/3722420 #3722420">此函数没有问题。 调用此函数时、应提供两个函数参数、一个是 r0、另一个是 r1。

    您是否查看过您提供的链接?  

    ...
    event0_cycles = _pmuGetEventCount_(pmuCOUNTER0);
    event1_cycles = _pmuGetEventCount_(pmuCOUNTER1);
    event2_cycles = _pmuGetEventCount_(pmuCOUNTER2);

    如果您可以向我展示 应用报告 SPNA138A–2011年11月中的示例如何与我粘贴时 HalCoGen 生成的代码一起工作、我会很高兴。

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

    尊敬的 V01d:

    我开发了一个使用 PMU 的示例、并将其添加到了我们的 REPO 中:  

    http://software-dl.ti.com/hercules/hercules_docs/latest/hercules/Examples/Examples.html#using-performance-monitoring-unit-pmu-to-evaluate-code-efficiency

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

    不、我认为您仍然看不到它。

    sys_pmu.h #defines pmuCOUNTER0/1/2的 API 是基于非0的索引,从1开始。  

     然后、_pmuGetEventCount_ asm 代码选择并读取计数器。  请注意、根据 ARM 的技术参考:

    https://developer.arm.com/documentation/ddi0363/e/events-and-performance-monitor/performance-monitoring-registers/c9--performance-counter-selection-register

    因此、我相信我在 TI 应用手册中看到的原始代码(在我的在线程中的文章中提到)是正确的、并且需要 LSR 指令、我不明白为什么 HalCoGen 将其删除。

    因此、我认为您的示例代码具有未定义的行为。

    那么、如果我错了、请更正我。

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

    你是对的。 谢谢 V01d。

    我认为 pmuCOUNTER0=0、但 在 HalCoGen 生成的头文件中、pmuCOUNTER0被定义为0x1。  

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

    很好,所以下一次,请先检查一下臂规格:)