What is the difference between Lauterbach Trace Enable and Trace On/Off? How to trace only one function when using an AUTOSAR stack?
I am using a microcontroller with Arm Cortex M and Cortex R.
First approach:
&a1=sYmbol.BEGIN(FunctionName)
&a2=sYmbol.EXIT(FunctionName)
;Only generate trace messages on the addresses used for measurement
Break.Set &a1 /Program /TraceEnable
Break.Set &a2 /Program /TraceEnable
;statistic analysis
Trace.STATistic.cycle / core 0
;Function trace
perf.lf all / core 0
Second approach:
&a1=sYmbol.BEGIN(FunctionName)
&a2=sYmbol.EXIT(FunctionName)
;Only generate trace messages on the addresses used for measurement
Break.Set &a1 /Program /TraceOn
Break.Set &a2 /Program /TraceOff
;statistic analysis
Trace.STATistic.cycle / core 0
;Function trace
perf.lf all / core 0
Neither gave the result I was looking for. Even though I am enabling trace only for the duration of the function, it is still showing all the functions running in the function trace and trace statistics are not significantly different than when running without these breakpoints.
TraceEnable configures the onchip ETM in a way, that it only emits trace for the addresses marked with TraceEnable - and not other addresses at all.
TraceOn/TraceOff are used in pairs and configure the onchip ETM in a way, that it starts/ends emitting the trace when the CPU executes the given address.
Thus, if you want to trace only one single function you have two options:
Break.Setwill consider FunctionName as a single address, whileVar.Break.Setwill consider FunctionName as an address range.Consider, that these filters configure onchip resources in a way, that the CPU will generate only a reduced trace. In your case it might be a more suitable approach to trace everything and filter the recorded data later (e.g. with GROUP)