[go: up one dir, main page]

CN106294143B - Debugging method and device for chip register - Google Patents

Debugging method and device for chip register Download PDF

Info

Publication number
CN106294143B
CN106294143B CN201610629676.6A CN201610629676A CN106294143B CN 106294143 B CN106294143 B CN 106294143B CN 201610629676 A CN201610629676 A CN 201610629676A CN 106294143 B CN106294143 B CN 106294143B
Authority
CN
China
Prior art keywords
chip
register
debugged
debugging
physical address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610629676.6A
Other languages
Chinese (zh)
Other versions
CN106294143A (en
Inventor
李江勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201610629676.6A priority Critical patent/CN106294143B/en
Publication of CN106294143A publication Critical patent/CN106294143A/en
Application granted granted Critical
Publication of CN106294143B publication Critical patent/CN106294143B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/362Debugging of software
    • G06F11/3648Debugging of software using additional hardware

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a debugging method and device for a register of a chip. According to the embodiment of the invention, the operation instruction for debugging the chip to be debugged is received, the operation instruction comprises the register physical address of the chip to be debugged provided by a user, and then the specified equipment node of the driving layer in the operation system is called to obtain the register logic address of the chip to be debugged corresponding to the register physical address of the chip to be debugged, so that the register of the chip to be debugged can be operated according to the register logic address of the chip to be debugged.

Description

芯片的寄存器的调试方法及装置Debugging method and device for register of chip

【技术领域】【Technical field】

本发明涉及硬件调试技术,尤其涉及一种芯片的寄存器的调试方法及装置。The invention relates to hardware debugging technology, in particular to a method and device for debugging a register of a chip.

【背景技术】【Background technique】

在芯片的设计、调试以及应用过程中,最多的工作就是对各种状态下的寄存器进行调试,即调整寄存器的值。现有技术中,可以单独针对某个芯片添加特定的调试接口,在进行调试时,则可以调用特定的调试接口来调试芯片的寄存器。In the process of chip design, debugging and application, the most work is to debug the registers in various states, that is, to adjust the value of the registers. In the prior art, a specific debugging interface can be added to a certain chip, and when debugging, the specific debugging interface can be called to debug the registers of the chip.

通常来说,对一个终端功能的调整,需要调整该终端功能相关的多个芯片的寄存器的值,这就需要分别调用每个芯片所对应的特定的调试接口,来调试每个芯片,这样,使得调试工作量大大增加,会导致调试效率的降低。Generally speaking, to adjust a terminal function, it is necessary to adjust the value of the registers of multiple chips related to the terminal function, which requires calling the specific debugging interface corresponding to each chip to debug each chip. In this way, This greatly increases the debugging workload and reduces the debugging efficiency.

【发明内容】[Content of the invention]

本发明的多个方面提供一种芯片的寄存器的调试方法及装置,用以提高调试效率。Various aspects of the present invention provide a method and device for debugging a register of a chip, so as to improve the debugging efficiency.

本发明的一方面,提供一种芯片的寄存器的调试方法,包括:One aspect of the present invention provides a method for debugging a register of a chip, including:

接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址;Receive an operation instruction for debugging the chip to be debugged, where the operation instruction includes the physical address of the register of the chip to be debugged provided by the user;

调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址;Call the designated device node of the driver layer in the operating system to obtain the logical address of the register of the chip to be debugged corresponding to the physical address of the register of the chip to be debugged;

根据所述待调试芯片的寄存器逻辑地址,操作所述待调试芯片的寄存器。The register of the chip to be debugged is operated according to the logical address of the register of the chip to be debugged.

如上所述的方面和任一可能的实现方式,进一步提供一种实现方式,所述接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址之前,还包括:The above aspects and any possible implementation manners further provide an implementation manner in which an operation instruction for receiving and debugging a chip to be debugged is received, and the operation instruction includes a user provided before the physical address of the register of the chip to be debugged. ,Also includes:

向所述用户提供调试界面,以供所述用户基于所述调试界面,提供所述待调试芯片的寄存器物理地址。A debug interface is provided to the user, so that the user can provide the physical address of the register of the chip to be debugged based on the debug interface.

如上所述的方面和任一可能的实现方式,进一步提供一种实现方式,所述操作系统包括Linux操作系统或Android操作系统。The above aspects and any possible implementation manners further provide an implementation manner, where the operating system includes a Linux operating system or an Android operating system.

如上所述的方面和任一可能的实现方式,进一步提供一种实现方式,所述指定设备节点为/dev/mem。According to the above aspect and any possible implementation manner, an implementation manner is further provided, wherein the specified device node is /dev/mem.

如上所述的方面和任一可能的实现方式,进一步提供一种实现方式,所述调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址之前,还包括:The above aspects and any possible implementation manners further provide an implementation manner in which the specified device node of the driver layer in the operating system is called to obtain the to-be-debugged chip corresponding to the physical address of the register of the chip to be debugged. Before debugging the logical address of the register of the chip, it also includes:

将所述待调试芯片的寄存器物理地址,映射到所述指定设备节点;mapping the physical address of the register of the chip to be debugged to the designated device node;

将所述指定设备节点,映射到用户空间。Map the specified device node to user space.

本发明的另一方面,提供一种芯片的寄存器的调试装置,包括:Another aspect of the present invention provides a device for debugging a register of a chip, including:

接收单元,用于接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址;a receiving unit, configured to receive an operation instruction for debugging the chip to be debugged, where the operation instruction includes the physical address of the register of the chip to be debugged provided by the user;

调用单元,用于调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址;a calling unit, configured to call a designated device node of the driver layer in the operating system to obtain the logical address of the register of the chip to be debugged corresponding to the physical address of the register of the chip to be debugged;

操作单元,用于根据所述待调试芯片的寄存器逻辑地址,操作所述待调试芯片的寄存器。The operation unit is configured to operate the register of the chip to be debugged according to the logical address of the register of the chip to be debugged.

如上所述的方面和任一可能的实现方式,进一步提供一种实现方式,所述接收单元,还用于The above aspect and any possible implementation manner further provide an implementation manner, wherein the receiving unit is further configured to

向所述用户提供调试界面,以供所述用户基于所述调试界面,提供所述待调试芯片的寄存器物理地址。A debug interface is provided to the user, so that the user can provide the physical address of the register of the chip to be debugged based on the debug interface.

如上所述的方面和任一可能的实现方式,进一步提供一种实现方式,所述操作系统包括Linux操作系统或Android操作系统。The above aspects and any possible implementation manners further provide an implementation manner, where the operating system includes a Linux operating system or an Android operating system.

如上所述的方面和任一可能的实现方式,进一步提供一种实现方式,所述指定设备节点为/dev/mem。According to the above aspect and any possible implementation manner, an implementation manner is further provided, wherein the specified device node is /dev/mem.

如上所述的方面和任一可能的实现方式,进一步提供一种实现方式,所述装置还包括映射单元,用于In the above aspect and any possible implementation, an implementation is further provided, wherein the apparatus further includes a mapping unit for

将所述待调试芯片的寄存器物理地址,映射到所述指定设备节点;以及mapping the physical address of the register of the chip to be debugged to the designated device node; and

将所述指定设备节点,映射到用户空间。Map the specified device node to user space.

由上述技术方案可知,本发明实施例通过接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址,进而调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址,使得能够根据所述待调试芯片的寄存器逻辑地址,操作所述待调试芯片的寄存器,由于不再单独针对某个芯片添加特定的调试接口,而是对所有芯片添加一的统一调试接口,使得调用统一调试接口,以调用操作系统中驱动层的指定设备节点,来调试全部的待调试芯片,从而提高了调试效率。It can be seen from the above technical solutions that in the embodiment of the present invention, by receiving an operation instruction for debugging the chip to be debugged, the operation instruction includes the physical address of the register of the chip to be debugged provided by the user, and then calls the designated device node of the driver layer in the operating system. , to obtain the logical address of the register of the chip to be debugged corresponding to the physical address of the register of the chip to be debugged, so that the register of the chip to be debugged can be operated according to the logical address of the register of the chip to be debugged. A specific debugging interface is added for a chip alone, but a unified debugging interface is added to all chips, so that the unified debugging interface is called to call the designated device node of the driver layer in the operating system to debug all the chips to be debugged, thereby Improved debugging efficiency.

另外,采用本发明所提供的技术方案,通过将操作系统中驱动层的指定设备节点映射到用户空间,就能够实现将全部的待调试芯片的寄存器地址,映射到用户空间,这样,就获得了用户可见的所述待调试芯片的寄存器地址,能够有效提高调试的可操作性。In addition, by using the technical solution provided by the present invention, by mapping the designated device node of the driver layer in the operating system to the user space, the register addresses of all the chips to be debugged can be mapped to the user space, so that the obtained The user-visible register address of the chip to be debugged can effectively improve the operability of debugging.

另外,采用本发明所提供的技术方案,无需对待调试芯片的寄存器的相关程序进行重新编译,而是将全部的待调试芯片的寄存器地址,映射到用户空间即可,操作简单,并且非常灵活,能够有效进一步有效提高调试效率。In addition, with the technical solution provided by the present invention, it is not necessary to recompile the relevant programs of the registers of the chip to be debugged, but to map all the register addresses of the chip to be debugged to the user space, the operation is simple and very flexible, It can effectively further improve the debugging efficiency.

【附图说明】【Description of drawings】

为了更清楚地说明本发明实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present invention more clearly, the following will briefly introduce the accompanying drawings used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are of the present invention. In some embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1为本发明一实施例提供的芯片的寄存器的调试方法的流程示意图;1 is a schematic flowchart of a method for debugging a register of a chip according to an embodiment of the present invention;

图2为本发明另一实施例提供的芯片的寄存器的调试装置的结构示意图;2 is a schematic structural diagram of a device for debugging a register of a chip provided by another embodiment of the present invention;

图3为本发明另一实施例提供的芯片的寄存器的调试装置的结构示意图。FIG. 3 is a schematic structural diagram of a device for debugging a register of a chip according to another embodiment of the present invention.

【具体实施方式】【Detailed ways】

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的全部其他实施例,都属于本发明保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments These are some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

需要说明的是,本发明实施例中所涉及的终端可以包括但不限于手机、个人数字助理(Personal Digital Assistant,PDA)、无线手持设备、平板电脑(Tablet Computer)、个人电脑(Personal Computer,PC)、MP3播放器、MP4播放器、可穿戴设备(例如,智能眼镜、智能手表、智能手环等)等。It should be noted that the terminals involved in the embodiments of the present invention may include but are not limited to mobile phones, personal digital assistants (Personal Digital Assistants, PDAs), wireless handheld devices, tablet computers (Tablet Computers), and personal computers (Personal Computers, PCs). ), MP3 players, MP4 players, wearable devices (eg, smart glasses, smart watches, smart bracelets, etc.), etc.

另外,本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。In addition, the term "and/or" in this article is only an association relationship to describe the associated objects, indicating that there can be three kinds of relationships, for example, A and/or B, it can mean that A exists alone, A and B exist at the same time, There are three cases of B alone. In addition, the character "/" in this document generally indicates that the related objects are an "or" relationship.

图1为本发明一实施例提供的芯片的寄存器的调试方法的流程示意图,如图1所示。FIG. 1 is a schematic flowchart of a method for debugging a register of a chip according to an embodiment of the present invention, as shown in FIG. 1 .

101、接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址。101. Receive an operation instruction for debugging a chip to be debugged, where the operation instruction includes a physical address of a register of the chip to be debugged provided by a user.

102、调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址。102. Call the designated device node of the driver layer in the operating system to obtain the logical address of the register of the chip to be debugged corresponding to the physical address of the register of the chip to be debugged.

其中,所述操作系统可以包括但不限于Linux操作系统或安卓(Android)操作系统,本实施例对此不进行特别限定。The operating system may include, but is not limited to, a Linux operating system or an Android (Android) operating system, which is not particularly limited in this embodiment.

103、根据所述待调试芯片的寄存器逻辑地址,操作所述待调试芯片的寄存器。103. Operate the register of the chip to be debugged according to the logical address of the register of the chip to be debugged.

需要说明的是,101~103的执行主体的部分或全部可以为位于本地终端的应用,或者还可以为设置在位于本地终端的应用中的插件或软件开发工具包(SoftwareDevelopment Kit,SDK)等功能单元,或者还可以为位于网络侧服务器中的处理引擎,或者还可以为位于网络侧的分布式系统,本实施例对此不进行特别限定。It should be noted that some or all of the execution bodies of 101 to 103 may be applications located in the local terminal, or may also be functions such as plug-ins or software development kits (Software Development Kit, SDK) set in the applications located in the local terminal. The unit may also be a processing engine located in a server on the network side, or may also be a distributed system located on the network side, which is not particularly limited in this embodiment.

可以理解的是,所述应用可以是安装在终端上的本地程序(nativeApp),或者还可以是终端上的浏览器的一个网页程序(webApp),本实施例对此不进行特别限定。It can be understood that the application may be a local program (nativeApp) installed on the terminal, or may also be a web page program (webApp) of a browser on the terminal, which is not particularly limited in this embodiment.

这样,通过接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址,进而调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址,使得能够根据所述待调试芯片的寄存器逻辑地址,操作所述待调试芯片的寄存器,由于不再单独针对某个芯片添加特定的调试接口,而是对所有芯片添加一的统一调试接口,使得调用统一调试接口,以调用操作系统中驱动层的指定设备节点,来调试全部的待调试芯片,从而提高了调试效率。In this way, by receiving an operation instruction for debugging the chip to be debugged, the operation instruction includes the physical address of the register of the chip to be debugged provided by the user, and then the designated device node of the driver layer in the operating system is called to obtain the chip to be debugged. The logical address of the register of the chip to be debugged corresponding to the physical address of the register, so that the register of the chip to be debugged can be operated according to the logical address of the register of the chip to be debugged. The debugging interface is a unified debugging interface added to all chips, so that the unified debugging interface is called to call the designated device node of the driver layer in the operating system to debug all the chips to be debugged, thereby improving the debugging efficiency.

可选地,在本实施例的一个可能的实现方式中,在101中,用户所提供的所述待调试芯片的寄存器物理地址,可以是一个寄存器物理地址,用来调试一个寄存器,或者还可以是多个寄存器物理地址,用来调试多个寄存器,本实施例对此不进行特别限定。Optionally, in a possible implementation manner of this embodiment, in 101, the physical address of the register of the chip to be debugged provided by the user may be a physical address of a register, which is used to debug a register, or may also be used to debug a register. are multiple physical addresses of registers, which are used to debug multiple registers, which are not particularly limited in this embodiment.

可选地,在本实施例的一个可能的实现方式中,在101之前,还可以进一步向所述用户提供调试界面,以供所述用户基于所述调试界面,提供所述待调试芯片的寄存器物理地址。Optionally, in a possible implementation manner of this embodiment, before step 101, a debugging interface may be further provided to the user, so that the user can provide the register of the chip to be debugged based on the debugging interface physical address.

在一个具体的实现过程中,用户可以查询技术手册,以找到待调试芯片的寄存器物理地址,并将该待调试芯片的寄存器物理地址输入到调试界面的指定区域,来提供所述待调试芯片的寄存器物理地址,或者还可以通过调试界面所提供的功能控件,选择该调试界面给出的指定选项,来提供所述待调试芯片的寄存器物理地址,本实施例对此不进行特别限定。In a specific implementation process, the user can query the technical manual to find the physical address of the register of the chip to be debugged, and input the physical address of the register of the chip to be debugged into the designated area of the debug interface to provide the information of the chip to be debugged. The physical address of the register, or the function control provided by the debugging interface can also be used to select a specified option provided by the debugging interface to provide the physical address of the register of the chip to be debugged, which is not particularly limited in this embodiment.

可选地,在本实施例的一个可能的实现方式中,所调用的操作系统中驱动层的指定设备节点,是用于存储所述待调试芯片的寄存器物理地址与所述待调试芯片的寄存器逻辑地址之间的对应关系。所谓的寄存器逻辑地址,是指在操作系统中驱动层所使用的寄存器地址。Optionally, in a possible implementation of this embodiment, the designated device node of the driver layer in the called operating system is used to store the physical address of the register of the chip to be debugged and the register of the chip to be debugged. Correspondence between logical addresses. The so-called register logical address refers to the register address used by the driver layer in the operating system.

具体来说,所述指定设备节点可以为/dev/mem这一设备节点。在操作系统例如,类Unix系统中,对设备的访问都是基于文件形式的,要访问一个硬件设备,一般和访问一个普通文件差不多。因此,/dev下的设备节点就被作为这样的一类特殊文件来存在。Specifically, the designated device node may be a device node of /dev/mem. In operating systems such as Unix-like systems, access to devices is based on files. To access a hardware device is generally similar to accessing a common file. Therefore, device nodes under /dev exist as such a special kind of file.

可选地,在本实施例的一个可能的实现方式中,在102之前,还可以进一步将所述待调试芯片的寄存器物理地址,映射到所述指定设备节点。这样,使得所述指定设备节点存储所述待调试芯片的寄存器物理地址与所述待调试芯片的寄存器逻辑地址之间的对应关系。然后,再进一步将所述指定设备节点,映射到用户空间。Optionally, in a possible implementation manner of this embodiment, before step 102 , the physical address of the register of the chip to be debugged may be further mapped to the designated device node. In this way, the designated device node is made to store the correspondence between the physical address of the register of the chip to be debugged and the logical address of the register of the chip to be debugged. Then, the specified device node is further mapped to the user space.

具体来说,可以通过mmap指令,将待调试芯片的寄存器地址,映射到用户空间,使得在用户空间就能够完成对寄存器的操作,例如,读取寄存器的值,或者写入寄存器的值,等等。这样,通过操作映射到用户空间的寄存器地址等同于操作内核空间的寄存器地址,例如,可以实时读取当前所有需要查看以及写入的寄存器的值,或者,再例如,还可以一次读取或者写入多个寄存器的值,实时动态进行寄存器的调试。Specifically, the mmap instruction can be used to map the register address of the chip to be debugged to the user space, so that the operation of the register can be completed in the user space, for example, read the value of the register, or write the value of the register, etc. Wait. In this way, operating the register address mapped to the user space is equivalent to operating the register address in the kernel space. For example, the values of all the registers that need to be viewed and written can be read in real time, or, for another example, can be read or written at one time Enter the values of multiple registers, and debug the registers dynamically in real time.

现有的调试方法,通常需要修改代码、添加打印函数、编译、烧写可执行镜像文件到Flash中、启动操作系统、连接串口输出打印的值,调试步骤非常繁琐,效率低下、不灵活。采用本发明所提供的技术方案,可以在操作系统起来后运行,通过把所需要调试的所有寄存器的寄存器地址,映射到用户空间,实时的查看并且修改寄存器的值,并支持连续的寄存器查看与修改,能够实时的跟踪芯片的寄存器修改之后对芯片外设的效果,不需要修改任何代码,编译,烧写,重启等步骤。相比传统的通过在内核态中打印寄存器的值的调试方法,此方法大大提高了芯片的寄存器的调试效率。Existing debugging methods usually need to modify the code, add printing functions, compile and write executable image files into Flash, start the operating system, and connect the serial port to output the printed value. The debugging steps are very cumbersome, inefficient and inflexible. By adopting the technical solution provided by the present invention, it can run after the operating system is up. By mapping the register addresses of all the registers to be debugged to the user space, the values of the registers can be viewed and modified in real time, and the continuous register viewing and Modification, can track the effect of chip register modification on chip peripherals in real time, without modifying any code, compiling, programming, restarting and other steps. Compared with the traditional debugging method by printing the value of the register in the kernel state, this method greatly improves the debugging efficiency of the register of the chip.

本实施例中,通过接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址,进而调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址,使得能够根据所述待调试芯片的寄存器逻辑地址,操作所述待调试芯片的寄存器,由于不再单独针对某个芯片添加特定的调试接口,而是对所有芯片添加一的统一调试接口,使得调用统一调试接口,以调用操作系统中驱动层的指定设备节点,来调试全部的待调试芯片,从而提高了调试效率。In this embodiment, by receiving an operation instruction for debugging the chip to be debugged, the operation instruction includes the physical address of the register of the chip to be debugged provided by the user, and then calling the designated device node of the driver layer in the operating system to obtain the The logical address of the register of the chip to be debugged corresponding to the physical address of the register of the chip to be debugged, so that the register of the chip to be debugged can be operated according to the logical address of the register of the chip to be debugged. Instead of adding a specific debugging interface, a unified debugging interface is added to all chips, so that the unified debugging interface is called to call the designated device node of the driver layer in the operating system to debug all the chips to be debugged, thereby improving the debugging efficiency.

另外,采用本发明所提供的技术方案,通过将操作系统中驱动层的指定设备节点映射到用户空间,就能够实现将全部的待调试芯片的寄存器地址,映射到用户空间,这样,就获得了用户可见的所述待调试芯片的寄存器地址,能够有效提高调试的可操作性。In addition, by using the technical solution provided by the present invention, by mapping the designated device node of the driver layer in the operating system to the user space, the register addresses of all the chips to be debugged can be mapped to the user space, so that the obtained The user-visible register address of the chip to be debugged can effectively improve the operability of debugging.

另外,采用本发明所提供的技术方案,无需对待调试芯片的寄存器的相关程序进行重新编译,而是将全部的待调试芯片的寄存器地址,映射到用户空间即可,操作简单,并且非常灵活,能够有效进一步有效提高调试效率。In addition, with the technical solution provided by the present invention, it is not necessary to recompile the relevant programs of the registers of the chip to be debugged, but to map all the register addresses of the chip to be debugged to the user space, the operation is simple and very flexible, It can effectively further improve the debugging efficiency.

需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that, for the sake of simple description, the foregoing method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence. As in accordance with the present invention, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

图2为本发明另一实施例提供的芯片的寄存器的调试装置的结构示意图,如图2所示。本实施例的芯片的寄存器的调试装置可以包括接收单元21、调用单元22和操作单元23。其中,接收单元21,用于接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址;调用单元22,用于调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址;操作单元23,用于根据所述待调试芯片的寄存器逻辑地址,操作所述待调试芯片的寄存器。FIG. 2 is a schematic structural diagram of a device for debugging a register of a chip provided by another embodiment of the present invention, as shown in FIG. 2 . The device for debugging the registers of the chip in this embodiment may include a receiving unit 21 , a calling unit 22 and an operating unit 23 . Among them, the receiving unit 21 is used to receive an operation instruction for debugging the chip to be debugged, and the operation instruction includes the physical address of the register of the chip to be debugged provided by the user; the calling unit 22 is used to call the designation of the driver layer in the operating system. The device node is used to obtain the logical address of the register of the chip to be debugged corresponding to the physical address of the register of the chip to be debugged; the operation unit 23 is used to operate the chip to be debugged according to the logical address of the register of the chip to be debugged. register.

其中,所述操作系统可以包括但不限于Linux操作系统或安卓(Android)操作系统,本实施例对此不进行特别限定。The operating system may include, but is not limited to, a Linux operating system or an Android (Android) operating system, which is not particularly limited in this embodiment.

需要说明的是,本实施例所提供的芯片的寄存器的调试装置的部分或全部可以为位于本地终端的应用,或者还可以为设置在位于本地终端的应用中的插件或软件开发工具包(Software Development Kit,SDK)等功能单元,或者还可以为位于网络侧服务器中的处理引擎,或者还可以为位于网络侧的分布式系统,本实施例对此不进行特别限定。It should be noted that part or all of the device for debugging the registers of the chip provided in this embodiment may be an application located in the local terminal, or may also be a plug-in or software development kit (Software Development Kit) set in the application located in the local terminal. Development Kit, SDK) and other functional units, or may also be a processing engine located in a server on the network side, or may also be a distributed system located on the network side, which is not particularly limited in this embodiment.

可以理解的是,所述应用可以是安装在终端上的本地程序(nativeApp),或者还可以是终端上的浏览器的一个网页程序(webApp),本实施例对此不进行特别限定。It can be understood that the application may be a local program (nativeApp) installed on the terminal, or may also be a web page program (webApp) of a browser on the terminal, which is not particularly limited in this embodiment.

可选地,在本实施例的一个可能的实现方式中,所述接收单元21,还可以进一步用于向所述用户提供调试界面,以供所述用户基于所述调试界面,提供所述待调试芯片的寄存器物理地址。Optionally, in a possible implementation of this embodiment, the receiving unit 21 may be further configured to provide the user with a debugging interface, so that the user can provide the to-be-to-be based on the debugging interface. The physical address of the register of the debug chip.

可选地,在本实施例的一个可能的实现方式中,所调用的操作系统中驱动层的指定设备节点,是用于存储所述待调试芯片的寄存器物理地址与所述待调试芯片的寄存器逻辑地址之间的对应关系。所谓的寄存器逻辑地址,是指在操作系统中驱动层所使用的寄存器地址。Optionally, in a possible implementation of this embodiment, the designated device node of the driver layer in the called operating system is used to store the physical address of the register of the chip to be debugged and the register of the chip to be debugged. Correspondence between logical addresses. The so-called register logical address refers to the register address used by the driver layer in the operating system.

具体来说,所述指定设备节点可以为/dev/mem这一设备节点。在操作系统例如,类Unix系统中,对设备的访问都是基于文件形式的,要访问一个硬件设备,一般和访问一个普通文件差不多。因此,/dev下的设备节点就被作为这样的一类特殊文件来存在。Specifically, the designated device node may be a device node of /dev/mem. In operating systems such as Unix-like systems, access to devices is based on files. To access a hardware device is generally similar to accessing a common file. Therefore, device nodes under /dev exist as such a special kind of file.

可选地,在本实施例的一个可能的实现方式中,如图3所示,本实施例所提供的芯片的寄存器的调试装置还可以进一步包括映射单元31,可以用于将所述待调试芯片的寄存器物理地址,映射到所述指定设备节点;以及将所述指定设备节点,映射到用户空间。Optionally, in a possible implementation manner of this embodiment, as shown in FIG. 3 , the device for debugging the registers of the chip provided by this embodiment may further include a mapping unit 31, which may be used to debug the to-be-debugged device. The physical address of the register of the chip is mapped to the designated device node; and the designated device node is mapped to the user space.

需要说明的是,图1对应的实施例中方法,可以由本实施例提供的芯片的寄存器的调试装置实现。详细描述可以参见图1对应的实施例中的相关内容,此处不再赘述。It should be noted that, the method in the embodiment corresponding to FIG. 1 may be implemented by the device for debugging the registers of the chip provided in this embodiment. For a detailed description, reference may be made to the relevant content in the embodiment corresponding to FIG. 1 , which will not be repeated here.

本实施例中,通过接收单元接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址,进而由调用单元调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址,使得操作单元能够根据所述待调试芯片的寄存器逻辑地址,操作所述待调试芯片的寄存器,由于不再单独针对某个芯片添加特定的调试接口,而是对所有芯片添加一的统一调试接口,使得调用统一调试接口,以调用操作系统中驱动层的指定设备节点,来调试全部的待调试芯片,从而提高了调试效率。In this embodiment, an operation instruction for debugging the chip to be debugged is received by the receiving unit, the operation instruction includes the register physical address of the chip to be debugged provided by the user, and then the calling unit calls the designated device node of the driver layer in the operating system to obtain the logical address of the register of the chip to be debugged corresponding to the physical address of the register of the chip to be debugged, so that the operating unit can operate the register of the chip to be debugged according to the logical address of the register of the chip to be debugged. Instead of adding a specific debugging interface for a single chip, a unified debugging interface is added to all chips, so that the unified debugging interface is called to call the designated device node of the driver layer in the operating system to debug all the chips to be debugged. , thereby improving the debugging efficiency.

另外,采用本发明所提供的技术方案,通过将操作系统中驱动层的指定设备节点映射到用户空间,就能够实现将全部的待调试芯片的寄存器地址,映射到用户空间,这样,就获得了用户可见的所述待调试芯片的寄存器地址,能够有效提高调试的可操作性。In addition, by using the technical solution provided by the present invention, by mapping the designated device node of the driver layer in the operating system to the user space, the register addresses of all the chips to be debugged can be mapped to the user space, so that the obtained The user-visible register address of the chip to be debugged can effectively improve the operability of debugging.

另外,采用本发明所提供的技术方案,无需对待调试芯片的寄存器的相关程序进行重新编译,而是将全部的待调试芯片的寄存器地址,映射到用户空间即可,操作简单,并且非常灵活,能够有效进一步有效提高调试效率。In addition, with the technical solution provided by the present invention, it is not necessary to recompile the relevant programs of the registers of the chip to be debugged, but to map all the register addresses of the chip to be debugged to the user space, the operation is simple and very flexible, It can effectively further improve the debugging efficiency.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above may refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

在本发明所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined. Either it can be integrated into another system, or some features can be omitted, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional units.

上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机装置(可以是个人计算机,服务器,或者网络装置等)或处理器(processor)执行本发明各个实施例所述方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The above-mentioned integrated units implemented in the form of software functional units can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute the methods described in the various embodiments of the present invention. some steps. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .

最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that it can still be The technical solutions described in the foregoing embodiments are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (6)

1.一种芯片的寄存器的调试方法,其特征在于,包括:1. a debugging method of the register of a chip, is characterized in that, comprises: 接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址,所述寄存器物理地址指在操作系统中驱动层所使用的寄存器地址;Receive an operation instruction for debugging the chip to be debugged, the operation instruction includes the register physical address of the to-be-debugged chip provided by the user, and the register physical address refers to the register address used by the driver layer in the operating system; 调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址;Call the designated device node of the driver layer in the operating system to obtain the logical address of the register of the chip to be debugged corresponding to the physical address of the register of the chip to be debugged; 根据所述待调试芯片的寄存器逻辑地址,操作所述待调试芯片的寄存器;其中,According to the logical address of the register of the chip to be debugged, operate the register of the chip to be debugged; wherein, 所述调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址之前,还包括:Before the calling the designated device node of the driver layer in the operating system to obtain the logical address of the register of the chip to be debugged corresponding to the physical address of the register of the chip to be debugged, the method further includes: 将所述待调试芯片的寄存器物理地址,映射到所述指定设备节点;mapping the physical address of the register of the chip to be debugged to the designated device node; 将所述指定设备节点,映射到用户空间;其中,Map the specified device node to user space; wherein, 所述接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址之前,还包括:The receiving an operation instruction for debugging the chip to be debugged, before the operation instruction includes the physical address of the register of the chip to be debugged provided by the user, further includes: 向所述用户提供调试界面,以供所述用户基于所述调试界面,提供所述待调试芯片的寄存器物理地址。A debug interface is provided to the user, so that the user can provide the physical address of the register of the chip to be debugged based on the debug interface. 2.根据权利要求1所述的方法,其特征在于,所述操作系统包括Linux操作系统或Android操作系统。2. The method according to claim 1, wherein the operating system comprises a Linux operating system or an Android operating system. 3.根据权利要求1所述的方法,其特征在于,所述指定设备节点为/dev/mem。3. The method according to claim 1, wherein the designated device node is /dev/mem. 4.一种芯片的寄存器的调试装置,其特征在于,包括:4. A device for debugging a register of a chip, comprising: 接收单元,用于接收调试待调试芯片的操作指令,所述操作指令中包含用户提供的所述待调试芯片的寄存器物理地址,所述寄存器物理地址指在操作系统中驱动层所使用的寄存器地址;A receiving unit, configured to receive an operation instruction for debugging the chip to be debugged, the operation instruction includes the physical address of the register of the chip to be debugged provided by the user, and the physical address of the register refers to the register address used by the driver layer in the operating system ; 调用单元,用于调用操作系统中驱动层的指定设备节点,以获得所述待调试芯片的寄存器物理地址所对应的所述待调试芯片的寄存器逻辑地址;a calling unit, configured to call a designated device node of the driver layer in the operating system to obtain the logical address of the register of the chip to be debugged corresponding to the physical address of the register of the chip to be debugged; 操作单元,用于根据所述待调试芯片的寄存器逻辑地址,操作所述待调试芯片的寄存器;其中,an operation unit, configured to operate the register of the chip to be debugged according to the logical address of the register of the chip to be debugged; wherein, 所述装置还包括映射单元,用于The apparatus also includes a mapping unit for 将所述待调试芯片的寄存器物理地址,映射到所述指定设备节点;以及mapping the physical address of the register of the chip to be debugged to the designated device node; and 将所述指定设备节点,映射到用户空间;其中,Map the specified device node to user space; wherein, 所述接收单元,还用于The receiving unit is also used for 向所述用户提供调试界面,以供所述用户基于所述调试界面,提供所述待调试芯片的寄存器物理地址。A debug interface is provided to the user, so that the user can provide the physical address of the register of the chip to be debugged based on the debug interface. 5.根据权利要求4所述的装置,其特征在于,所述操作系统包括Linux操作系统或Android操作系统。5. The device according to claim 4, wherein the operating system comprises a Linux operating system or an Android operating system. 6.根据权利要求4所述的装置,其特征在于,所述指定设备节点为/dev/mem。6. The apparatus according to claim 4, wherein the designated device node is /dev/mem.
CN201610629676.6A 2016-08-03 2016-08-03 Debugging method and device for chip register Active CN106294143B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610629676.6A CN106294143B (en) 2016-08-03 2016-08-03 Debugging method and device for chip register

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610629676.6A CN106294143B (en) 2016-08-03 2016-08-03 Debugging method and device for chip register

Publications (2)

Publication Number Publication Date
CN106294143A CN106294143A (en) 2017-01-04
CN106294143B true CN106294143B (en) 2020-03-03

Family

ID=57664638

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610629676.6A Active CN106294143B (en) 2016-08-03 2016-08-03 Debugging method and device for chip register

Country Status (1)

Country Link
CN (1) CN106294143B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114510432B (en) * 2022-04-20 2022-07-12 苏州浪潮智能科技有限公司 A register debugging platform and debugging method
CN114564414B (en) * 2022-04-28 2022-08-09 武汉慧联无限科技有限公司 Debugging method, device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5915083A (en) * 1997-02-28 1999-06-22 Vlsi Technology, Inc. Smart debug interface circuit for efficiently for debugging a software application for a programmable digital processor device
CN1725179A (en) * 2005-05-19 2006-01-25 杭州华为三康技术有限公司 System safe startup method and device
CN101938566A (en) * 2010-09-10 2011-01-05 青岛海信移动通信技术股份有限公司 Visual terminal debugging method and device
CN102810123A (en) * 2011-06-02 2012-12-05 苏州雄立科技有限公司 Excitation generating method and device
CN105159742A (en) * 2015-07-06 2015-12-16 北京星网锐捷网络技术有限公司 Unvarnished transmission method and system for PCI device of virtual machine

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5915083A (en) * 1997-02-28 1999-06-22 Vlsi Technology, Inc. Smart debug interface circuit for efficiently for debugging a software application for a programmable digital processor device
US6202172B1 (en) * 1997-02-28 2001-03-13 Vlsi Technology, Inc. Smart debug interface circuit
CN1725179A (en) * 2005-05-19 2006-01-25 杭州华为三康技术有限公司 System safe startup method and device
CN101938566A (en) * 2010-09-10 2011-01-05 青岛海信移动通信技术股份有限公司 Visual terminal debugging method and device
CN102810123A (en) * 2011-06-02 2012-12-05 苏州雄立科技有限公司 Excitation generating method and device
CN105159742A (en) * 2015-07-06 2015-12-16 北京星网锐捷网络技术有限公司 Unvarnished transmission method and system for PCI device of virtual machine

Also Published As

Publication number Publication date
CN106294143A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
US10282192B1 (en) Updating device code through a bus
CN110531962B (en) Development processing method and device for applet and computer readable storage medium
WO2020221229A1 (en) Application program sharing method and apparatus, shared information display method and apparatus, device and medium
CN111124288B (en) A VPD storage management method, apparatus, device and readable storage medium
CN110244983B (en) Method for fixing serial port number, terminal equipment and storage medium
CN108694052A (en) A kind of firmware upgrade method, device for upgrading firmware and firmware upgrade system
CN114691391A (en) Super-calling method and device for kernel mode program of enhanced packet filter
CN114691300A (en) Hot migration method of virtual machine instance
CN110825435A (en) Method and apparatus for processing data
US20190087376A1 (en) Hot-plugged pcie device configuration system
CN106547636A (en) Debugging system and method
CN106294143B (en) Debugging method and device for chip register
CN112015522A (en) System function expansion method, device and computer readable storage medium
CN113646744A (en) Widening memory accesses to aligned addresses for unaligned memory operations
CN119718422A (en) Protocol calculation method, engine, computer device, storage medium, and program product
CN115292000A (en) A method, device and electronic device for dynamic migration of virtual machine
CN114911541A (en) Configuration information processing method and device, electronic equipment and storage medium
CN107844321A (en) A kind of MCU processing systems
CN114374392A (en) A data compression storage method, device, terminal device and readable storage medium
CN108804221B (en) Embedded system based on XIP mode and resource optimization method thereof
WO2020221161A1 (en) Computing job processing method and system, mobile device and acceleration device
US8997044B2 (en) Overriding system attributes and function returns in a software subsystem
CN117194209A (en) Debugging method and device for embedded software
CN111045650A (en) Design method and device of Mocker joint debugging tool and computer equipment
CN107515828B (en) A kind of data reading and writing method and mobile terminal

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant