Hi Dominik,
On Mon, Dec 07, 2020 at 05:06:37PM +0100, Dominik Huber wrote:
Hello,
I want to capture and decode trace data on a Hikey620 (on Target) with OpenCSD and perf. I have been trying different kernels, compilers and compile options for weeks already, but I can not get it working. If anybody could take a look at my current build process or just provide me a tested combination of kernel, config and compiler, it would be very helpful.
I have to cross compile its kernel (and therefore also tools/perf) on a host computer. For that I use a docker container to ensure I have a clean and controlled system.
When compiling tools/perf I always get "libopencsd: [ OFF ]", and when executing "perf report" on target I get this error: 178 [0x268]: failed to process type: 70 Error: failed to process sample Therefore I suspect the building process of OpenCSD or tools/perf to be the problem. Trace collection without perf and OpenCSD works just fine.
Yes, if you see the string "libopencsd: [ OFF ]", this means the OpenCSD lib has not been linked.
My current build process is:
Installing OpenCSD on host: cd OpenCSD/decoder/build/linux/ make -f makefile.dev DEBUG=1 ARCH=arm64 make -f makefile.dev DEBUG=1 ARCH=arm64 install
Since the OpenCSD lib will be linked with perf tool, the OpenCSD lib also need to be cross-compiled for Arm64:
# export CROSS_COMPILE=aarch64-linux-gnu- # cd OpenCSD/decoder/build/linux/ # make LINUX64=1 DEBUG=1
Then you could see the built libs are placed in the folder: OpenCSD/decoder/lib/builddir and headers are placed in the folder: OpenCSD/decoder/include.
Building kernel on host: cd coresight make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules hisilicon/hi6220-hikey.dtb O=./out make INSTALL_MOD_PATH=./modules modules_install O=./out
Building /tools/perf on host: mkdir coresight/out/perf make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf VF=1 CORESIGHT=1 O=/opt/hikey620/coresight/out/perf
For cross building perf tool, you need to specify the lib and header patch for OpenCSD, so the command should be:
# export ARCH=arm64 # export CROSS_COMPILE=aarch64-linux-gnu- # CSINCLUDES=$PATH_TO_OpenCSD/decoder/include \ CSLIBS=$PATH_TO_OpenCSD/decoder/lib/builddir \ make VF=1 DEBUG=1 CORESIGHT=1
Then I can see Perf's building config for libopencsd is "on":
... libopencsd: [ on ]
Then you need to copy libopencsd to the target board, the perf tool should can work on it.
Thanks, Leo
Installing OpenCSD on target (Hikey620): cd OpenCSD/decoder/build/linux/ make -f makefile.dev make -f makefile.dev install
My compiler is the "gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu" from Linaro My kernel is the one from Mathieu Poirier: https://git.linaro.org/people/mathieu.poirier/coresight.git (5.1-rc3-cpu-wide-v3)
My .config was created by make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig but whith CoreSight and ARCH_MXC enabled: CONFIG_CORESIGHT=y CONFIG_CORESIGHT_LINKS_AND_SINKS=y CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y CONFIG_CORESIGHT_CATU=y CONFIG_CORESIGHT_SINK_TPIU=y CONFIG_CORESIGHT_SINK_ETBV10=y CONFIG_CORESIGHT_SOURCE_ETM4X=y CONFIG_CORESIGHT_DYNAMIC_REPLICATOR=y CONFIG_CORESIGHT_STM=y CONFIG_CORESIGHT_CPU_DEBUG=y CONFIG_ARCH_MXC=y
Thanks,
Dominik Huber
CoreSight mailing list CoreSight@lists.linaro.org https://lists.linaro.org/mailman/listinfo/coresight