I try use this code for read processor cycles according this information about event https://www.nxp.com/docs/en/reference-manual/e200z760RM.pdf and examples https://www.nxp.com/docs/en/application-note/AN4341.pdf
But it is not working getPMC16 got r3=0, Can you help me.
.global getPMC16UserMode .globl getPMC16 .global disableCounters .global enableCounters .global enableCpuCounter .global testPM .align 4 getPMC16: mfpmr r3,16 se_blr getPMC16UserMode: mfpmr r3,0 se_blr disableCounters: e_lis r3,0x8000 e_or2i r3,0x0000 mtpmr 400, r3 se_blr enableCounters: e_lis r3,0x0000 e_or2i r3,0x0000 mtpmr 400, r3 se_blr enableCpuCounter: e_lis r3,0x0000 e_or2i r3,0x0100 mtpmr 144, r3 se_blr testPM: e_bl disableCounters e_bl enableCpuCounter e_bl enableCounters e_bl getPMC16 e_nop e_nop e_bl getPMC16 e_bl disableCounters se_blr
It looks like this is wrong:
enableCpuCounter: e_lis r3,0x0000 e_or2i r3,0x0100 mtpmr 144, r3 se_blr
EVENT must be set to '1' if you want to count Processor Cycles. So, the value should be 0x00010000:
enableCpuCounter: e_lis r3,0x0001 e_or2i r3,0x0000 mtpmr 144, r3 se_blr
If I do this modification in my debugger, I can see that the counter is working when I step some code.
By the way, what kind of debugger do you use? It may be necessary to change default settings. From Lauterbach debugger:
It's not working. The problem stills, Unfortunately, i don't have Lauterbach debugger. i use OpenSDA. what i should write to EDBRAC0 register for activate performance monitor?
I checked it using OpenSDA. The problem is that EDBRAC0 can't be changed in this debugger. Or I didn't find such option, at least.
The only way is to test this feature without debugger - send the results out using serial interface or something like that. It works as expected in normal mode when debugger is not attached.
It's work without debugger with UART.
I found description for EDBRAC0, but other architecture https://www.nxp.com/docs/en/reference-manual/E6500RM.pdf
initDbg: e_lis r3,0x4000 e_or2i r3,0x0108 mtspr 638,r3 se_blr
but have exception on mtspr, i suppose number of register is wrong 638. Do you have specification for e200z4?
it's not possible to write this register by software:
Only debugger can do that. But such option must be implemented in the debugger - and this seems to be unavailable in S32DS debugger.