CN109240902A - A kind of method and apparatus for the firmware code obtaining electronic equipment - Google Patents

A kind of method and apparatus for the firmware code obtaining electronic equipment Download PDF

Info

Publication number
CN109240902A
CN109240902A CN201710392482.3A CN201710392482A CN109240902A CN 109240902 A CN109240902 A CN 109240902A CN 201710392482 A CN201710392482 A CN 201710392482A CN 109240902 A CN109240902 A CN 109240902A
Authority
CN
China
Prior art keywords
electronic equipment
data
storage location
code
file
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.)
Granted
Application number
CN201710392482.3A
Other languages
Chinese (zh)
Other versions
CN109240902B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710392482.3A priority Critical patent/CN109240902B/en
Publication of CN109240902A publication Critical patent/CN109240902A/en
Application granted granted Critical
Publication of CN109240902B publication Critical patent/CN109240902B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3624Software debugging by performing operations on the source code, e.g. via a compiler
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3648Software debugging using additional hardware
    • G06F11/3656Software debugging using additional hardware using a specific debug interface
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/53Decompilation; Disassembly

Abstract

The embodiment of the invention discloses a kind of method and apparatus of firmware code for obtaining electronic equipment, belong to electronic technology field.The described method includes: calling the debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment, the data in electronic equipment in the first storage location are read, wherein the data include the corresponding compiling data of firmware code of the electronic equipment;By the data storage of reading at the first file of preset format;When getting the instruction of the cutting to first file, first file is cut, obtains including corresponding the second file for compiling data of the firmware code;Decompiling processing is carried out to the compiling data in second file, obtains the firmware code of the electronic equipment.Using the present invention, firmware code can be detected.

Description

A kind of method and apparatus for the firmware code obtaining electronic equipment
Technical field
The present invention relates to electronic technology field, in particular to a kind of the method and dress of the firmware code for obtaining electronic equipment It sets.
Background technique
With the development of electronic technology, various electronic equipments are widely used, for example, smartwatch, The electronic equipments such as Intelligent bracelet.Firmware is usually contained in electronic equipment, wherein firmware can be the program code of electronic equipment (program code is alternatively referred to as firmware code) by compiling after compiling data, firmware code it is logically true whether determine the electricity Whether sub- equipment can work normally.
In order to more preferably guarantee electronic equipment firmware code it is logically true, often the manufacturer of electronic equipment can entrust Whether the logic that tripartite detects the firmware code of electronic equipment is correct.Currently, third party is often from official's net of electronic equipment Stand downloading electronic equipment firmware code the logic of firmware code is detected in turn.
In the implementation of the present invention, the inventor finds that the existing technology has at least the following problems:
The firmware code of some electronic equipments is not Open Source Code, and developer tends not to for firmware code to be placed on official's net It standing, in this case, is based on above-mentioned processing mode, you can't get the firmware codes of electronic equipment by third party, thus, it can not be right Firmware code is detected.
Summary of the invention
In order to solve the problems, such as can not to detect in the related technology to firmware code, the embodiment of the invention provides one kind The method for obtaining the firmware code of electronic equipment.The technical solution is as follows:
In a first aspect, providing a kind of method of firmware code for obtaining electronic equipment, which comprises
It calls the debugging interface of electronic equipment and connects the in-circuit debugger of electronic equipment, first deposits in reading electronic equipment Storage space set in data, wherein the data include the corresponding compiling data of firmware code of the electronic equipment;
By the data read storage at the first file of preset format;
When getting the instruction of the cutting to first file, first file is cut, obtains including institute State the second file of the corresponding compiling data of firmware code;
Decompiling processing is carried out to the compiling data in second file, obtains the firmware code of the electronic equipment.
Second aspect, provides a kind of device of firmware code for obtaining electronic equipment, and described device includes:
Read module reads electricity for calling the debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment Data in sub- equipment in the first storage location, wherein the data include the corresponding volume of firmware code of the electronic equipment Translate data;
Memory module, for the first file by the data read storage at preset format;
Module is cut, for being cut out to first file when getting the instruction of the cutting to first file It cuts, obtains including corresponding the second file for compiling data of the firmware code;
Decompilation module obtains the electronics for carrying out decompiling processing to the compiling data in second file The firmware code of equipment.
The third aspect provides a kind of terminal, and the terminal includes processor and memory, is stored in the memory At least one instruction, at least one section of program, code set or instruction set, at least one instruction, at least one section of program, institute Code set or instruction set is stated to be loaded by the processor and executed to realize consolidating for acquisition electronic equipment as described in relation to the first aspect The method of part code.
Fourth aspect provides a kind of computer readable storage medium, at least one finger is stored in the storage medium Enable, at least one section of program, code set or instruction set, at least one instruction, at least one section of program, the code set or The method that instruction set is loaded by processor and executed to realize the firmware code of acquisition electronic equipment as described in relation to the first aspect.
Technical solution provided in an embodiment of the present invention has the benefit that
In the embodiment of the present invention, terminal can call the debugging interface of electronic equipment and the on-line debugging of connection electronic equipment Device reads the corresponding compiling data of firmware code stored in electronic equipment, then, then is compiled to obtained compiling data are counter Processing is translated, the firmware code of electronic equipment is obtained, it is thus possible to make it possible to detect firmware code.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other Attached drawing.
Fig. 1 is a kind of HOOK technology schematic diagram provided in an embodiment of the present invention;
Fig. 2 is a kind of HOOK technology specific implementation schematic diagram provided in an embodiment of the present invention;
Fig. 3 is a kind of method flow diagram of firmware code for obtaining electronic equipment provided in an embodiment of the present invention;
Fig. 4 is the hardware structural diagram of a kind of electronic equipment provided in an embodiment of the present invention;
Fig. 5 is the schematic diagram of the storage address of a kind of electronic equipment provided in an embodiment of the present invention;
Fig. 6 is a kind of system framework schematic diagram provided in an embodiment of the present invention;
Fig. 7 is a kind of interface schematic diagram provided in an embodiment of the present invention;
Fig. 8 is a kind of interface schematic diagram provided in an embodiment of the present invention;
Fig. 9 is a kind of method flow diagram of firmware code for obtaining electronic equipment provided in an embodiment of the present invention;
Figure 10 is a kind of method flow diagram of firmware code for obtaining electronic equipment provided in an embodiment of the present invention;
Figure 11 is a kind of apparatus structure schematic diagram of firmware code for obtaining electronic equipment provided in an embodiment of the present invention;
Figure 12 is a kind of terminal structure schematic diagram provided in an embodiment of the present invention.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention Formula is described in further detail.
The embodiment of the invention provides a kind of method of firmware code for obtaining electronic equipment, the executing subject of this method is Terminal.Wherein, which can be the terminal with the firmware code function of obtaining electronic equipment, for example can be personal electricity Brain, computer etc..Processor, transceiver can be set in the terminal, processor can be used for obtaining the firmware of electronic equipment The relevant treatment of code, transceiver can be used for sending and receiving data, be also provided with memory, and memory can be used for Store the data for needing and generating in following treatment processes.
Technical staff needs the logic to the firmware code of electronic equipment to analyze under many scenes, for example, electronics The manufacturer of equipment in order to guarantee electronic equipment firmware code it is logically true, third party can be entrusted to detect electronic equipment and consolidated Whether the logic of part code is correct, and in this case, vicarial third-party technical staff needs to the electronic equipment The logic of firmware code is analyzed, and in such cases, technical staff is firstly the need of acquisition firmware code.Currently, obtaining solid The mode of part code can there are two types of, wherein mode one: can from the official website of electronic equipment download electronic equipment firmware Code, but the firmware code of some electronic equipments is not Open Source Code, developer tends not to firmware code being placed on official Website, in this case, be based on such processing mode, you can't get the firmware codes of electronic equipment, thus, technical staff without Method detects firmware code.Mode two: electronic equipment is triggered by hook hook technology, firmware liter is carried out to firmware code Grade OTA (Over-the-Air Technology, space download technology) obtains the firmware that server issues during OTA.
Below by taking android (Android) operating system as an example, HOOK technology is described in detail.Specifically, System program maintains a set of case distribution mechanism in Android operation system.Applications trigger event that application program includes and Background logic processing, is executed downwards step by step according to event handler procedure.And the meaning of HOOK, exactly arrived in event transmission The transmission that simultaneously monitor event is intercepted and captured before terminal, as a hook hooks upper event.And it can be when hooking upper event, processing Specific event.This function of HOOK, enable it to by for realizing the code of particular event " involvement " to being hooked on (HOOK) in the executive process (can be described as target process) of code, become a part of target process, as shown in Figure 1.
The concrete processing procedure of HOOK technology can be such that finds the address of objective function in memory first, then The address block is set as writeable, the content of modified objective function address, and the letter of HOOK function is jumped to when invocation target function Number address, HOOK function jumps back to again after having executed to be come, and specific steps are as shown in Figure 2.Wherein, left-hand component expression needs HOOK Function, the realization of order 1 to N representative function instructs, and dotted box portion indicates the HOOK function realized by HOOK, bold box Part indicates former designated commands 1 of storage function, and returns to the jump instruction for executing order 2.Therefore, if it is desirable to HOOK Function, it is necessary first to apply for space in remote process, former instructions of space meeting storage function, and jump back to function The jump instruction of subsequent instructions.Secondly, needing for function address to be redirected to HOOK function.In this way, when application program executes letter When number, due to being redirected to HOOK function before, the code of HOOK function can be first carried out, can locate in HOOK function Reason comes into the parameter come and jumps to bottom right bold box partial order 1 after processing is completed, and orders 1 to execute herein and is equivalent to execution The order 1 of original function, the followed by execution jump instruction that order 1 has executed, which jumps at order 2, to be executed.Therefore, a HOOK After transfer, function is completely executed.It is obtaining firmware code in the related technology, electronics can triggered by HOOK technology Equipment carries out firmware upgrade, in turn, the firmware that available server issues.It can be specifically used for by changing in electronic equipment Determine whether that the judgment condition for carrying out firmware upgrade carries out to trigger electronic equipment progress firmware upgrade for example, can will determine The judgment condition of firmware upgrade is less than latest edition by current version number, is revised as current version more than or equal to latest edition. But there is no the functions of firmware upgrade for current some electronic equipments, in such cases, can not trigger electricity by HOOK technology Sub- equipment carries out firmware upgrade, thus, cause technical staff that can not obtain the firmware code of electronic equipment.In addition, being risen for safety See, the firmware that often server issues is encrypted firmware, and in such cases, what is got is also encrypted firmware, nothing It is decrypted in method, thus, lead to not the firmware code for getting electronic equipment.
In scheme provided by the embodiment of the present invention, the firmware in electronic equipment is can be read directly in terminal, i.e. terminal can To call the debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment, the firmware generation stored in electronic equipment is read Then the corresponding compiling data of code, then carry out decompiling processing to obtained compiling data, obtain the firmware generation of electronic equipment Code, it is thus possible to make it possible to detect firmware code.
For the ease of the understanding to the embodiment of the present invention, introduce first below the present embodiments relate to basic conception.
1.Keil compiling application: Keil compiling application is provided including C compiler, Macro assembler, linker, depositary management reason and one Complete development plan including a powerful simulation debugger etc., by an Integrated Development Environment (μ Vision) by this It partially combines a bit.Keil5 compiling application, which is released, is based on the interface μ Vision, for debugging ARM7, ARM9, Cortex-M The MDK-ARM (built-in application program) of (title that wherein, ARM7, ARM9, Cortex-M are microprocessor) kernel, for controlling The exploitation in field processed.
2. embedded device: embedded device is mainly by embeded processor, associated support hardware and embedded software system System composition, it is " device element " that can work independently for integrating software and hardware.
3. firmware: referring to the executable program run in embedded device in this programme;
4.JTAG basic principle: JTAG (Joint Test Action Group, combined testing action group) is a kind of state Border standard test protocols (IEEE 1149.1 is compatible), are mainly used for chip interior test.Most high-grade devices is all supported now JTAG protocol, such as DSP (digital signal processor, digital signal processor), FPGA (Field- Programmable Gate Array, field programmable gate array) device etc..The jtag interface of standard is 4 lines: TMS, TCK, TDI, TDO, respectively model selection, clock, data input and DOL Data Output Line.JTAG is initially for testing chip , basic principle is to define a TAP (Test Access Port, test access mouth) in device inside, by dedicated Jtag test tool tests internal node.Jtag test allows multiple devices to be cascaded by jtag interface, shape At a JTAG chain, it is able to achieve and each device is tested respectively.Now, jtag interface is also commonly used for realizing ISP (In-System Programmable, online programming), online programming is carried out to devices such as FLASH.JTAG programming mode is online programming, tradition First chip progress pre-programmed realization is refilled in production procedure and is therefore changed on plate, simplified process is that first immobilising device arrives It on circuit board, then is programmed with JTAG, to greatly speed up project progress.
Below in conjunction with specific embodiment, process flow shown in Fig. 3 is described in detail, content can be as Under:
Step 301, the debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment are called, electronic equipment is read In data in the first storage location, wherein data include the corresponding compiling data of firmware code of electronic equipment.
Wherein, the device that debugging interface can be for realizing online programming connects for example, debugging interface can be JTAG Mouth, UART (Universal Asynchronous Receiver/Transmitte, universal asynchronous receiving-transmitting transmitter) interface etc., In-circuit debugger can be for the device to electronic equipment load executable program.Electronic equipment can be with embedded place The equipment for managing device, for example can be the equipment such as bracelet, wrist-watch, router.Firmware code can be the program code of electronic equipment, For example can be the code of assembler language, compiling data can be the executable data of electronic equipment, can be firmware code warp Compiling data after crossing compiling.
In an implementation, it is often provided on the PCB (Printed Circuit Board, printed circuit board) of electronic equipment Debugging interface.After technical staff gets electronic equipment, the shell of electronic equipment can be removed, get electronic equipment PCB can determine the chip model of the microprocessor on PCB in turn.After obtaining chip model, technical staff can be by looking into Chip data handbook is read, determines the storage location of firmware in the electronic equipment.
For example, electronic equipment includes main control MCU (Microcontroller Unit, micro-control unit), bluetooth MCU, peace The outer Flash (flash memory) of full chip, lithium battery, wireless charging component, piece, display screen, antenna and sensor/vibration motor periphery electricity Road, wherein main control MCU, that is, above-mentioned microprocessor, hardware structure diagram is as shown in figure 4, the chip model of the electronic equipment is STM32F103ZET6 can then learn that the chip is the enhancing under STM32F103xE series by consulting chip data handbook Type, the microprocessor of ARM (embedded) core is based on for 32, which includes the flash chip of 512KB (kilobytes), flash memory The corresponding address of chip is 0x08000000~0x0807FFFF, and the firmware of the electronic equipment comprising the chip is stored in flash memory In chip, that is, it is stored in (in such cases, the first storage location in the corresponding storage location of 0x08000000~0x0807FFFF Can be the corresponding storage location of 0x08000000~0x0807FFFF), wherein the storage address schematic diagram of electronic equipment is as schemed Shown in 5.
After obtaining the PCB of electronic equipment, after the storage location for the firmware for determining the electronic equipment, technical staff may be used also With by PCB debugging interface and in-circuit debugger (in-circuit debugger can be J-Link debugger, wherein J-Link is A kind of title of in-circuit debugger) one end connection, the other end of in-circuit debugger connect with terminal, realization electronic equipment lead to The connection of in-circuit debugger and terminal is crossed, as shown in Figure 6.After electronic equipment, in-circuit debugger are connected with terminal, terminal can be with The corresponding information of electronic equipment is obtained, for example, technical staff can input in the respective interface debugged in application in the terminal The chip model of microprocessor can obtain the chip model of the microprocessor of input by operation, triggering terminal in turn.
Compiling application is also equipped in terminal, (wherein, Keil is one for example, Keil compiling application can be equipped with The title of kind compiling application).After the completion of above-mentioned preparation, terminal can be compiled by Keil and be applied, to realize calling electronics The debugging interface of equipment and the in-circuit debugger of connection electronic equipment, read the data in electronic equipment in the first storage location Processing, wherein the first storage location is the storage location for the firmware that technical staff is determined by access chip data handbook. That is, the data for the first storage location that terminal is read include the firmware of electronic equipment, that is, it include consolidating for electronic equipment The corresponding compiling data of part code.
Optionally, terminal can be read in the first storage location by loading object code in the memory to electronic equipment Data, correspondingly, the treatment process of step 301 can be such that acquisition for reading in electronic equipment in the first storage location Data object code, call electronic equipment debugging interface and connection electronic equipment in-circuit debugger, by object code It is loaded into the memory of electronic equipment;The data in electronic equipment in the first storage location are read by object code.
In an implementation, technical staff can be write by the compiling application in terminal for reading first in electronic equipment The object code of data in storage location.After the completion of writing, the available object code write of terminal, and then terminal can be with Object code is loaded into the memory of electronic equipment, wherein the corresponding address of the memory of electronic equipment can also pass through access Chip data handbook is learnt.After object code is loaded into electronic equipment, terminal can be read first and be deposited by object code Storage space set in data.Specifically, electronic equipment can be with performance objective after object code is loaded into the memory of electronic equipment Code, it can by object code, read the data in the first storage location, after reading data, data can be sent To terminal.Correspondingly, terminal can receive the data in the first storage location of electronic equipment transmission.
For example, the chip type of microprocessor is STM32F103ZET6, then the partial code of object code can be such that
Optionally, before loading object code to electronic equipment, terminal can also determine the storage location of object code, phase It answers, treatment process can be such that in the memory for obtaining electronic equipment for storing the second storage location information of object code, Correspondingly, treatment process can be such that the in-circuit debugger of the debugging interface for calling electronic equipment and connection electronic equipment, by mesh Mark code is loaded into the second storage location in the memory of electronic equipment.
In an implementation, before loading object code, terminal can also be obtained in electronic equipment memory for storing target The information (can be described as the second storage location information) of the storage location of code.Specifically, terminal can show the setting page, setting The input frame of the storage location for storing object code can be shown in the page, technical staff can input in input frame (wherein, corresponding second storage location of the second storage location information can be certain storage in memory to second storage location information Position), determining key can also be shown by being arranged in the page, can be with when terminal is got to the selection instruction for determining key Obtain the second storage location information.For example, chip model is STM32F103ZET6, the page is set as shown in fig. 7, technical staff The corresponding address of memory of the microprocessor of the chip model, in turn, Ke Yi can be obtained by consulting chip data handbook The second storage location information is inputted in the corresponding input frame of the IROM being arranged in the page (for example, the start address of input memory 0x20000000), ok key is then clicked, at this point, terminal is available to the second storage location information.
After getting the second storage location information, the configuration file pre-set can also be loaded, wherein when Chip model is STM32F103ZET6, and the content of configuration file is as follows:
After getting the second storage location information and loading configuration file, electronic equipment can also carry out reset processing. After the completion of above-mentioned preparation, the available object code of terminal, and the debugging interface and connection electricity of electronic equipment can be called The in-circuit debugger of sub- equipment, the second storage location object code being loaded into the memory of electronic equipment.
Step 302, the data read are stored to the first file at preset format.
In an implementation, after reading the data in the first storage location, the data read can be stored into default lattice First file of formula, wherein preset format can be hex (16 mechanism) format.Specifically, terminal passes through above-mentioned object code After reading the data in the first storage location, it can be shown, as shown in figure 8, in turn, terminal can be by display Data store the first file at preset format.
Optionally, the processing of step 301 can also be completed by saving instruction, be obtained correspondingly, treatment process can be such that It goes bail for and deposits instruction, the in-circuit debugger of the debugging interface and connection electronic equipment that call electronic equipment is read based on instruction is saved Data in electronic equipment in the first storage location.
In an implementation, technical staff can input in the respective interface of terminal and save instruction (save instruction), when terminal connects After receiving operating instruction, available preservation instruction, and preservation instruction is run, in turn, it can read in the first storage location Data, and by the data read with the storage of the first file of preset format into default file folder.
Optionally, saving instruction may include command identification, the first storage location information, and the command identification is for identifying this To save instruction, the first storage location information can be the corresponding address of the first storage location for instruction.Correspondingly, treatment process can With as follows: the debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment are called, based on first in preservation instruction Storage location information reads the data in electronic equipment in the first storage location.
In an implementation, the information (i.e. first that instruction may include the storage location of command identification and data to be obtained is saved Storage location information).When terminal operating saves instruction, the first storage location information corresponding the saved in instruction can be read Data in one storage location, and stored into the first file of preset format.
Optionally, the storage location that the first file can also be specified in saving instruction, correspondingly, treatment process can be as Under: based on the local third storage location information saved in instruction, by the data read with the first file of preset format Store the third storage location.
It in an implementation, can be by being inputted in compiling application after terminal reads the data in the first storage location Instruction is saved, by the data read storage at the first file of preset format, saving in instruction can also include the first file Storage location information (i.e. the corresponding location information of third storage location), wherein third storage location is in terminal local Storage location, i.e., after terminal obtains the first file, can by the first file store to save instruction in third storage location In the corresponding third storage location of information.For example, compiling application is that Keil compiling is applied, chip model STM32F103ZET6, Then save instruction can be such that SAVE C: TEST 0x08000000,0x0807FFFF.
Step 303, when getting the instruction of the cutting to the first file, the first file is cut, obtains including solid Second file of the corresponding compiling data of part code.
In an implementation, after the storage location for storing firmware is inquired by chip data handbook, when terminal is to electronics When equipment loading firmware, electronic equipment can store the firmware of load since the initial address of the storage location.Work as storage location When the storable data volume upper limit is greater than the data volume of the firmware of the electronic equipment, the address of the latter half of the first storage location In will be sky, in such cases, the data read from the first storage location can include firmware, and be included as empty storage Data in location (data can be described as sky data, and empty data are generally 00, or are FF).
Based on the above situation, terminal obtains compiling data not only comprising firmware code, but also includes the first file of sky data Afterwards, terminal can cut the first file, obtain the second file comprising compiling data.Specifically, terminal can be shown Data in first file can cut data therein in turn, for example, the empty number in the first file can be deleted According at this point, terminal will get cutting instruction, in turn, terminal can be cut (for example, deleting technique the first file Personnel want the data deleted), it obtains including corresponding the second file for compiling data of firmware code.
Step 304, decompiling processing is carried out to the compiling data in the second file, obtains the firmware code of electronic equipment.
In an implementation, after obtaining the second file, terminal can carry out decompiling processing to the compiling data in the second file, The firmware code of electronic equipment is obtained, for example, the firmware code of assembler language is obtained, so that subsequent technology personnel are to firmware code It is analyzed, detects the correctness of the logic of firmware code.
In addition, obtaining the firmware generation of electronic equipment by loading object code in the memory to electronic equipment for terminal The case where code, this programme is described in detail, as shown in Figure 9.
Step 901, the chip model of the microprocessor for the electronic equipment connecting with in-circuit debugger is obtained.
In an implementation, debugging interface is often provided on the PCB of electronic equipment.After technical staff gets electronic equipment, The shell of electronic equipment can be removed, get the PCB of electronic equipment.After obtaining the PCB of electronic equipment, except determining the electricity After the storage location of the firmware of sub- equipment, technical staff can also be by the debugging interface and in-circuit debugger (online tune on PCB Examination device can be J-Link debugger, wherein J-Link is a kind of title of in-circuit debugger) one end connection, will adjust online The other end of examination device is connect with terminal, realizes that electronic equipment passes through the connection of in-circuit debugger and terminal, as shown in Figure 6.It will be electric After sub- equipment, in-circuit debugger are connected with terminal, the corresponding information of the available electronic equipment of terminal, for example, technical staff can With the chip model of input microprocessor in the respective interface in debugging application in the terminal, in turn, operation, touching can be passed through Send out the chip model that terminal obtains the microprocessor of input.
Step 902, it obtains in the memory of electronic equipment for storing the second storage location information of object code.
In an implementation, before loading object code, terminal can also be obtained in electronic equipment memory for storing target The information (can be described as the second storage location information) of the storage location of code.Specifically, terminal can show the setting page, setting The input frame of the storage location for storing object code can be shown in the page, technical staff can input in input frame Second storage location information, determining key can also be shown by being arranged in the page, when terminal detects the selection to key is determined When instruction, available second storage location information.For example, chip model is STM32F103ZET6, the page such as Fig. 7 institute is set Showing, technical staff can obtain the corresponding address of memory of the microprocessor of the chip model by access chip data handbook, In turn, the second storage location information can be inputted in the corresponding input frame of IROM in the setting page (for example, inputting memory Start address 0x20000000), then click ok key, it will triggering terminal gets the second storage location information.
Step 903, loading configuration file.
In an implementation, after getting the second storage location information, terminal can also to the configuration file pre-set into Row load, so that object code can be successfully loaded into the memory of electronic equipment by SS later.
Step 904, the debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment are called, will be used to read electricity The object code of data in sub- equipment in the first storage location, the second storage location being loaded into the memory of electronic equipment.
In an implementation, after getting the second storage location information and loading configuration file, electronic equipment can be answered Position.After the completion of above-mentioned preparation, the available object code of terminal, and can be by debugging interface and in-circuit debugger, it will Object code is loaded into the second storage location in the memory of electronic equipment.
Step 905, the data in electronic equipment in the first storage location are read by object code.
Specifically, after object code is loaded into the second storage location in the memory of electronic equipment, electronic equipment can be with Performance objective code, it can by object code, read the data in the first storage location, after reading data, can incite somebody to action Data are sent to terminal.Correspondingly, terminal can receive the data in the first storage location of electronic equipment transmission.
Step 906, the data read are stored to the first file at preset format.
In an implementation, after reading the data in the first storage location, the data read can be stored into default lattice First file of formula, wherein preset format can be hex (16 mechanism) format.Specifically, terminal passes through above-mentioned object code After reading the data in the first storage location, it can be shown, as shown in figure 8, in turn, terminal can be by display Data store the first file at preset format.
Optionally, in such cases, terminal can be stored the data read at preset format based on instruction is saved First file can be by the guarantor that inputs in compiling application specifically, after terminal reads the data in the first storage location Instruction is deposited, by the data read storage at the first file of preset format.
Optionally, the storage location that the first file can also be specified in saving instruction, correspondingly, treatment process can be as Under: based on the third storage location information in the local saved in instruction, by the data read with the first text of preset format Part is stored to third storage location.
In an implementation, saving can also be including information (the i.e. third storage location of the storage location of the first file in instruction Information), i.e., after terminal obtains the first file, the first file can be stored to the third storage location information pair saved in instruction In the third storage location answered.For example, compiling application is Keil compiling application, chip model STM32F103ZET6 is then saved Instruction can be such that SAVE C: TEST 0x08000000,0x0807FFFF.
Step 907, when getting the instruction of the cutting to the first file, the first file is cut, obtains including solid Second file of the corresponding compiling data of part code.
In an implementation, after the storage location for storing firmware is inquired by chip data handbook, when terminal is to electronics When equipment loading firmware, electronic equipment can store the firmware of load since the initial address of the storage location.Work as storage location When the storable data volume upper limit is greater than the data volume of the firmware of the electronic equipment, the address of the latter half of the first storage location In will be sky, in such cases, the data read from the first storage location can include firmware, and be included as empty storage Data in location (data can be described as sky data, and empty data are generally 00, or are FF).
Based on the above situation, terminal obtains compiling data not only comprising firmware code, but also includes the first file of sky data Afterwards, terminal can cut the first file, obtain the second file comprising compiling data.Specifically, terminal can be shown Data in first file can cut data therein in turn, for example, the empty number in the first file can be deleted According at this point, terminal will get cutting instruction, in turn, terminal can be cut (for example, deleting technique the first file Personnel want the data deleted), it obtains including corresponding the second file for compiling data of firmware code.
Step 908, decompiling processing is carried out to the compiling data in the second file, obtains the firmware code of electronic equipment.
In an implementation, after obtaining the second file, terminal can carry out decompiling processing to the compiling data in the second file, The firmware code of electronic equipment is obtained, for example, the firmware code of assembler language is obtained, so that subsequent technology personnel are to firmware code It is analyzed, detects the correctness of the logic of firmware code, improve the convenience for obtaining the firmware code of electronic equipment and reliable Property.
In addition, being carried out for terminal by saving the case where instructing the firmware code to obtain electronic equipment to this programme Detailed description, as shown in Figure 10.
Step 1001, the chip model of the microprocessor for the electronic equipment connecting with in-circuit debugger is obtained.
In an implementation, debugging interface is often provided on the PCB of electronic equipment.After technical staff gets electronic equipment, The shell of electronic equipment can be removed, get the PCB of electronic equipment.After obtaining the PCB of electronic equipment, except determining the electricity After the storage location of the firmware of sub- equipment, technical staff can also be by the debugging interface and in-circuit debugger (online tune on PCB Examination device can be J-Link debugger, wherein J-Link is a kind of title of in-circuit debugger) one end connection, will adjust online The other end of examination device is connect with terminal, realizes that electronic equipment passes through the connection of in-circuit debugger and terminal, as shown in Figure 6.It will be electric After sub- equipment, in-circuit debugger are connected with terminal, terminal can be configured the corresponding information of electronic equipment, for example, technology The chip model that personnel can debug input microprocessor in the respective interface in applying in the terminal can pass through in turn Operation, triggering terminal obtain the chip model of the microprocessor of input.After terminal gets chip model, that is, get with online The chip model of the microprocessor of the electronic equipment of debugger connection.
Step 1002, the debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment are called, is referred to based on preservation The first storage location information in order reads the data in electronic equipment in the first storage location.
In an implementation, technical staff can input in the respective interface of terminal and save instruction (save instruction), when terminal connects After receiving operating instruction, available preservation instruction, and preservation instruction is run, in turn, it can read in the first storage location Data.
Step 1003, based on the local third storage location information saved in instruction, by the data read with default First file of format is stored to third storage location.
In an implementation, saving can also storage location information (the i.e. third storage location letter including the first file in instruction Breath), i.e., after terminal obtains the first file, the first file can be stored corresponding to the third storage location information saved in instruction Third storage location on.For example, compiling application is Keil compiling application, chip model STM32F103ZET6 is then saved and is referred to Order can be such that SAVE C: TEST 0x08000000,0x0807FFFF.
Step 1004, when getting the instruction of the cutting to the first file, the first file is cut, obtains including solid Second file of the corresponding compiling data of part code.
In an implementation, after the storage location for storing firmware is inquired by chip data handbook, when terminal is to electronics When equipment loading firmware, electronic equipment can store the firmware of load since the initial address of the storage location.Work as storage location When the storable data volume upper limit is greater than the data volume of the firmware of the electronic equipment, the address of the latter half of the first storage location In will be sky, in such cases, the data read from the first storage location can include firmware, and be included as empty storage Data in location (data can be described as sky data, and empty data are generally 00, or are FF).
Based on the above situation, terminal obtains compiling data not only comprising firmware code, but also includes the first file of sky data Afterwards, terminal can cut the first file, obtain the second file comprising compiling data.Specifically, terminal can be shown Data in first file can cut data therein in turn, for example, the empty number in the first file can be deleted According at this point, terminal will get cutting instruction, in turn, terminal can be cut (for example, deleting technique the first file Personnel want the data deleted), it obtains including corresponding the second file for compiling data of firmware code.
Step 1005, decompiling processing is carried out to the compiling data in the second file, obtains the firmware code of electronic equipment.
In an implementation, after obtaining the second file, terminal can carry out decompiling processing to the compiling data in the second file, The firmware code of electronic equipment is obtained, for example, the firmware code of assembler language is obtained, so that subsequent technology personnel are to firmware code It is analyzed, detects the correctness of the logic of firmware code.
In the embodiment of the present invention, terminal can be stored in reading electronic equipment by debugging interface and in-circuit debugger Then the corresponding compiling data of firmware code, then carry out decompiling processing to obtained compiling data, obtain consolidating for electronic equipment Part code, it is thus possible to make it possible to detect firmware code.
In addition, provide through the embodiment of the present invention acquisition electronic equipment firmware code method, terminal by with electricity Sub- equipment is connected, and directly reads the data in electronic equipment in the first storage location, to obtain the firmware code of electronic equipment, from And the convenience for obtaining the firmware code of electronic equipment can be improved, and reached and do not changed the firmware in electronic equipment, with And under the premise of not destroying the microprocessor of electronic equipment, the purpose of the firmware code of electronic equipment is obtained, improves and obtains electronics The convenience and reliability of the firmware code of equipment.
Based on the same technical idea, the embodiment of the invention also provides a kind of dresses of firmware code for obtaining electronic equipment It sets, as shown in figure 11, which includes:
Read module 1110 is read for calling the debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment Take the data in electronic equipment in the first storage location, wherein the data include that the firmware code of the electronic equipment is corresponding Compiling data;
Memory module 1120, for the first file by the data read storage at preset format;
Cut module 1130, for when get the cutting to first file instruction when, to first file into Row is cut, and obtains including corresponding the second file for compiling data of the firmware code;
Decompilation module 1140 obtains described for carrying out decompiling processing to the compiling data in second file The firmware code of electronic equipment.
Optionally, the read module 1110, is used for:
Obtain the object code for reading the data in the electronic equipment in the first storage location;
The debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment are called, the object code is loaded into In the memory of the electronic equipment;
The data in the electronic equipment in the first storage location are read by the object code.
Optionally, the read module 1110, is used for:
It obtains in the memory of the electronic equipment for storing the second storage location information of object code;
The debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment are called, the object code is loaded into The second storage location in the memory of the electronic equipment.
Optionally, the read module 1110, is used for:
It obtains and saves instruction;
The debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment are called, is instructed, is read based on the preservation Take the data in the electronic equipment in the first storage location.
Optionally, the read module 1110, is used for:
The debugging interface of electronic equipment and the in-circuit debugger of connection electronic equipment are called, based on first in preservation instruction Storage location information reads the data in the first storage location described in electronic equipment.
Optionally, the memory module 1120, comprising:
It is instructed based on saving, by the data read storage at the first file of preset format.
Optionally, the memory module 1120, comprising:
Based on the local third storage location information saved in instruction, the data read are stored into preset format First file, and first file is stored to the third storage location.
It should be noted that above-mentioned read module 1110, memory module 1120, cutting module 1130, decompilation module 1140 can be realized or processor cooperation memory is realized by processor, alternatively, processor executes the program in memory Instruction is to realize.
In the embodiment of the present invention, terminal can be stored in reading electronic equipment by debugging interface and in-circuit debugger Then the corresponding compiling data of firmware code, then carry out decompiling processing to obtained compiling data, obtain consolidating for electronic equipment Part code, it is thus possible to make it possible to detect firmware code.
In addition, provide through the embodiment of the present invention acquisition electronic equipment firmware code method, terminal by with electricity Sub- equipment is connected, and directly reads the data in electronic equipment in the first storage location, to obtain the firmware code of electronic equipment, from And the convenience for obtaining the firmware code of electronic equipment can be improved, and reached and do not changed the firmware in electronic equipment, with And under the premise of not destroying the microprocessor of electronic equipment, the purpose of the firmware code of electronic equipment is obtained, improves and obtains electronics The convenience and reliability of the firmware code of equipment.
It should be understood that the device of the firmware code provided by the above embodiment for obtaining electronic equipment is set in acquisition electronics It, only the example of the division of the above functional modules, can basis in practical application when the device of standby firmware code It needs and is completed by different functional modules above-mentioned function distribution, i.e., the internal structure of terminal is divided into different function moulds Block, to complete all or part of the functions described above.In addition, the firmware generation provided by the above embodiment for obtaining electronic equipment The embodiment of the method for the firmware code of the device and acquisition electronic equipment of code belongs to same design, the specific implementation process side of being detailed in Method embodiment, which is not described herein again.
Figure 12 is please referred to, it illustrates the structural schematic diagram of terminal involved in the embodiment of the present invention, can be used for implementing The method of the firmware code of the acquisition electronic equipment provided in above-described embodiment.Specifically:
Terminal 1200 may include RF (Radio Frequency, radio frequency) circuit 110, include one or more The memory 120 of computer readable storage medium, input unit 130, display unit 140, sensor 150, voicefrequency circuit 160, WiFi (wireless fidelity, Wireless Fidelity) module 170, the processing for including one or more than one processing core The components such as device 180 and power supply 190.It will be understood by those skilled in the art that terminal structure shown in Figure 12 is not constituted pair The restriction of terminal may include perhaps combining certain components or different component cloth than illustrating more or fewer components It sets.Wherein:
RF circuit 110 can be used for receiving and sending messages or communication process in, signal sends and receivees, particularly, by base station After downlink information receives, one or the processing of more than one processor 180 are transferred to;In addition, the data for being related to uplink are sent to Base station.In general, RF circuit 110 includes but is not limited to antenna, at least one amplifier, tuner, one or more oscillators, uses Family identity module (SIM) card, transceiver, coupler, LNA (Low Noise Amplifier, low-noise amplifier), duplex Device etc..In addition, RF circuit 110 can also be communicated with network and other equipment by wireless communication.The wireless communication can make With any communication standard or agreement, and including but not limited to GSM (Global System of Mobile communication, entirely Ball mobile communcations system), GPRS (General Packet Radio Service, general packet radio service), CDMA (Code Division Multiple Access, CDMA), WCDMA (Wideband Code Division Multiple Access, wideband code division multiple access), LTE (Long Term Evolution, long term evolution), Email, SMS (Short Messaging Service, short message service) etc..
Memory 120 can be used for storing software program and module, and processor 180 is stored in memory 120 by operation Software program and module, thereby executing various function application and data processing.Memory 120 can mainly include storage journey Sequence area and storage data area, wherein storing program area can the (ratio of application program needed for storage program area, at least one function Such as sound-playing function, image player function) etc.;Storage data area, which can be stored, uses created number according to terminal 1200 According to (such as audio data, phone directory etc.) etc..In addition, memory 120 may include high-speed random access memory, can also wrap Include nonvolatile memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts. Correspondingly, memory 120 can also include Memory Controller, to provide processor 180 and input unit 130 to memory 120 access.
Input unit 130 can be used for receiving the number or character information of input, and generate and user setting and function Control related keyboard, mouse, operating stick, optics or trackball signal input.Specifically, input unit 130 may include touching Sensitive surfaces 131 and other input equipments 132.Touch sensitive surface 131, also referred to as touch display screen or Trackpad are collected and are used Family on it or nearby touch operation (such as user using any suitable object or attachment such as finger, stylus in touch-sensitive table Operation on face 131 or near touch sensitive surface 131), and corresponding attachment device is driven according to preset formula.It is optional , touch sensitive surface 131 may include both touch detecting apparatus and touch controller.Wherein, touch detecting apparatus detection is used The touch orientation at family, and touch operation bring signal is detected, transmit a signal to touch controller;Touch controller is from touch Touch information is received in detection device, and is converted into contact coordinate, then gives processor 180, and can receive processor 180 The order sent simultaneously is executed.Furthermore, it is possible to using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves Realize touch sensitive surface 131.In addition to touch sensitive surface 131, input unit 130 can also include other input equipments 132.Specifically, Other input equipments 132 can include but is not limited to physical keyboard, function key (such as volume control button, switch key etc.), One of trace ball, mouse, operating stick etc. are a variety of.
Display unit 140 can be used for showing information input by user or the information and terminal 1200 that are supplied to user Various graphical user interface, these graphical user interface can be made of figure, text, icon, video and any combination thereof. Display unit 140 may include display panel 141, optionally, can use LCD (Liquid Crystal Display, liquid crystal Show device), the forms such as OLED (Organic Light-Emitting Diode, Organic Light Emitting Diode) configure display panel 141.Further, touch sensitive surface 131 can cover display panel 141, when touch sensitive surface 131 detects touching on it or nearby After touching operation, processor 180 is sent to determine the type of touch event, is followed by subsequent processing device 180 according to the type of touch event Corresponding visual output is provided on display panel 141.Although touch sensitive surface 131 and display panel 141 are conducts in Figure 12 Two independent components realize input and input function, but in some embodiments it is possible to by touch sensitive surface 131 and display Panel 141 is integrated and realizes and outputs and inputs function.
Terminal 1200 may also include at least one sensor 150, such as optical sensor, motion sensor and other sensings Device.Specifically, optical sensor may include ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environment The light and shade of light adjusts the brightness of display panel 141, and proximity sensor can close display when terminal 1200 is moved in one's ear Panel 141 and/or backlight.As a kind of motion sensor, gravity accelerometer can detect in all directions (generally Three axis) acceleration size, can detect that size and the direction of gravity when static, can be used to identify mobile phone posture application (ratio Such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap);Extremely In other sensors such as gyroscope, barometer, hygrometer, thermometer, the infrared sensors that terminal 1200 can also configure, herein It repeats no more.
Voicefrequency circuit 160, loudspeaker 161, microphone 162 can provide the audio interface between user and terminal 1200.Sound Electric signal after the audio data received conversion can be transferred to loudspeaker 161, be converted to by loudspeaker 161 by frequency circuit 160 Voice signal output;On the other hand, the voice signal of collection is converted to electric signal by microphone 162, is received by voicefrequency circuit 160 After be converted to audio data, then by after the processing of audio data output processor 180, be sent to through RF circuit 110 such as another Terminal, or audio data is exported to memory 120 to be further processed.Voicefrequency circuit 160 is also possible that earplug is inserted Hole, to provide the communication of peripheral hardware earphone Yu terminal 1200.
WiFi belongs to short range wireless transmission technology, and terminal 1200 can help user to receive and dispatch electricity by WiFi module 170 Sub- mail, browsing webpage and access streaming video etc., it provides wireless broadband internet access for user.Although Figure 12 shows Go out WiFi module 170, but it is understood that, and it is not belonging to must be configured into for terminal 1200, it completely can be according to need It to omit within the scope of not changing the essence of the invention.
Processor 180 is the control centre of terminal 1200, utilizes each portion of various interfaces and connection whole mobile phone Point, by running or execute the software program and/or module that are stored in memory 120, and calls and be stored in memory 120 Interior data execute the various functions and processing data of terminal 1200, to carry out integral monitoring to mobile phone.Optionally, it handles Device 180 may include one or more processing cores;Preferably, processor 180 can integrate application processor and modulation /demodulation processing Device, wherein the main processing operation system of application processor, user interface and application program etc., modem processor is mainly located Reason wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 180.
Terminal 1200 further includes the power supply 190 (such as battery) powered to all parts, it is preferred that power supply can pass through electricity Management system and processor 180 are logically contiguous, to realize management charging, electric discharge and power consumption by power-supply management system The functions such as management.Power supply 190 can also include one or more direct current or AC power source, recharging system, power supply event Hinder the random components such as detection circuit, power adapter or inverter, power supply status indicator.
Although being not shown, terminal 1200 can also include camera, bluetooth module etc., and details are not described herein.Specifically at this In embodiment, the display unit of terminal 1200 is touch-screen display, and terminal 1200 further includes having memory, is stored in memory There are at least one instruction, at least one section of program, code set or instruction set, above-mentioned at least one instruction, at least one section of program, code Collection or instruction set can be loaded by processor and be executed the method to complete the firmware code of above-mentioned acquisition electronic equipment.
In the exemplary embodiment, one kind is additionally provided to include at least one instruction, at least one section of program, code set or refer to Enable the non-transitorycomputer readable storage medium of collection, the memory for example including instruction, above-mentioned at least one instruction, at least one Duan Chengxu, code set or instruction set can be loaded and be executed by processor to complete the side of the firmware code of above-mentioned acquisition electronic equipment Method.For example, the non-transitorycomputer readable storage medium can be ROM, RAM, CD-ROM, tape, floppy disk and light data Store equipment etc..
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.

Claims (14)

1. a kind of method for the firmware code for obtaining electronic equipment, which is characterized in that the described method includes:
It calls the debugging interface of the electronic equipment and connects the in-circuit debugger of the electronic equipment, read the electronic equipment In data in the first storage location, wherein the data include the corresponding compiling data of firmware code of the electronic equipment;
By the data read storage at the first file of preset format;
When getting the instruction of the cutting to first file, first file is cut, obtains including described solid Second file of the corresponding compiling data of part code;
Decompiling processing is carried out to the compiling data in second file, obtains the firmware code of the electronic equipment.
2. the method according to claim 1, wherein the debugging interface for calling the electronic equipment and connection The in-circuit debugger of the electronic equipment reads the data in the electronic equipment in the first storage location, comprising:
Obtain the object code for reading the data in the electronic equipment in the first storage location;
It calls the debugging interface of the electronic equipment and connects the in-circuit debugger of the electronic equipment, the object code is added It is downloaded in the memory of the electronic equipment;
The data in the electronic equipment in the first storage location are read by the object code.
3. according to the method described in claim 2, it is characterized in that, the method also includes:
It obtains in the memory of the electronic equipment for storing the second storage location information of object code;
The debugging interface for calling the electronic equipment and the in-circuit debugger for connecting the electronic equipment, by the target generation Code is loaded into the memory of the electronic equipment, comprising:
It calls the debugging interface of the electronic equipment and connects the in-circuit debugger of the electronic equipment, the object code is added The second storage location being downloaded in the memory of the electronic equipment.
4. the method according to claim 1, wherein the debugging interface for calling the electronic equipment and connection The in-circuit debugger of the electronic equipment reads the data in the electronic equipment in the first storage location, comprising:
It obtains and saves instruction;
It calls the debugging interface of the electronic equipment and connects the in-circuit debugger of the electronic equipment, referred to based on the preservation It enables, reads the data in the electronic equipment in the first storage location.
5. according to the method described in claim 4, it is characterized in that, the preservation instruction in include the first storage location information, The debugging interface for calling the electronic equipment and the in-circuit debugger for connecting the electronic equipment, are referred to based on the preservation It enables, reads the data in the electronic equipment in the first storage location, comprising:
It calls the debugging interface of the electronic equipment and connects the in-circuit debugger of the electronic equipment, instructed based on the preservation In the first storage location information, read the data in the first storage location described in the electronic equipment.
6. method described in -5 any one according to claim 1, which is characterized in that described to store the data read at pre- If the first file of format, comprising:
Based on the local third storage location information saved in instruction, by the data read with the first file of preset format Store the third storage location.
7. a kind of device for the firmware code for obtaining electronic equipment, which is characterized in that described device includes:
Read module is read for calling the debugging interface of the electronic equipment and connecting the in-circuit debugger of the electronic equipment Take the data in the electronic equipment in the first storage location, wherein the data include the firmware code of the electronic equipment Corresponding compiling data;
Memory module, for the first file by the data read storage at preset format;
Module is cut, for cutting, obtaining to first file when getting the instruction of the cutting to first file To the second file for including the corresponding compiling data of the firmware code;
Decompilation module obtains the electronic equipment for carrying out decompiling processing to the compiling data in second file Firmware code.
8. device according to claim 7, which is characterized in that the read module is used for:
Obtain the object code for reading the data in the electronic equipment in the first storage location;
The debugging interface of the electronic equipment and the in-circuit debugger for connecting the electronic equipment are called, by the target generation Code is loaded into the memory of the electronic equipment;
The data in the electronic equipment in the first storage location are read by the object code.
9. device according to claim 8, which is characterized in that the read module is used for:
It obtains in the memory of the electronic equipment for storing the second storage location information of object code;
It calls the debugging interface of the electronic equipment and connects the in-circuit debugger of the electronic equipment, the object code is added The second storage location being downloaded in the memory of the electronic equipment.
10. device according to claim 7, which is characterized in that the read module is used for:
It obtains and saves instruction;
It calls the debugging interface of the electronic equipment and connects the in-circuit debugger of the electronic equipment, referred to based on the preservation It enables, reads the data in the electronic equipment in the first storage location.
11. device according to claim 10, which is characterized in that believe in the preservation instruction comprising the first storage location Breath, the read module are used for:
It calls the debugging interface of the electronic equipment and connects the in-circuit debugger of the electronic equipment, instructed based on the preservation In the first storage location information, read the data in the first storage location described in the electronic equipment.
12. according to device described in claim 7-11 any one, which is characterized in that the memory module is used for:
Based on the local third storage location information saved in instruction, by the data read with the first file of preset format Store the third storage location.
13. a kind of terminal, which is characterized in that the terminal includes processor and memory, is stored at least in the memory One instruction, at least one section of program, code set or instruction set, at least one instruction, at least one section of program, the generation Code collection or instruction set are loaded by the processor and are executed to realize the acquisition electronic equipment as described in claim 1 to 6 is any Firmware code method.
14. a kind of computer readable storage medium, which is characterized in that be stored at least one instruction, extremely in the storage medium Few one section of program, code set or instruction set, at least one instruction, at least one section of program, the code set or the instruction The side that collection is loaded by processor and executed to realize the firmware code of the acquisition electronic equipment as described in claim 1 to 6 is any Method.
CN201710392482.3A 2017-05-27 2017-05-27 Method and device for acquiring firmware code of electronic equipment Active CN109240902B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710392482.3A CN109240902B (en) 2017-05-27 2017-05-27 Method and device for acquiring firmware code of electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710392482.3A CN109240902B (en) 2017-05-27 2017-05-27 Method and device for acquiring firmware code of electronic equipment

Publications (2)

Publication Number Publication Date
CN109240902A true CN109240902A (en) 2019-01-18
CN109240902B CN109240902B (en) 2021-03-19

Family

ID=65082608

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710392482.3A Active CN109240902B (en) 2017-05-27 2017-05-27 Method and device for acquiring firmware code of electronic equipment

Country Status (1)

Country Link
CN (1) CN109240902B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110515842A (en) * 2019-08-09 2019-11-29 苏州浪潮智能科技有限公司 A kind of program debugging method, device and electronic equipment and storage medium
CN110798356A (en) * 2019-11-04 2020-02-14 腾讯科技(深圳)有限公司 Firmware monitoring method and device, storage medium and computer equipment
CN111198832A (en) * 2020-01-02 2020-05-26 联想(北京)有限公司 Processing method and electronic equipment
CN112732321A (en) * 2021-01-21 2021-04-30 恒为科技(上海)股份有限公司 Firmware modification method and device, computer readable storage medium and equipment
CN113377370A (en) * 2021-05-18 2021-09-10 龙芯中科(西安)科技有限公司 File processing method and device, electronic equipment and storage medium

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2320680A1 (en) * 2000-09-28 2002-03-28 Myrddin Technologies Consulting Ltd. Electronic medical record storage compact disc
CN1564136A (en) * 2004-04-02 2005-01-12 清华大学 Realizing method of cross regulator based on EJTAG components of targeting machine
CN201435083Y (en) * 2009-05-08 2010-03-31 四川赛狄信息技术有限公司 Privacy device for microprocessor and program thereof
CN102117243A (en) * 2010-12-29 2011-07-06 杭州晟元芯片技术有限公司 Method for high efficiently debugging by using software breakpoint in Flash memory
CN102193556A (en) * 2011-04-18 2011-09-21 华东师范大学 System and method for detecting potential interruption safety hazard of automobile electron device
CN103176904A (en) * 2013-03-29 2013-06-26 北京经纬恒润科技有限公司 Simulation testing platform software architecture and testing method based on same
CN104407975A (en) * 2014-11-29 2015-03-11 蔡杨毅 Seagate repair and firmware handling device and application method thereof
US20150271658A1 (en) * 2014-03-24 2015-09-24 Qualcomm Incorporated Vendor-specific docking management operations
CN105446920A (en) * 2015-12-07 2016-03-30 中国电子科技集团公司第三十二研究所 Loongson-based FPGA embedded computer and configuration method thereof
CN105630678A (en) * 2015-12-22 2016-06-01 国网天津市电力公司 Intelligent ammeter software reliability detector and detection method for intelligent ammeter software reliability
US20170024266A1 (en) * 2015-07-20 2017-01-26 Kabushiki Kaisha Toshiba Memory system, information processing system, and host device
CN106547541A (en) * 2016-10-12 2017-03-29 北京奇虎科技有限公司 The device of the method, device and reinforcing installation kit of statistics application page presentation duration

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2320680A1 (en) * 2000-09-28 2002-03-28 Myrddin Technologies Consulting Ltd. Electronic medical record storage compact disc
CN1564136A (en) * 2004-04-02 2005-01-12 清华大学 Realizing method of cross regulator based on EJTAG components of targeting machine
CN201435083Y (en) * 2009-05-08 2010-03-31 四川赛狄信息技术有限公司 Privacy device for microprocessor and program thereof
CN102117243A (en) * 2010-12-29 2011-07-06 杭州晟元芯片技术有限公司 Method for high efficiently debugging by using software breakpoint in Flash memory
CN102193556A (en) * 2011-04-18 2011-09-21 华东师范大学 System and method for detecting potential interruption safety hazard of automobile electron device
CN103176904A (en) * 2013-03-29 2013-06-26 北京经纬恒润科技有限公司 Simulation testing platform software architecture and testing method based on same
US20150271658A1 (en) * 2014-03-24 2015-09-24 Qualcomm Incorporated Vendor-specific docking management operations
CN104407975A (en) * 2014-11-29 2015-03-11 蔡杨毅 Seagate repair and firmware handling device and application method thereof
US20170024266A1 (en) * 2015-07-20 2017-01-26 Kabushiki Kaisha Toshiba Memory system, information processing system, and host device
CN105446920A (en) * 2015-12-07 2016-03-30 中国电子科技集团公司第三十二研究所 Loongson-based FPGA embedded computer and configuration method thereof
CN105630678A (en) * 2015-12-22 2016-06-01 国网天津市电力公司 Intelligent ammeter software reliability detector and detection method for intelligent ammeter software reliability
CN106547541A (en) * 2016-10-12 2017-03-29 北京奇虎科技有限公司 The device of the method, device and reinforcing installation kit of statistics application page presentation duration

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110515842A (en) * 2019-08-09 2019-11-29 苏州浪潮智能科技有限公司 A kind of program debugging method, device and electronic equipment and storage medium
CN110515842B (en) * 2019-08-09 2022-11-11 苏州浪潮智能科技有限公司 Program debugging method and device, electronic equipment and storage medium
CN110798356A (en) * 2019-11-04 2020-02-14 腾讯科技(深圳)有限公司 Firmware monitoring method and device, storage medium and computer equipment
CN110798356B (en) * 2019-11-04 2021-12-14 腾讯科技(深圳)有限公司 Firmware monitoring method and device, storage medium and computer equipment
CN111198832A (en) * 2020-01-02 2020-05-26 联想(北京)有限公司 Processing method and electronic equipment
CN111198832B (en) * 2020-01-02 2022-09-23 联想(北京)有限公司 Processing method and electronic equipment
CN112732321A (en) * 2021-01-21 2021-04-30 恒为科技(上海)股份有限公司 Firmware modification method and device, computer readable storage medium and equipment
CN112732321B (en) * 2021-01-21 2024-02-09 恒为科技(上海)股份有限公司 Firmware modification method, device, computer readable storage medium and equipment
CN113377370A (en) * 2021-05-18 2021-09-10 龙芯中科(西安)科技有限公司 File processing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN109240902B (en) 2021-03-19

Similar Documents

Publication Publication Date Title
CN108415739B (en) Hook method and device for dynamic link library function and storage medium
CN105320598B (en) Method for testing software and device
CN109240902A (en) A kind of method and apparatus for the firmware code obtaining electronic equipment
CN109753276B (en) Control method based on illusion engine and related device
CN105490919B (en) Message cancelling method and device
CN107943683B (en) Test script generation method and device, electronic equipment and storage medium
CN106502906B (en) A kind of method and apparatus of test application program
CN110032512A (en) A kind of adjustment method of small routine, relevant device and terminal
CN104423822B (en) Record the method and device of automatic test script
CN106126411B (en) The method and apparatus that a kind of pair of tested program code is tested
CN104077211B (en) A kind of test method and test system of mobile terminal software
CN106713608B (en) Application function state modification method and device and terminal
CN104298587A (en) Code coverage test method, device and system
CN105740145B (en) The method and device of element in orient control
CN105530239B (en) Multi-medium data acquisition methods and device
CN110058850A (en) A kind of development approach of application, device and storage medium
CN106155717A (en) A kind of method and apparatus that SDK is integrated into third party APK
CN105808043B (en) A kind of setting method and mobile terminal of terminal applies
CN110046497A (en) A kind of function hook implementation method, device and storage medium
CN108052430A (en) Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN106681884B (en) A kind of monitoring method and device of system calling
CN110413639A (en) Data check method and device, electronic equipment and computer readable storage medium
CN105005529B (en) A kind of method and device that application program is tested
CN104978237B (en) The method and apparatus for repairing dynamic link library file
CN106407800A (en) A hook method and a terminal device

Legal Events

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