Reading and Decoding Data From ETB Buffer

Mike Leach mike.leach at linaro.org
Tue Jan 12 13:07:22 EST 2021


Hi Ajay,

On Tue, 12 Jan 2021 at 16:17, Mathieu Poirier
<mathieu.poirier at linaro.org> wrote:
>
> Adding the coresight mailing list
>
> On Tue, 12 Jan 2021 at 04:17, Ajay Bharadwaj <ajayrbharadwaj at gmail.com> wrote:
> >
> > Hi,
> >
> > I'm working on enabling STM and ETB support on Texas Instruments' platforms.
> >
> > Currently, I can write directly to the STM device in sysfs and read back
> > the encoded data from the ETB's buffer. I am using the Trace Packet
> > Lister (trc_pkt_lister) from Linaro's OpenCSD [1] to decode the data
> > obtained from the ETB. The decoded data matches what was written to the
> > STM (Albeit the data is reversed in some cases, this seems to be
> > expected according to the ARM specification).
> >
> > However, when I use the STM Source Console [2] instead of writing
> > directly to the STM device, I can still read back the encoded data from
> > the ETB buffer but OpenCSD cannot find any trace data in it.
> >
> > Is there any other tool that I can use instead of OpenCSD or am I doing
> > something wrong? Here are the commands I am running (I've tried using
> > the p_sys-t STP policy as well with the same result):
> >
> > Enabling CoreSight and STM Source Console:
> > 1. mkdir -p /config
> > 2. mount -t configfs none /config
> > 3. mkdir /config/stp-policy/stm0.policy
> > 4. mkdir /config/stp-policy/stm0.policy/console
> > 5. echo 1 > /sys/bus/coresight/devices/etb0/enable_sink
> > 6. echo stm0 > /sys/class/stm_source/console/stm_source_link
> >
> > Reading decoded data from ETB buffer:
> > 1. dd if=/dev/etb0 of=test.bin
> >
> > OpenCSD Output:
> > Trace Packet Lister: CS Decode library testing
> > -----------------------------------------------
> >
> > ** Library Version : 0.14.4
> >
> > Test Command Line:-
> > ./tests/bin/linux64/dbg/trc_pkt_lister   -ss_dir
> > tests/snapshots/stm_only/  -src_name  ETB_1
> >
> > Trace Packet Lister : reading snapshot from path tests/snapshots/stm_only/
> > Using ETB_1 as trace source
> > Trace Packet Lister : Protocol printer STM on Trace ID 0x1
> > ID:1    END OF TRACE DATA
> > Trace Packet Lister : Trace buffer done, processed 16384 bytes.
> >

In general, if the trc_pkt_lister program doesn't find trace then
there is none for the ID you have assigned to the STM in the snapshot
.ini files.
Try adding -o_raw_unpacked to your command line. Your will then see
some output of raw bytes and associated trace ID as below..

Frame Data; Index  32704;   ID_DATA[0x20]; 83 01 6f ff ff ff 0c 01 06
10 7b 2b 6c ff

Mike


> > [1]
> > https://github.com/Linaro/OpenCSD/blob/master/decoder/tests/source/trc_pkt_lister.cpp
> > [2] Driver: hwtracing/stm/console.c
> >
> > Any help or guidance would be much appreciated.
> >
> > Regards,
> > Ajay Bharadwaj



-- 
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK



More information about the linux-arm-kernel mailing list