CN113805927A - Code updating method and device, electronic equipment and computer storage medium - Google Patents

Code updating method and device, electronic equipment and computer storage medium Download PDF

Info

Publication number
CN113805927A
CN113805927A CN202010528382.0A CN202010528382A CN113805927A CN 113805927 A CN113805927 A CN 113805927A CN 202010528382 A CN202010528382 A CN 202010528382A CN 113805927 A CN113805927 A CN 113805927A
Authority
CN
China
Prior art keywords
code data
target
data
information
code
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.)
Pending
Application number
CN202010528382.0A
Other languages
Chinese (zh)
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.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software 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 China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202010528382.0A priority Critical patent/CN113805927A/en
Publication of CN113805927A publication Critical patent/CN113805927A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • G06F11/0754Error or fault detection not based on redundancy by exceeding limits
    • G06F11/0757Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a code updating method, which is applied to first equipment and comprises the following steps: determining the longest common subsequence of the first code data and the second code data; determining target update information for the first code data based on the longest common subsequence; and sending the target updating information to the second equipment so as to update the second code data in the second equipment based on the target updating information through the second equipment. According to the technical scheme, the first code data and the second code data can be analyzed on the first equipment side according to the content, then the code data needing to be updated is sent to the second equipment in an incremental updating mode, and the second equipment updates the codes of the second equipment according to the received target updating information.

Description

Code updating method and device, electronic equipment and computer storage medium
Technical Field
The present application relates to the field of communications, and in particular, to a code updating method and apparatus, an electronic device, and a computer storage medium.
Background
At present, researchers at home and abroad mainly conduct remote updating research on embedded terminal software from two directions, namely cloud distribution of an updating program image and local guidance of an embedded terminal. From the aspect of cloud distribution of the image of the update program, the terminal program update technology can generally update the terminal program in an overall update mode. However, when the terminal program is updated in an overall updating manner, a complete new program image needs to be transmitted in a wireless network manner to replace an old image.
The remote code updating in the market at present mainly adopts the following wireless updating modes: the Zigbee protocol (namely zigbee) network is used for realizing remote node updating, but zigbee can only realize the internal data communication of the ad hoc network and is easily influenced by the external environment; flash (Flash) update using General Packet Radio Service (GPRS) network, but GPRS communication module has large power consumption and limited signal penetration capability. Taking narrowband Internet of Things (NB-IoT, Narrow Band Internet of Things), along with popularization of Internet of Things terminals, a traditional updating mode of a field burning chip cannot meet the current requirement for updating terminal codes, and a wireless updating mode is more suitable for application scenarios of numerous, widely distributed and unattended terminals of the current Internet of Things. Client/Server (C/S) architecture is adopted in most Internet of things updating systems at home and abroad, a Server side is responsible for managing and releasing updating codes, and a specific hardware platform of a Client side is responsible for receiving, storing and updating the updating codes.
In the narrowband internet of things system, after the internet of things equipment is deployed on a large scale, a plurality of equipment maintenance modes of the internet of things terminal deployed in a complex environment are difficult, the maintenance cost is high, a large amount of manpower and financial resources need to be consumed, the actual requirements are not met, and for the design and implementation of the NB-IoT intelligent terminal remote updating system, a solution can be provided for solving the problems of maintenance and updating of a large number of widely distributed internet of things equipment. The NB-IoT transmission technology has the advantages of large connection, wide coverage, deep penetration, low cost, low power consumption and the like, but as the NB-IoT is used as a new generation transmission technology, the NB-IoT has the characteristics of high software and hardware development complexity, high development cost and the like. Hardware platforms used in different NB-IoT terminal software remote automatic updating systems are different, so that compatibility and portability of software and hardware of the terminal between different updating systems are poor.
In summary, the existing NB-IoT terminal software remote automatic update has poor reusability and portability, is difficult to develop when an update function is migrated between different hardware platforms, has a long development period, occupies a large network overhead when a terminal program is updated, has a slow update speed for the terminal program, and affects processing processes of a cloud and other services of a terminal.
Disclosure of Invention
In order to solve the technical problem, the application provides a code updating method, a code updating device, an electronic device and a computer-readable storage medium.
The code updating method provided by the application is applied to first equipment, and comprises the following steps:
determining the longest common subsequence of the first code data and the second code data;
determining target update information for the first code data based on the longest common subsequence;
and sending the target updating information to the second equipment so as to update the second code data in the second equipment based on the target updating information through the second equipment.
In an optional embodiment of this application, the determining target update information of the first code data based on the longest common subsequence includes:
determining first target update information and second target update information in the first code data based on the longest common subsequence; the first target update information is used for determining code data which needs to be updated in the second code data, and the second target update information is used for determining code data which does not need to be updated in the second code data.
In an optional embodiment of the present application, the determining the first target update information and the second target update information in the first code data based on the longest common subsequence includes:
determining first object code data and second object code data in the first code data based on the position of the longest common subsequence in the first code data; the first target code data is code data which does not need to be updated in the second code data, and the second target code data is code data which needs to be updated in the second code data;
determining the first target update information based on the first target code data and the second target update information based on the second target code data.
In an optional embodiment of the present application, the determining the first target update information based on the first target code data and the determining the second target update information based on the second target code data includes:
determining the first target update information based on source address information, target address information, data length information, and first identification information of the first target code data; wherein the first identification information is used for representing that the first target code data is code data which does not need to be updated in the second code data;
determining the second target update information based on target address information, data length information, data information, and second identification information of the second target code data; the second identification information is used for representing that the second target code data is the code data which needs to be updated in the second code data.
In an optional embodiment of the present application, the determining the longest common subsequence of the first code data and the second code data comprises:
determining first linked list data of the first code data based on the first code data and determining second linked list data of the second code data based on the second code data;
determining the longest common subsequence of the first code data and the second code data based on the first linked list data and the second linked list data.
In an optional embodiment of the present application, the determining the first linked list data of the first code data based on the first code data and the determining the second linked list data of the second code data based on the second code data includes:
extracting first target data in the first code data, and obtaining the first linked list data based on the first target data; the first target data is one or more lines of code data of the first code data that satisfy a target data type;
extracting second target data in the second code data, and obtaining second linked list data based on the second target data; the second target data is one or more lines of code data of the second code data that satisfy the target data type.
The application also provides a code updating method applied to the second equipment, and the method comprises the following steps:
receiving target update information transmitted by a first device, the target update information being determined based on the first code data and the longest common subsequence of the second code data;
updating the second code data based on the target update information.
In an optional embodiment of the present application, the target update information includes first target update information and second target update information; the first target update information is used for determining code data which needs to be updated in the second code data, and the second target update information is used for determining code data which does not need to be updated in the second code data.
In an optional embodiment of the present application, the first code data comprises first object code data and second object code data;
the first target update information includes source address information, target address information, data length information, and first identification information of the first target code data; wherein the first identification information is used for representing that the first target code data is code data which does not need to be updated in the second code data;
the second target update information includes target address information, data length information, data information, and second identification information of the second target code data; the second identification information is used for representing that the second target code data is the code data which needs to be updated in the second code data.
In an optional embodiment of the present application, the updating the second code data based on the target update information includes:
determining code data that does not need to be updated in the second code data as the first target code data based on the first target update information; and the number of the first and second groups,
and determining code data needing to be updated in the second code data as the second target code data based on the second target updating information, and updating the second code data based on source address information, target address information and data information of the second target code data.
The present application further provides a code updating apparatus applied to a first device, the apparatus including:
a first determining unit for determining the first code data and the longest common subsequence of the second code data;
a second determining unit for determining target update information of the first code data based on the longest common subsequence;
a sending unit, configured to send the target update information to a second device, so as to update, by the second device, second code data in the second device based on the target update information.
In an optional embodiment of the present application, the second determining unit is specifically configured to: determining first target update information and second target update information in the first code data based on the longest common subsequence; the first target update information is used for determining code data which needs to be updated in the second code data, and the second target update information is used for determining code data which does not need to be updated in the second code data.
In an optional embodiment of the present application, the second determining unit is further specifically configured to: determining first object code data and second object code data in the first code data based on the position of the longest common subsequence in the first code data; the first target code data is code data which does not need to be updated in the second code data, and the second target code data is code data which needs to be updated in the second code data; determining the first target update information based on the first target code data and the second target update information based on the second target code data.
In an optional embodiment of the present application, the second determining unit is further specifically configured to: determining the first target update information based on source address information, target address information, data length information, and first identification information of the first target code data; wherein the first identification information is used for representing that the first target code data is code data which does not need to be updated in the second code data;
determining the second target update information based on target address information, data length information, data information, and second identification information of the second target code data; the second identification information is used for representing that the second target code data is the code data which needs to be updated in the second code data.
In an optional embodiment of the present application, the first determining unit is specifically configured to: determining first linked list data of the first code data based on the first code data and determining second linked list data of the second code data based on the second code data;
determining the longest common subsequence of the first code data and the second code data based on the first linked list data and the second linked list data.
In an optional embodiment of the present application, the first determining unit is further specifically configured to: extracting first target data in the first code data, and obtaining the first linked list data based on the first target data; the first target data is one or more lines of code data of the first code data that satisfy a target data type;
extracting second target data in the second code data, and obtaining second linked list data based on the second target data; the second target data is one or more lines of code data of the second code data that satisfy the target data type.
The present application further provides a code updating apparatus applied to a second device, the apparatus including:
a receiving unit for receiving target update information transmitted by a first device, the target update information being determined based on the first code data and the longest common subsequence of the second code data;
an updating unit configured to update the second code data based on the target update information.
In an optional embodiment of the present application, the target update information includes first target update information and second target update information; the first target update information is used for determining code data which needs to be updated in the second code data, and the second target update information is used for determining code data which does not need to be updated in the second code data.
In an optional embodiment of the present application, the first code data comprises first object code data and second object code data;
the first target update information includes source address information, target address information, data length information, and first identification information of the first target code data; wherein the first identification information is used for representing that the first target code data is code data which does not need to be updated in the second code data;
the second target update information includes target address information, data length information, data information, and second identification information of the second target code data; the second identification information is used for representing that the second target code data is the code data which needs to be updated in the second code data.
In an optional embodiment of the present application, the updating unit is specifically configured to: determining code data that does not need to be updated in the second code data as the first target code data based on the first target update information; and determining code data needing to be updated in the second code data as the second target code data based on the second target updating information, and updating the second code data based on source address information, target address information and data information of the second target code data.
The application provides an electronic device, including: the data transmission system comprises a processor and a memory, wherein the memory is used for storing a computer program, and the processor is used for calling and running the computer program stored in the memory to execute the data transmission method.
The present application provides a computer-readable storage medium for storing a computer program that causes a computer to execute the above-described data transmission method.
One or more technical solutions of the present application at least have one or more of the following technical effects:
1. according to the code updating method and device, the longest common subsequence of the first code data and the second code data is determined; determining target update information for the first code data based on the longest common subsequence; and sending the target updating information to the second equipment so as to update the second code data in the second equipment based on the target updating information through the second equipment. In the whole code updating process, an incremental updating mode is adopted, and when the first equipment transmits the code data to the second equipment, only the code data generating the updating part needs to be transmitted without transmitting a complete updating program, so that the network transmission overhead can be effectively saved, the updating time is shortened, and the network security is stronger. When updating the second code data, the second device only needs to update the part of the second target code data needing to be updated based on the received target updating information.
2. According to the code updating method and device, the first target updating information and the second target updating information in the first code data are determined based on the longest common subsequence; the first target update information is used for determining code data which needs to be updated in the second code data, and the second target update information is used for determining code data which does not need to be updated in the second code data. Based on this, code data that needs to be updated and code data that does not need to be updated in the second code data can be determined based on the longest common subsequence.
3. According to the code updating method and device, based on the position of the longest common subsequence in the first code data, first target code data and second target code data in the first code data are determined; the first target code data is code data which does not need to be updated in the second code data, and the second target code data is code data which needs to be updated in the second code data; determining the first target update information based on the first target code data and the second target update information based on the second target code data. Based on this, after code data which needs to be updated and code data which does not need to be updated in the second code data are further determined based on the position and the length of the longest common subsequence in the first code data, the code data which needs to be updated can be packaged into the second target update information, and the code data which does not need to be updated can be packaged into the first target update information.
4. According to the code updating method and device, the first target updating information is determined based on the source address information, the target address information, the data length information and the first identification information of the first target code data; wherein the first identification information is used for representing that the first target code data is code data which does not need to be updated in the second code data; determining the second target update information based on target address information, data length information, data information, and second identification information of the second target code data; the second identification information is used for representing that the second target code data is the code data which needs to be updated in the second code data. Based on the method, the source address, the target address, the data length information and the identification information of the code data which do not need to be updated can be packaged into a copy frame; and encapsulating target address information, data length information, data information and identification information of the code data to be updated, wherein the encapsulation is called an insertion frame.
5. According to the code updating method and device, the first linked list data of the first code data are determined based on the first code data, and the second linked list data of the second code data are determined based on the second code data; determining the longest common subsequence of the first code data and the second code data based on the first linked list data and the second linked list data. Based on the above, the first code data and the second code data can be respectively expressed in the form of linked lists, so that the parts of the two linked lists which are the same are determined by further utilizing the method of the longest common subsequence based on the linked list formed by the first code data and the linked list determined based on the second code data.
6. According to the code updating method and device, first target data in the first code data are extracted, and the first linked list data are obtained based on the first target data; the first target data is one or more lines of code data of the first code data that satisfy a target data type; extracting second target data in the second code data, and obtaining second linked list data based on the second target data; the second target data is one or more lines of code data of the second code data that satisfy the target data type. Based on the method, code data meeting a certain type can be extracted from the first code data to form first linked list data, and code data meeting the certain type can be extracted from the second code data to form second linked list data.
Drawings
FIG. 1 is an overall architecture diagram of an IOT system;
FIG. 2 is a circuit diagram of the ME3616 module;
FIG. 3 is a schematic diagram of code data interaction in a process of implementing a code updating method according to an embodiment of the present application;
fig. 4 is a first flowchart illustrating a code updating method according to an embodiment of the present application;
FIG. 5 is a flowchart of extracting valid data from Hex machine code data according to an embodiment of the present application;
FIG. 6 is a diagram of an algorithm matrix and a backtracking for determining LCS for sequences X and Y;
fig. 7 is a second flowchart illustrating a code updating method according to an embodiment of the present application;
fig. 8 is a flowchart of a second device performing code update according to an embodiment of the present application;
FIG. 9 is an NB-IoT smart water meter system architecture;
fig. 10 is a first schematic structural diagram of a code updating apparatus according to an embodiment of the present disclosure;
fig. 11 is a schematic structural diagram of a code updating apparatus according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of a chip according to an embodiment of the present application.
Detailed Description
So that the manner in which the features and aspects of the present application can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings.
The method and the system for remotely updating the intelligent terminal are characterized by firstly providing a set of stable, reliable, reusable and portable NB-IoT intelligent terminal remote updating system and providing a system architecture for automatically updating the terminal code in the NB-IoT system.
Fig. 1 is an overall architecture diagram of an internet of things system, and as shown in fig. 1, an NB-IoT internet of things intelligent terminal remote updating system mainly comprises 3 parts, namely an internet of things intelligent terminal, an NB-IoT relay station and a human-computer interaction terminal:
1. internet of things intelligent terminal. The intelligent terminal of the internet of things takes a microcontroller as a core, integrates an Embedded Subscriber identity Module (eSIM) communication Module, and has basic functions of data acquisition, simple operation, control and the like.
The design of the Internet of things intelligent terminal of the NB-IoT intelligent terminal remote updating system mainly comprises two parts, namely hardware design and software design.
The software and hardware design of the intelligent terminal is very important for the whole remote updating system, because the terminal devices have various forms, such as NB-IoT intelligent meter reading (for example, intelligent gas meters, water meters and electric meters), NB-IoT intelligent cities (for example, street lamps, parking and garbage bin management), NB-IoT intelligent agriculture and the like, and the functions of the terminal devices are different, a set of unified terminal architecture needs to be uniformly designed, and the software and hardware design and the implementation of an updating mechanism are specifically included. The intelligent device hardware is generally composed of a main control chip and an external communication module, in order to improve the reusability and the portability of the NB-IoT intelligent terminal, K64 of Enzhipu company is selected for use, the number of chip peripheral interfaces is large, the calculation main frequency can reach 112 megahertz (MHz), and the requirement for updating code data is fully met. The communication module selects ME3616 based on an NB-IoT communication protocol, a circuit diagram of the ME3616 module is shown in FIG. 2, the ME3616 module is small in size, low in power consumption and capable of integrating and positioning a chip and meeting most of workplaces, a chip integrated hardware minimum system comprises a power supply circuit, a filter circuit, a crystal oscillator circuit and a writer circuit, and the chip integrated hardware minimum system can operate and provide basic operation functions under the condition that all the circuits complete basic functions without errors. The communication module adopts a ready-made module, and the designed peripheral circuit comprises an antenna, an eSIM card circuit and a Universal Asynchronous Receiver Transmitter/Transmitter (UART) serial port communication circuit.
The software of the terminal is one of the cores of the whole remote updating system. The design of the terminal software mainly includes a Basic Input Output System (BIOS) of a kernel program, a User program (i.e., a User program) design and a code update mechanism design. The functions mainly completed by the BIOS program are as follows: (1) the system clock is initialized. The chip is powered on and started, firstly, a BIOS is operated, system clock initialization is carried out, and a determined kernel clock and a bus clock are given; (2) starting a timer; (3) giving a bottom layer drive calling mode; (4) providing remote updating User program function; (5) other functions. After the BIOS program is started, a software and hardware environment is prepared for the execution of a User program in the terminal, and the software and hardware environment comprises the functions of starting a watchdog, judging the User program, jumping to the User program and the like. The design of the software of the terminal of the NB-IoT internet-of-things intelligent terminal remote update system specifically includes 4 parts, such as the design of a link file, the design of an operating system, the design of components, and the design of an update function, and is specifically described as follows:
1) link file modification
The User program in the terminal program is a real User programming program, and the specific functions of the program are determined according to the actual project requirements. Common functions of a User program in an internet of things project comprise acquisition and storage of sensor data, connection and data transmission of a remote network, operation of a hardware execution mechanism and the like. Under the architecture of the NB-IoT remote update system, the User program may call an Application Programming Interface (API) residing in the BIOS to implement most functions. All operations of interacting with the bottom hardware and remote code updating are solidified in the BIOS program, and the User program can focus on the development and implementation of application layer software.
In order to realize the sharing of the interrupt service routine between the BIOS and the User program, the NB-IoT intelligent terminal remote updating system opens up an interrupt _ RAM segment at the initial position of a Random Access Memory (RAM) in the BIOS program, wherein the segment occupies 1KB of space size and is used for storing interrupt vector area data in the BIOS program Flash. The BIOS program opens up section operation, can be realized by modifying the link file, and the specific implementation code is as follows:
Figure BDA0002534357700000111
after the main control chip is powered on, the data in the interrupt vector table area in the BIOS program is copied to the interrupt _ ram section, and the initial address register SCB- > VTOR of the interrupt vector table is modified to be the initial address of the interrupt _ ram section, so that the interrupt service routine sharing of the BIOS and the User program is realized. Meanwhile, the BIOS program provides an interface function setVector for modifying the specified interrupt service for the User program, and the User program can use the function to dynamically load the interrupt service routine of the User program.
The above describes how the BIOS and User programs share interrupt service routines, including SVC interrupt service routines. The User program only needs to actively trigger the interrupt of a management program Call (SVC) and then reads the value in the register r0 to obtain the address of the API function interface table provided by the BIOS program. The User program actively triggers an SVC interrupt function SVC1_ init as follows, an assembly statement "SVC 1" can trigger SVC interrupt, r0 is used as an output register to store an API function interface table address, and the implementation codes are as follows:
Figure BDA0002534357700000121
2) the operating system part:
a Real Time Operating System (RTOS) refers to an embedded Operating System with high Real-Time performance, which can complete a specific System function or interrupt response within a short determined Time, and is mainly used for embedded systems with high Real-Time requirements on response Time, such as internet of things terminals, industrial control devices, military devices, aerospace and other fields. The application resides in a mbedOS real-time operating system in a BIOS program, the operation of the mbedOS depends on a system beat timer (namely Systick), SVC and suspensible abnormal (namely PendSV) interruption, and the realization of the BIOS to an external drive component API also depends on SVC interruption, so that the mutual interference between two SVC interruptions is avoided when the User program starts the mbedOS, the application adopts SVC interruption dynamic loading to realize the function of providing an external function interface function and a kernel function scheduling function of the operating system at the same time, and specific codes are realized as follows:
setVector(SVCall_IRQn,(uint_32)&SVC_IRQ);
v/redirect SVC interruption, facilitating User to obtain function interface API
projectJump(USERBASE);
// jump User program
And if the User program executes the starting of the mbedOS, reloading the SVC interrupt into the SVC _ Handler. The BIOS program packages the starting operation of the mbedOS into a function OS _ start, the function is reloaded with SVC interruption and realizes the starting of the mbedOS, and specific implementation codes are as follows:
Figure BDA0002534357700000131
3) component design
The components mainly comprise a driving component and an application component, the driving component at the bottom layer comprises an Analog-to-Digital Converter (ADC), Flash, General-purpose input/output (GPIO), an I2C bus, UART and the like, and a hardware direct interaction channel, Software Development Kits (SDK) of many manufacturers provide basic API interface programs, and the Software Development kits are only simply packaged and are suitable for our systems. The application component needs to complete U _ com and U _ update. The U _ com component is a communication bridge between a Micro Control Unit (MCU) and a communication module, and encapsulates a strip of discrete AT (namely, attention) instructions into a driving function with an independent function by using a UART as a basic component, so as to implement data communication between the main control chip and the communication module, thereby implementing functions such as networking and data remote transmission of the terminal. From a functional perspective, the U _ com component provides initialization, data transmission, and data reception functions. In addition, the U _ com component also provides other interface functions that are more commonly used, such as: switching on and off a power supply function of a communication module, acquiring a base station information function, acquiring a module information function and the like.
U _ update is a functional component for implementing remote update of terminal software. After the terminal acquires the update frame data by using the U _ com component, the U _ update component performs operations such as update copy, insertion, verification and the like by using the basic component Flash. The U-update component provides functions such as initialization, receiving update data, returning update data, data frame checking, etc. All the coefficients related to hardware are used as function parameters, so that the component can be conveniently transplanted among different chips. The U _ update component realizes internal packaging of the component for operations such as Flash copying and inserting, application layer software does not need to know specific Flash operations, and development difficulty can be reduced.
4) Updating functional designs
The updating function mainly comprises 2 parts, the first part is terminal networking, the first part is a communication component U _ com designed before, and the detailed process is not repeated; the second part is a remote updating operation process, after the terminal is networked, updating data is realized in the serial port interruption of the U _ com, once the terminal receives a complete frame of updating data, the corresponding operation is switched to according to the difference of frame identifications, and after all data are received, updating codes are covered and new codes are switched to operate.
2. An NB-IoT relay station. The NB-IoT relay station is an information transfer system based on an NB-IoT protocol, and consists of an NB-IoT base station and a cloud server, and plays a role in transferring data.
Generally used by NB-IoT relay stations are operator-provided environments and corresponding communication modules.
3. And (5) a man-machine interaction terminal. The man-machine interaction terminal can be a webpage, an APP (application), a WeChat applet and the like, and is mainly used for acquiring remote terminal information or transmitting information to the remote terminal to achieve the control purpose.
The man-machine interaction terminal needs to do work for analyzing and extracting effective data in the code data, monitoring a designated port to realize data interaction with the terminal and realizing an incremental updating mechanism of the code data.
Various embodiments of the code updating method of the present application are described and implemented based on the above NB-IoT internet of things remote updating system.
Fig. 3 is a schematic diagram of code data interaction in a process of implementing a code updating method according to an embodiment of the present application, and as shown in fig. 3, in the embodiment of the present application, differential data between new code data and old code data (i.e., a new version User and an old version User) is acquired at a server, the differential data is transmitted to a terminal device, and the terminal device determines the new version User according to the received differential data between the new version User and the old version User, so as to finally implement updating of a terminal code. Here, the server is a first device belonging to the embodiment of the present application, the terminal UE is a second device of the embodiment of the present application, the new version of User is first code data of the embodiment of the present application, and the old version of User is second code data of the embodiment of the present application.
Fig. 4 is a first flowchart of a code updating method provided in the embodiment of the present application, and as shown in fig. 4, the method is applied to a first device, and includes the following steps:
step 401: the first code data and the longest common subsequence of second code data are determined.
Here, the first code data is a new version of the User program, and the second code data is an old version of the User program, and as a preferred implementation, the first code data in the embodiment of the present application may be Hex (i.e. hexadecimal) machine code data of the new version of the User program, and the second code data may be Hex machine code data of the old version of the User program.
In an optional embodiment of the present application, the determining the longest common subsequence of the first code data and the second code data comprises:
determining first linked list data of the first code data based on the first code data and determining second linked list data of the second code data based on the second code data;
determining the longest common subsequence of the first code data and the second code data based on the first linked list data and the second linked list data.
As a specific implementation, the determining the first linked list data of the first code data based on the first code data and the determining the second linked list data of the second code data based on the second code data includes:
extracting first target data in the first code data, and obtaining the first linked list data based on the first target data; the first target data is one or more lines of code data of the first code data that satisfy a target data type;
extracting second target data in the second code data, and obtaining second linked list data based on the second target data; the second target data is one or more lines of code data of the second code data that satisfy the target data type.
Specifically, the first device may be a server or a human-computer interaction terminal. In the embodiment of the application, the Hex machine code program of the new version User program and the Hex machine code data of the old version User program are introduced into the first device side, and the Hex machine code data of the new version User program and the effective data in the Hex machine code data of the old version User program are respectively extracted, fig. 5 is a flow chart for extracting the effective data in the Hex machine code data provided by the embodiment of the application, according to the flow chart shown in fig. 5, the Hex machine code effective data of the new version User program and the effective data in the Hex machine code data of the old version User program can be respectively extracted, and then a row record chain table of the Hex machine code effective data of the new version User program and a row record chain table of the Hex machine code effective data of the old version User program are constructed.
It should be noted that, in the Hex machine code data of each line in fig. 5, the record type "00" represents data to be recorded, the record type "02" represents address of the identification extension segment, and the record type "03" represents start segment recording. By extracting effective data in the Hex machine code data according to the set recording type, the address information of the Hex machine code effective data can be simultaneously stored in the row recording linked list of the Hex machine code effective data. When the Hex data record linked list is constructed in the embodiment of the application, the Hex data line takes the structural body as a storage form, and the contents of the line number, the offset information, the effective data and the like recorded in each line of the Hex data are recorded in the structural body.
And further determining the longest common subsequence of the effective data of the Hex machine code of the new version of User program and the effective data of the Hex machine code of the old version of User program based on the row record linked list of the effective data of the Hex machine code of the new version of User program and the row record linked list of the effective data of the Hex machine code of the old version of User program.
The longest common subsequence of the Hex machine code valid data of the new version of User program and the Hex machine code valid data of the old version of User program is determined, and the longest common subsequence is mainly used for comparing the difference between the Hex machine code valid data of the new version of User program and the Hex machine code valid data of the old version of User program, so that a part of the Hex machine code valid data of the new version of User program which is updated relative to the Hex machine code valid data of the old version of User program is determined, and a data base is provided for the first device to send the differential data of the first code data and the second code data to the second device.
Here, the Longest Common Subsequence (LCS) refers to the same Longest-order substring of two sequences, which is not required to be consecutive in the original sequence, but must be sequentially arranged in the original order.
Provided with the sequence X ═ X1,x2,x3...xm},Y={y1,y2,y3...yn}。X={x1,x2,x3...xmIs the first i character set of the sequence X (1 ≦ i ≦ m), Y ≦ Y1,y2,y3...ynJ is the first j character set (1 ≦ j ≦ n) of sequence Y, LCS (X)i,Yj) Is a prefix XiAnd prefix YjC [ i, j ] is the set of longest common subsequences]Is a prefix XiAnd prefix YjThe longest common subsequence length.
(1) If xm=ynI.e. the last element of the sequences X and Y is identical, then LCS (X)m,Yn) Can be composed of the sequence Xm-1And Yn-1With xmOr ynThe formula is obtained as follows:
LCS(Xm,Yn)=LCS(Xm-1,Yn-1)∧xm (1)
C[m,n]=C[m-1,n-1]+1 (2)
(2) if xm≠ynI.e. the last element of the sequences X and Y is different, then LCS (X)m,Yn) Can be composed of the sequence Xm-1And YnOr sequence XmAnd Yn-1More common subsequences are obtained, and the formula is as follows:
LCS(Xm,Yn)=max{LCS(Xm,Yn-1),LCS(Xm-1,Yn)} (3)
C[m,n]=max{C[m,n-1],C[m-1,n]} (4)
from the above, it can be analyzed that the LCS problem has the optimal substructure characteristics, and can be solved by dynamic programming. The recurrence of the LCS problem is as follows:
Figure BDA0002534357700000171
Figure BDA0002534357700000172
taking the sequence X ═ { a, B, C, D, B, C, a }, and Y ═ B, a, C, B, D, a } as an example, the longest common subsequence of sequences X, Y is constructed. The two-dimensional array C can be obtained by equations (1) to (6), and the longest common subsequence of sequences X and Y can be obtained as LCS (X, Y) ═ a, B, D, a } through backward tracing. Fig. 6 is an algorithm matrix and a backtracking diagram for determining LCS for sequences X and Y.
In the embodiment of the application, by the method for determining the LCS, the longest common subsequence of the Hex machine code valid data of the new version of User program and the longest common subsequence of the Hex machine code valid data of the old version of User program can be determined, which is equivalent to determining the longest common subsequence of the first code data and the second code data.
Step 402: determining target update information for the first code data based on the longest common subsequence.
In an optional embodiment of this application, the determining target update information of the first code data based on the longest common subsequence includes:
determining first target update information and second target update information in the first code data based on the longest common subsequence; the first target update information is used for determining code data which needs to be updated in the second code data, and the second target update information is used for determining code data which does not need to be updated in the second code data.
As an embodiment, the determining the first target update information and the second target update information in the first code data based on the longest common subsequence includes:
determining first object code data and second object code data in the first code data based on the position of the longest common subsequence in the first code data; the first target code data is code data which does not need to be updated in the second code data, and the second target code data is code data which needs to be updated in the second code data;
determining the first target update information based on the first target code data and the second target update information based on the second target code data.
Specifically, the embodiment of the application utilizes the characteristic of the Hex machine code file format, uses one line of record of the Hex file as a basic unit for text comparison, uses the data area information as an element to be compared, and uses other field data as auxiliary information. The effective data in each line of record in the Hex machine code effective data of the new version of User program and the Hex machine code effective data text of the old version of User program are compared in this way, the effective data in each line of record in the Hex line record linked list is used as a basic comparison unit for constructing the longest common subsequence, and the line number of the same effective data in the data area and the line number of different effective data in the data area in the Hex machine code data of the new version of User program and the Hex machine code effective data of the old version of User program are obtained by determining the Hex machine code effective data of the new version of User program and the longest common subsequence of the Hex machine code effective data of the old version of User program according to the line number of the Hex machine code data of the new version of User program and the line number of the same effective data in the Hex machine code data of the old version of User program. And determining program code blocks which need to be changed and do not need to be changed in the Hex machine code effective data of the new version of User program relative to the Hex machine code effective data of the old version of User program. Here, the code block that does not need to be changed is the first target code data, and the code block that needs to be changed is the second target code data.
In an optional embodiment of the present application, the determining the first target update information based on the first target code data and the determining the second target update information based on the second target code data includes:
determining the first target update information based on source address information, target address information, data length information, and first identification information of the first target code data; wherein the first identification information is used for representing that the first target code data is code data which does not need to be updated in the second code data;
determining the second target update information based on target address information, data length information, data information, and second identification information of the second target code data; the second identification information is used for representing that the second target code data is the code data which needs to be updated in the second code data.
Specifically, after determining a program code block which does not need to be changed and needs to be changed in Hex machine code valid data of a new version of User program relative to Hex machine code valid data of an old version of User program, that is, after determining first target code data and second target code data, assembling a source address and a target address of the code data block which does not need to be changed and the length of the code data block which does not need to be changed into an update copy frame, where the update copy frame is first target update information, and the first target update information further includes first identification information for representing that the code data in the first target update information is code data which does not need to be updated; framing the target address, the data length and the effective code data of the code block needing to be changed into an update insertion frame, wherein the update insertion frame is second target update information, and it should be noted that the second target update information further includes second identification information for representing that the code data in the second target information is the code data needing to be updated.
Step 403: and sending the target updating information to the second equipment so as to update the second code data in the second equipment based on the target updating information through the second equipment.
Here, the target update information mainly includes the update insertion frame and the update copy frame determined in step 402, the first device finally sends the update insertion frame and the update copy frame to the second device in a socket network communication manner or other sending manners, and the second device completes updating of its own original code according to the received update insertion frame and update copy frame.
It should be noted that, when the code data of the second device is updated in an overall updating manner, linked list data formed by Hex machine code valid data of a new version of User program can be all framed on the first device side in an updating insertion frame manner; and then, forming an update insertion frame by the Hex machine code effective data of the new version of the User program, and sending the update insertion frame to the second equipment, wherein the second equipment realizes the integral update of the code data of the second equipment.
The technical proposal of the embodiment of the application can store the effective data of the first code data and the second code data in a chain table form according to lines by extracting the effective data of the first code data and the second code data, the longest common subsequence of the first code data and the second code data can be determined by a linked list of valid data of both data, the program code blocks which need not be changed and need to be changed in the valid data of the first code data and the valid data of the second code data can be determined by the longest common subsequence, the program code blocks which need not be changed are framed into an update copy frame, the program code blocks which need to be changed are framed into an update insert frame, and the second equipment completes the incremental updating of the code data of the second equipment according to the received update insertion frame and the update copy frame.
Fig. 7 is a second flowchart illustrating a code updating method according to an embodiment of the present application, and as shown in fig. 7, the method is applied to a second device, and the method includes the following steps:
step 701: receiving target update information transmitted by the first device, the target update information being determined based on the first code data and the longest common subsequence of the second code data.
In an optional embodiment of the present application, the target update information includes first target update information and second target update information; the first target update information is used for determining code data which needs to be updated in the second code data, and the second target update information is used for determining code data which does not need to be updated in the second code data.
In one embodiment, the first code data includes first object code data and second object code data;
the first target update information includes source address information, target address information, data length information, and first identification information of the first target code data; wherein the first identification information is used for representing that the first target code data is code data which does not need to be updated in the second code data;
the second target update information includes target address information, data length information, data information, and second identification information of the second target code data; the second identification information is used for representing that the second target code data is the code data which needs to be updated in the second code data.
Here, the second device may be a terminal device in the internet of things device, the second device stores second code data therein, the source address information may be a Flash source address of the code data in the second device, and the destination address information may be a Flash destination address of the code data in the second device. The data length information is data length information of the code data block.
Step 702: updating the second code data based on the target update information.
In an optional embodiment of the present application, the updating the second code data based on the target update information includes:
determining code data that does not need to be updated in the second code data as the first target code data based on the first target update information; and the number of the first and second groups,
and determining code data needing to be updated in the second code data as the second target code data based on the second target updating information, and updating the second code data based on source address information, target address information and data information of the second target code data.
Specifically, fig. 8 is a flowchart of updating a code by the second device according to the embodiment of the present application. After the second device is networked, updating data is realized in serial port interruption of the U _ com of the second device, and after the second device receives the target updating information, the second device performs corresponding code updating operation by judging the identification information of each data frame in the received target updating information to complete updating of the code data stored in the storage area of the second device. If the identification information of the data frame in the target update message is the first identification information, the code data in the first target update information indicated by the data frame is not updated according to the address information and the data length information indicated by the data frame, and if the identification information of the data frame in the target update message is the second identification information, the code data in the first target update information indicated by the data frame is updated according to the address information, the data length information and the specific code data indicated by the data frame. Here, when the second device finishes receiving all data, the second device performs the overwriting of the updated code and shifts to the new code operation.
In the embodiment of the application, the received update copy frame and the update insert frame are identified through the second device, the copy operation of the codes in the Flash in the second device and the update insert operation of the codes in the Flash in the second device are realized, only part of code data needs to be updated in the second device, the realization process is simple, and less operation memory of the second device is occupied.
According to the technical scheme of the embodiment of the application, the first code data and the effective data of the second code data are analyzed and extracted in the first device, code data interaction with the second device and incremental updating of the code data are finally realized, software updating is completed by transmitting the difference data of new and old codes, network transmission overhead can be effectively saved, updating time is shortened, and a complete updating program does not need to be transmitted when the code data are transmitted, so that the network security is high.
Fig. 9 is an NB-IoT intelligent water meter system architecture, and the code data transmission success rate of the code updating method according to the embodiment of the present application is verified based on the intelligent water meter system architecture. Table 1 is a code data transmission success rate comparison table; in table 1, group 1 represents NB-IoT smart water meters implemented using the aforementioned NB-IoT smart terminal remote update system, and group 2 represents NB-IoT smart water meters implemented without the aforementioned NB-IoT smart terminal remote update system.
Group of Total frame number Number of successes Number of failures Success rate
Group
1 360 351 9 97.5
Group
2 360 347 13 96.4%
TABLE 1
The test results in table 1 show that the success rate of code data transmission of the NB-IoT intelligent water meter is not affected by using the NB-IoT intelligent terminal remote updating system, and the success rate of the NB-IoT intelligent water meter for code data transmission can reach 97%.
Fig. 10 is a schematic structural composition diagram of a code updating apparatus according to an embodiment of the present application, as shown in fig. 10, the apparatus includes:
a first determining unit 1011 for determining the first code data and the longest common subsequence of the second code data;
a second determining unit 1012 for determining target update information of the first code data based on the longest common subsequence;
a transmitting unit 1013 configured to transmit the target update information to the second device to update, by the second device, the second code data in the second device based on the target update information.
In an optional embodiment of the present application, the second determining unit 1012 is specifically configured to: determining first target update information and second target update information in the first code data based on the longest common subsequence; the first target update information is used for determining code data which needs to be updated in the second code data, and the second target update information is used for determining code data which does not need to be updated in the second code data.
In an optional embodiment of the present application, the second determining unit 1012 is further specifically configured to: determining first object code data and second object code data in the first code data based on the position of the longest common subsequence in the first code data; the first target code data is code data which does not need to be updated in the second code data, and the second target code data is code data which needs to be updated in the second code data; determining the first target update information based on the first target code data and the second target update information based on the second target code data.
In an optional embodiment of the present application, the second determining unit 1012 is further specifically configured to: determining the first target update information based on source address information, target address information, data length information, and first identification information of the first target code data; wherein the first identification information is used for representing that the first target code data is code data which does not need to be updated in the second code data;
determining the second target update information based on target address information, data length information, data information, and second identification information of the second target code data; the second identification information is used for representing that the second target code data is the code data which needs to be updated in the second code data.
In an optional embodiment of the present application, the first determining unit 1011 is specifically configured to: determining first linked list data of the first code data based on the first code data and determining second linked list data of the second code data based on the second code data;
determining the longest common subsequence of the first code data and the second code data based on the first linked list data and the second linked list data.
In an optional embodiment of the present application, the first determining unit 1011 is further specifically configured to: extracting first target data in the first code data, and obtaining the first linked list data based on the first target data; the first target data is one or more lines of code data of the first code data that satisfy a target data type;
extracting second target data in the second code data, and obtaining second linked list data based on the second target data; the second target data is one or more lines of code data of the second code data that satisfy the target data type.
Those skilled in the art will understand that the implementation functions of each unit in the code updating apparatus shown in fig. 10 can be understood by referring to the related description of the code updating method. The functions of the units in the code updating apparatus shown in fig. 10 may be implemented by a program running on a processor, or may be implemented by specific logic circuits.
Fig. 11 is a schematic structural composition diagram of a code updating apparatus provided in the embodiment of the present application, and as shown in fig. 11, the apparatus includes:
a receiving unit 1111 configured to receive target update information transmitted by the first device, the target update information being determined based on the first code data and the longest common subsequence of the second code data;
an updating unit 1112 configured to update the second code data based on the target update information.
In an optional embodiment of the present application, the target update information includes first target update information and second target update information; the first target update information is used for determining code data which needs to be updated in the second code data, and the second target update information is used for determining code data which does not need to be updated in the second code data.
In an optional embodiment of the present application, the first code data comprises first object code data and second object code data;
the first target update information includes source address information, target address information, data length information, and first identification information of the first target code data; wherein the first identification information is used for representing that the first target code data is code data which does not need to be updated in the second code data;
the second target update information includes target address information, data length information, data information, and second identification information of the second target code data; the second identification information is used for representing that the second target code data is the code data which needs to be updated in the second code data.
In an optional embodiment of the present application, the updating unit 1112 is specifically configured to: determining code data that does not need to be updated in the second code data as the first target code data based on the first target update information; and determining code data needing to be updated in the second code data as the second target code data based on the second target updating information, and updating the second code data based on source address information, target address information and data information of the second target code data.
Those skilled in the art will understand that the implementation functions of each unit in the code updating apparatus shown in fig. 11 can be understood by referring to the related description of the code updating method. The functions of the units in the code updating apparatus shown in fig. 11 can be realized by a program running on a processor, and can also be realized by a specific logic circuit.
Fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device may be a server, the electronic device includes the data processing apparatus shown in fig. 12, the electronic device 1200 shown in fig. 12 includes a processor 1210, and the processor 1210 may call and execute a computer program from a memory to implement the method in the embodiment of the present application.
Optionally, as shown in fig. 12, the electronic device 1200 may further include a memory 1220. From the memory 1220, the processor 1210 may call and execute a computer program to implement the method in the embodiment of the present application.
The memory 1220 may be a separate device from the processor 1210, or may be integrated into the processor 1210.
Optionally, as shown in fig. 12, the electronic device 1200 may further include a transceiver 1230, and the processor 1210 may control the transceiver 1230 to communicate with other devices, and in particular, may transmit information or data to the other devices or receive information or data transmitted by the other devices.
The transceiver 1230 may include a transmitter and a receiver, among others. The transceiver 1230 may further include an antenna, and the number of antennas may be one or more.
Optionally, the electronic device 1200 may specifically be a network device in the embodiment of the present application, and the electronic device 1200 may implement a corresponding process implemented by the network device in each method in the embodiment of the present application, which is not described herein again for brevity.
Optionally, the electronic device 1200 may specifically be a mobile terminal/terminal device according to this embodiment, and the electronic device 1200 may implement a corresponding process implemented by the mobile terminal/terminal device in each method according to this embodiment, which is not described herein again for brevity.
Fig. 13 is a schematic structural diagram of a chip according to an embodiment of the present application. The chip 1300 shown in fig. 13 includes a processor 1310, and the processor 1310 may call and execute a computer program from a memory to implement the method in the embodiment of the present application.
Optionally, as shown in fig. 13, the chip 1300 may further include a memory 1320. From the memory 1320, the processor 1310 may call and execute a computer program to implement the method of the present embodiment.
The memory 1320 may be a separate device from the processor 1310, or may be integrated into the processor 1310.
Optionally, the chip 1300 may further include an input interface 1330. The processor 1310 may control the input interface 1330 to communicate with other devices or chips, and in particular, may obtain information or data transmitted by other devices or chips.
Optionally, the chip 1300 may further include an output interface 1340. The processor 1310 may control the output interface 1340 to communicate with other devices or chips, and in particular, may output information or data to the other devices or chips.
Optionally, the chip may be applied to the network device in the embodiment of the present application, and the chip may implement the corresponding process implemented by the network device in each method in the embodiment of the present application, and for brevity, details are not described here again.
Optionally, the chip may be applied to the mobile terminal/terminal device in the embodiment of the present application, and the chip may implement the corresponding process implemented by the mobile terminal/terminal device in each method in the embodiment of the present application, and for brevity, no further description is given here.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as a system-on-chip, a system-on-chip or a system-on-chip, etc.
It should be understood that the processor of the embodiments of the present application may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method embodiments may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
It will be appreciated that the memory in the embodiments of the subject application can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of example, but not limitation, many forms of RAM are available, such as Static random access memory (Static RAM, SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic random access memory (DDR SDRAM), Enhanced Synchronous SDRAM (ESDRAM), Synchronous link SDRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memories of the systems and methods described herein are intended to comprise, without being limited to, these and any other suitable types of memory.
It should be understood that the above memories are exemplary but not limiting illustrations, for example, the memories in the embodiments of the present application may also be Static Random Access Memory (SRAM), dynamic random access memory (dynamic RAM, DRAM), Synchronous Dynamic Random Access Memory (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (enhanced SDRAM, ESDRAM), Synchronous Link DRAM (SLDRAM), Direct Rambus RAM (DR RAM), and the like. That is, the memory in the embodiments of the present application is intended to comprise, without being limited to, these and any other suitable types of memory.
The embodiment of the application also provides a computer readable storage medium for storing the computer program.
Optionally, the computer-readable storage medium may be applied to the network device in the embodiment of the present application, and the computer program enables the computer to execute the corresponding process implemented by the network device in each method in the embodiment of the present application, which is not described herein again for brevity.
Optionally, the computer-readable storage medium may be applied to the mobile terminal/terminal device in the embodiment of the present application, and the computer program enables the computer to execute the corresponding process implemented by the mobile terminal/terminal device in each method in the embodiment of the present application, which is not described herein again for brevity.
Embodiments of the present application also provide a computer program product comprising computer program instructions.
Optionally, the computer program product may be applied to the network device in the embodiment of the present application, and the computer program instructions enable the computer to execute corresponding processes implemented by the network device in the methods in the embodiment of the present application, which are not described herein again for brevity.
Optionally, the computer program product may be applied to the mobile terminal/terminal device in the embodiment of the present application, and the computer program instructions enable the computer to execute the corresponding processes implemented by the mobile terminal/terminal device in the methods in the embodiment of the present application, which are not described herein again for brevity.
The embodiment of the application also provides a computer program.
Optionally, the computer program may be applied to the network device in the embodiment of the present application, and when the computer program runs on a computer, the computer is enabled to execute the corresponding process implemented by the network device in each method in the embodiment of the present application, and for brevity, details are not described here again.
Optionally, the computer program may be applied to the mobile terminal/terminal device in the embodiment of the present application, and when the computer program runs on a computer, the computer is enabled to execute the corresponding process implemented by the mobile terminal/terminal device in each method in the embodiment of the present application, which is not described herein again for brevity.
Those of ordinary skill in the art would appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (14)

1. A code updating method applied to a first device, the method comprising:
determining the longest common subsequence of the first code data and the second code data;
determining target update information for the first code data based on the longest common subsequence;
and sending the target updating information to the second equipment so as to update the second code data in the second equipment based on the target updating information through the second equipment.
2. The method of claim 1, wherein determining the target update information for the first code data based on the longest common subsequence comprises:
determining first target update information and second target update information in the first code data based on the longest common subsequence; the first target update information is used for determining code data which needs to be updated in the second code data, and the second target update information is used for determining code data which does not need to be updated in the second code data.
3. The method of claim 2, wherein the determining the first target update information and the second target update information in the first code data based on the longest common subsequence comprises:
determining first object code data and second object code data in the first code data based on the position of the longest common subsequence in the first code data; the first target code data is code data which does not need to be updated in the second code data, and the second target code data is code data which needs to be updated in the second code data;
determining the first target update information based on the first target code data and the second target update information based on the second target code data.
4. The method of claim 3, wherein determining the first target update information based on the first target code data and determining the second target update information based on the second target code data comprises:
determining the first target update information based on source address information, target address information, data length information, and first identification information of the first target code data; wherein the first identification information is used for representing that the first target code data is code data which does not need to be updated in the second code data;
determining the second target update information based on target address information, data length information, data information, and second identification information of the second target code data; the second identification information is used for representing that the second target code data is the code data which needs to be updated in the second code data.
5. The method of any of claims 1-4, wherein determining the longest common subsequence of the first code data and the second code data comprises:
determining first linked list data of the first code data based on the first code data and determining second linked list data of the second code data based on the second code data;
determining the longest common subsequence of the first code data and the second code data based on the first linked list data and the second linked list data.
6. The method of claim 5, wherein determining a first linked list data of the first code data based on the first code data and a second linked list data of the second code data based on the second code data comprises:
extracting first target data in the first code data, and obtaining the first linked list data based on the first target data; the first target data is one or more lines of code data of the first code data that satisfy a target data type;
extracting second target data in the second code data, and obtaining second linked list data based on the second target data; the second target data is one or more lines of code data of the second code data that satisfy the target data type.
7. A code updating method applied to a second device, the method comprising:
receiving target update information transmitted by a first device, the target update information being determined based on the first code data and the longest common subsequence of the second code data;
updating the second code data based on the target update information.
8. The method of claim 7, wherein the target update information comprises first target update information and second target update information; the first target update information is used for determining code data which needs to be updated in the second code data, and the second target update information is used for determining code data which does not need to be updated in the second code data.
9. The method of claim 8, wherein the first code data includes first object code data and second object code data;
the first target update information includes source address information, target address information, data length information, and first identification information of the first target code data; wherein the first identification information is used for representing that the first target code data is code data which does not need to be updated in the second code data;
the second target update information includes target address information, data length information, data information, and second identification information of the second target code data; the second identification information is used for representing that the second target code data is the code data which needs to be updated in the second code data.
10. The method of claim 9, wherein updating the second code data based on the target update information comprises:
determining code data that does not need to be updated in the second code data as the first target code data based on the first target update information; and the number of the first and second groups,
and determining code data needing to be updated in the second code data as the second target code data based on the second target updating information, and updating the second code data based on source address information, target address information and data information of the second target code data.
11. A code update apparatus applied to a first device, the apparatus comprising:
a first determining unit for determining the first code data and the longest common subsequence of the second code data;
a second determining unit for determining target update information of the first code data based on the longest common subsequence;
a sending unit, configured to send the target update information to a second device, so as to update, by the second device, second code data in the second device based on the target update information.
12. A code update apparatus applied to a second device, the apparatus comprising:
a receiving unit for receiving target update information transmitted by a first device, the target update information being determined based on the first code data and the longest common subsequence of the second code data;
an updating unit configured to update the second code data based on the target update information.
13. An electronic device, comprising: a processor and a memory for storing a computer program, the processor being configured to invoke and execute the computer program stored in the memory, to perform the method of any of claims 1 to 6, or to perform the method of any of claims 7 to 10.
14. A computer-readable storage medium for storing a computer program which causes a computer to perform the method of any one of claims 1 to 6, or the method of any one of claims 7 to 10.
CN202010528382.0A 2020-06-11 2020-06-11 Code updating method and device, electronic equipment and computer storage medium Pending CN113805927A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010528382.0A CN113805927A (en) 2020-06-11 2020-06-11 Code updating method and device, electronic equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010528382.0A CN113805927A (en) 2020-06-11 2020-06-11 Code updating method and device, electronic equipment and computer storage medium

Publications (1)

Publication Number Publication Date
CN113805927A true CN113805927A (en) 2021-12-17

Family

ID=78891926

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010528382.0A Pending CN113805927A (en) 2020-06-11 2020-06-11 Code updating method and device, electronic equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN113805927A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116521210A (en) * 2023-04-18 2023-08-01 宁夏隆基宁光仪表股份有限公司 Method for upgrading firmware difference of Internet of things water meter

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030212712A1 (en) * 2002-05-13 2003-11-13 Jinsheng Gu Byte-level file differencing and updating algorithms
CN1674528A (en) * 2005-03-23 2005-09-28 北京北方烽火科技有限公司 LCS network management method based on hierarchical chained list and dynamic XML technique
KR20070089380A (en) * 2006-02-28 2007-08-31 삼성전자주식회사 Method for generating patch file and computer readable recording medium storing program for performing the method
US20090007090A1 (en) * 2007-06-28 2009-01-01 Sony Ericsson Mobile Communications Japan Inc. Software updating method and portable terminal device
US20130042231A1 (en) * 2011-08-10 2013-02-14 Ford Global Technologies, Llc Methods and Apparatus for Software Updating
CN103677869A (en) * 2012-09-06 2014-03-26 中国科学院计算技术研究所 Wireless sensor network node remote code updating system and method
US20140173577A1 (en) * 2012-12-19 2014-06-19 Asurion, Llc Patchless update management on mobile devices
CN106878391A (en) * 2017-01-10 2017-06-20 厦门中控生物识别信息技术有限公司 The system and method for internet-of-things terminal firmware upgrade in LAN
CN108228224A (en) * 2017-12-21 2018-06-29 杭州中天微系统有限公司 A kind of method and device of embedded system difference upgrading
CN108966260A (en) * 2018-07-31 2018-12-07 Oppo广东移动通信有限公司 A kind of data-updating method and device, terminal device
CN110457053A (en) * 2019-07-02 2019-11-15 苏州大学 A kind of terminal remote automatic update system based on NB-IoT
CN110709815A (en) * 2017-06-09 2020-01-17 黑莓有限公司 Providing data file updates using multimedia broadcast multicast services

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030212712A1 (en) * 2002-05-13 2003-11-13 Jinsheng Gu Byte-level file differencing and updating algorithms
CN1674528A (en) * 2005-03-23 2005-09-28 北京北方烽火科技有限公司 LCS network management method based on hierarchical chained list and dynamic XML technique
KR20070089380A (en) * 2006-02-28 2007-08-31 삼성전자주식회사 Method for generating patch file and computer readable recording medium storing program for performing the method
US20090007090A1 (en) * 2007-06-28 2009-01-01 Sony Ericsson Mobile Communications Japan Inc. Software updating method and portable terminal device
US20130042231A1 (en) * 2011-08-10 2013-02-14 Ford Global Technologies, Llc Methods and Apparatus for Software Updating
CN103677869A (en) * 2012-09-06 2014-03-26 中国科学院计算技术研究所 Wireless sensor network node remote code updating system and method
US20140173577A1 (en) * 2012-12-19 2014-06-19 Asurion, Llc Patchless update management on mobile devices
CN106878391A (en) * 2017-01-10 2017-06-20 厦门中控生物识别信息技术有限公司 The system and method for internet-of-things terminal firmware upgrade in LAN
CN110709815A (en) * 2017-06-09 2020-01-17 黑莓有限公司 Providing data file updates using multimedia broadcast multicast services
CN108228224A (en) * 2017-12-21 2018-06-29 杭州中天微系统有限公司 A kind of method and device of embedded system difference upgrading
CN108966260A (en) * 2018-07-31 2018-12-07 Oppo广东移动通信有限公司 A kind of data-updating method and device, terminal device
CN110457053A (en) * 2019-07-02 2019-11-15 苏州大学 A kind of terminal remote automatic update system based on NB-IoT
CN110750292A (en) * 2019-07-02 2020-02-04 苏州大学 NB-IoT-based remote automatic terminal updating system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
(美)JULIAN BUCKNALL: "《Delphi算法与数据结构》", 北京:中国电力出版社 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116521210A (en) * 2023-04-18 2023-08-01 宁夏隆基宁光仪表股份有限公司 Method for upgrading firmware difference of Internet of things water meter
CN116521210B (en) * 2023-04-18 2024-05-03 宁夏隆基宁光仪表股份有限公司 Method for upgrading firmware difference of Internet of things water meter

Similar Documents

Publication Publication Date Title
CN110166975B (en) Agricultural Internet of things sensor communication method based on wireless network and raspberry-set node
CN105051566B (en) Improved wireless network location technology
CN101896889B (en) Radio terminal, radio terminal nonvolatile memory, and diagnosis information fail-safe storage method
CN110209683B (en) System for acquiring environmental data in real time and writing environmental data into block chain
CN110032512A (en) A kind of adjustment method of small routine, relevant device and terminal
CN110457053A (en) A kind of terminal remote automatic update system based on NB-IoT
CN104185141A (en) Bluetooth beacon device based system and method for detecting stay time of user in area
CN110119282A (en) A kind of internet-of-things terminal and system based on general-purpose built-in type computer
CN110875850A (en) Firmware upgrading method and system, readable storage medium and terminal equipment
CN109873722A (en) Firmware remote upgrade method, device, computer equipment and storage medium
CN113805927A (en) Code updating method and device, electronic equipment and computer storage medium
WO2019019285A1 (en) Resource control method and apparatus
CN114741400A (en) Data synchronization and analysis method, device and terminal equipment
CN104199661A (en) Wireless sensor network (WSN) reprogramming method for MC1321X
US11036409B2 (en) Non-volatile memory using a reduced number of interconnect terminals
Boers et al. Developing wireless sensor network applications in a virtual environment
CN110659189B (en) Application program generation method and device, cloud server and readable storage medium
Souissi et al. An intelligent wireless sensor network temperature acquisition system with an FPGA
CN101197959B (en) Terminal control method, system and equipment
CN109460280B (en) Method and terminal for running program
CN113360161A (en) Resource upgrading method and related product
CN101442539A (en) Method and apparatus for implementing field filtration
CN106778408B (en) NFC-WIFI reader device and NFC data processing method
Jiang et al. uSD: universal sensor data entry card
Tang et al. Internet of things security: Principles and practice

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