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: PMU Inside a task

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

Hello Everyone,

I am using PMU cycle counter for calculating the execution time in the initialization of drivers and in later stages.

PMU code seems working very good in the main file if I place the code before starting freeRTOS Scheduler. 

Now, I have a requirement to measure CPU time inside a task(after starting Scheduler) and

my program always ends up at sys_intvecs.asm(dabort) file, whenever I am using PMU code after starting Scheduler.

If possible can someone tell me what is the problem or mistake I am doing? what is sys_intvecs.asm?

Best regards, 

Sai 

 

  • Hi Sai,

    I will forward your question to our SW professional.

    Regards,
    QJ
  • Hi Sai,

    I hope you are using HALCoGen generated files.

    PMU registers are accessible only in privileged mode. By default, HALCoGen sets the CPU to "System Mode" before it enters main. System mode is a privileged mode. That is why you are able to use the PMU funcions.

    I believe you have created a task which is run in user mode. Any PMU function calls from a non-privileged mode would cause an abort.

    If you want to use PMU inside a task, I recommend you to provide Privileged access to the task you created. You can do that by setting bit portPRIVILEGE_BIT of the priority parameter passed to the taskCreate function (Eg: 2 | portPRIVILEGE_BIT where 2 is the task priority set). Please refer  FreeRTOS API documentation for further details.

    Hope this helps!

    Thanks and Regards,

    Veena

  • Hi Sai,

    To answer your question, " what is sys_intvecs.asm? ".
    sys_intvecs.asm is the file where we keep the exception handlers. I hope you are aware of various exceptions in Cortex-R CPU. The instructions in this file are placed at address 0 in the memory. This is the address at which CPU would branch to in case an exception occurs.
    In your case when you use PMU function call in USER mode, an exception would occur and the CPU would immediately branch to the corresponding exception vector provided in the sys_intvecs.asm file
    Please refer ARM Cortex-R4 TRM for more details on exceptions.

    Thanks and Regards,
    Veena
  • Dear Veena,

    Thank you very much for your answer and nice explanation. I will try and let you know the result :)

    Have a nice day :)


    Best Regards,
    Sai.