嵌入式开发之Streamline性能剖析环境搭建

参考文档

  1. 搭建ARM DS-5 Streamline
  2. 编译Mainline_U-boot_and_Linux

在介绍具体的安装步骤之前先列举一下开发环境相关参数,这样做是为了避免忽略因为开发环境不一致导致的错误

  • 芯片:Allwinner H3(Nano pi neo)
  • 目标器件Linux发行版本:Ubuntu core 16.04.2
  • 目标器件Linux内核版本:4.11.2
  • 工具链版本:arm-cortexa9-linux-gnueabihf-4.9.3
  • DS-5版本:5.27.0
  • 主机操作系统版本:Ubuntu14.04 64位

Streamline是DS-5内置的一个性能分析器性能分析器,属于DS-5的付费功能,所以在使用DS-5附带的streamline功能前需要购买DS-5旗舰版本的软件许可或者申请试用30天有效期的试用许可

安装DS-5

获取软件许可证

设置交叉编译链

# 设置交叉编译相关参数
# 本文使用的是全志提供的交叉工具链,存放位置为/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3(更改为你正在使用的目录)
# Allwinner H3 NanoPI Neo cross compiler (社区主线linux4.11)
export ARCH=arm
export PATH=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/:$PATH
export CROSS_COMPILE=arm-cortexa9-linux-gnueabihf-
export CC=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-gcc    
export CXX=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-g++    
export LD=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-ld
export AR=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-ar
export AS=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-as
export RANLIB=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-ranlib

重新编译Linux内核

进入linux源代码目录

make sunxi_defconfig ARCH=arm CROSS_COMPILE=arm-cortexa9-linux-gnueabihf-
make menuconfig ARCH=arm CROSS_COMPILE=arm-cortexa9-linux-gnueabihf-

这里需要先通过make sunxi_defconfig来加载全志的默认参数,然后在这个基础上实用menuconfig界面进行修改

通过menuconfig界面确认开启如下选项:

  • CONFIG_PROFILING
  • CONFIG_PERF_EVENTS
  • CONFIG_FTRACE
  • CONFIG_HIGH_RES_TIMERS
  • CONFIG_HW_PERF_EVENTS
  • CONFIG_LOCAL_TIMERS
  • CONFIG_CPU_FREQ
  • CONFIG_TRACING

确认开启上述选项之后重新编译内核

从DS-5的安装目录下获取gator驱动程序,ds-5 5.27.0相应的位置是DS-5_v5.27.0/sw/streamline/gator/driver,将driver目录重命名为gator复制到linux源码树的driver目录下。

修改/linux/driver/Kconfig

# 在最后增加一行
source "drivers/gator/Kconfig"

修改/linux/driver/Makefile

# 在最后增加一行
obj-$(CONFIG_GATOR)        += gator/

为了让gator生效,修改/linux/driver/gator/Kconfig

#修改
    depends on LOCAL_TIMERS || !(ARM && SMP)
#为
    depends on LOCAL_TIMERS || (ARM && SMP)

完成内核编译之后会生成如下文件:

  • arch/arm/boot/zImage
  • arch/arm/boot/dts/sun8i--nanopi-.dtb
编译gator驱动

修改/linux/Makefile

#修改
KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
           -fno-strict-aliasing -fno-common \
           -Werror-implicit-function-declaration \
           -Wno-format-security \
           -std=gnu89 $(call cc-option,-fno-PIE)
#为
KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
           -fno-strict-aliasing -fno-common \
           -Wno-format-security \
           -std=gnu89 $(call cc-option,-fno-PIE)

编译

make ARCH=arm CROSS_COMPILE=arm-cortexa9-linux-gnueabihf- modules M=drivers/gator

编译完成之后会生成

  • drivers/gator/gator.ko

编译Gatord

cd DS-5_v5.27.0/sw/streamline/gator/daemon
make -j8

编译完成之后会生成

  • gatord

Streamline使用

在目标板上启动gatord
cd /opt
./gatord
启动streamline并连接到目标板
开始收集性能信息
分析性能信息
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值