SkyEye的模块编程示例(一)

来源:互联网 发布:delphi lrc算法 编辑:程序博客网 时间:2024/06/07 03:03

本文介绍了skyeye模块编程的一个示例程序log-pc模块。模块功能主要是用来记录skyeye执行过的所有PC指令。

 

一、源代码分析

1.1 log.c:实现了记录PC的功能,


}

 

1.2 log_module.c:用来实现模块的加载和卸载函数

 

 

1.3 Makefile

 

二、代码编译与安装

2.1 编译模块

创建一个新的目录,并把上面的log.c log_module.c Makefile都放入此目录。

在编译模块之前,先确认skyeye已经安装到系统中,可以查看/opt/skyeye/include/include/中是否有相关头文件存在,如skyeye_types.h, skyeye_arch.h等等。

如果skyeye安装正常,我们可以在你的模块目录下运行"make"来编译模块生成log.so文件。

 

2.2 模块安装

运行"make install"命令,可以把你编译的模块安装到skyeye的相应模块目录,skyeye会在启动的时候记载模块。

 

三、运行测试

进入到/opt/skyeye/testsuite/arm_hello目录下,测试我们的log-pc模块的运行。运行skyeye如下:

ksh@linux-gvai:/opt/skyeye/testsuite/arm_hello> ../../bin/skyeye
SkyEye is an Open Source project under GPL. All rights of different parts or modules are reserved by their author. Any modification or redistributions of SkyEye should note remove or modify the annoucement of SkyEye copyright.
Get more information about it, please visit the homepage http://www.skyeye.org.
Type "help" to get command list.
(skyeye)

 

然后再运行list-modules可以发现,我们的log-pc模块已经被加载,输出如下:
(skyeye)list-modules
Module Name             File Name
nandflash               /opt/skyeye/lib/skyeye/libnandflash.so
arm                     /opt/skyeye/lib/skyeye/libarm.so
log-pc                  /opt/skyeye/lib/skyeye/log.so
bfin                    /opt/skyeye/lib/skyeye/libbfin.so
log-pc                  /opt/skyeye/lib/skyeye/liblog.so
uart                    /opt/skyeye/lib/skyeye/libuart.so
mips                    /opt/skyeye/lib/skyeye/libmips.so
net                     /opt/skyeye/lib/skyeye/libnet.so
code_cov                /opt/skyeye/lib/skyeye/libcodecov.so
sparc                   /opt/skyeye/lib/skyeye/libsparc.so
ppc                     /opt/skyeye/lib/skyeye/libppc.so
touchscreen             /opt/skyeye/lib/skyeye/libts.so
coldfire                /opt/skyeye/lib/skyeye/libcoldfire.so
flash                   /opt/skyeye/lib/skyeye/libflash.so
lcd                     /opt/skyeye/lib/skyeye/liblcd.so
gdbserver               /opt/skyeye/lib/skyeye/libgdbserver.so
(skyeye)

 

然后还可以运行我们在前面log.c文件中注册的命令log-pc,来使能日志功能:

ksh@linux-gvai:/opt/skyeye/testsuite/arm_hello> ../../bin/skyeye
SkyEye is an Open Source project under GPL. All rights of different parts or modules are reserved by their author. Any modification or redistributions of SkyEye should note remove or modify the annoucement of SkyEye copyright.
Get more information about it, please visit the homepage http://www.skyeye.org.
Type "help" to get command list.

(skyeye)start
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
In do_mach_option, mach info: name at91, mach_init addr 0xb72a0f70

uart_mod:3, desc_in:, desc_out:, converter:
In create_uart_console
cpu info: armv3, arm7tdmi
SKYEYE: use arm7100 mmu ops
In SIM_start, Set PC to the address 0x0

(skyeye)log-pc
(skyeye)

原创粉丝点击