CN110618830B - Remote upgrading method and system based on NBIOT network - Google Patents

Remote upgrading method and system based on NBIOT network Download PDF

Info

Publication number
CN110618830B
CN110618830B CN201910748703.5A CN201910748703A CN110618830B CN 110618830 B CN110618830 B CN 110618830B CN 201910748703 A CN201910748703 A CN 201910748703A CN 110618830 B CN110618830 B CN 110618830B
Authority
CN
China
Prior art keywords
program
data
upgrading
nbiot
check 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.)
Active
Application number
CN201910748703.5A
Other languages
Chinese (zh)
Other versions
CN110618830A (en
Inventor
林智铃
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hengonda Technology Co ltd
Original Assignee
Hengonda 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 Hengonda Technology Co ltd filed Critical Hengonda Technology Co ltd
Priority to CN201910748703.5A priority Critical patent/CN110618830B/en
Publication of CN110618830A publication Critical patent/CN110618830A/en
Application granted granted Critical
Publication of CN110618830B publication Critical patent/CN110618830B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The invention provides a remote upgrading method and system based on an NBIOT network, relating to the field of Internet of things, wherein the method comprises the following steps: step 10, when an NBIOT terminal device sends an upgrade request to an IOT cloud platform, obtaining a difference file and a first check code, and storing the difference file and the first check code into a first storage area; step 20, obtaining current program data of the NBIOT terminal device, storing the current program data into a second storage area, and updating the current program data according to the difference file to obtain upgraded program data; step 30, generating a second check code according to the upgrading program data, judging whether the second check code is consistent with the first check code, if not, returning to the step 20, and if so, entering the step 40; and step 40, replacing the current program data of the NBIOT terminal equipment with the upgrading program data. The invention improves the program upgrading speed of the terminal equipment, ensures the accuracy and prolongs the service life of the battery of the terminal equipment.

Description

Remote upgrading method and system based on NBIOT network
Technical Field
The invention relates to the technical field of Internet of things, in particular to a remote upgrading method and system based on an NBIOT network.
Background
With the continuous development of the technology of the internet of things, the number of terminal devices of the internet of things is continuously increased, the functions are gradually enriched and improved, the code amount of a terminal program is also increased, and how to effectively maintain and upgrade the program is a very troublesome problem for development engineers. The service life of a battery of a terminal with a battery device based on an NBIOT network, such as an intelligent lock based on the NBIOT network, generally requires more than one year, while the service life of a battery of an antenna attitude detector based on the NBIOT network generally requires three years.
In a traditional program architecture and an upgrading mode, the whole program is upgraded together, however, the NBIOT narrowband Internet of things data transmission rate is low, the whole program is upgraded together, the transmitted data volume is large, the consumed time is long, and the service life of a battery is influenced; meanwhile, the traditional program upgrading mode is to directly modify the upgrading file without effective backup verification operation, and in the NBIOT narrowband Internet of things, the condition of poor network environment is often encountered, so that the success rate of upgrading is inevitably influenced.
Disclosure of Invention
One of the technical problems to be solved by the present invention is to provide a remote upgrading method for an NBIOT network, which can improve the program upgrading speed of a terminal device, ensure the accuracy, and prolong the service life of a battery of the terminal device.
One of the technical problems solved by the invention is realized as follows:
a remote upgrading method based on an NBIOT network comprises the following steps:
step 10, when an NBIOT terminal device sends an upgrade request to an IOT cloud platform, acquiring a difference file and a first check code, and storing the difference file and the first check code into a first storage area, wherein the first check code is generated by the IOT cloud platform according to a latest version program of the NBIOT terminal device;
step 20, obtaining current program data of the NBIOT terminal device, storing the current program data into a second storage area, and updating the current program data according to the difference file to obtain upgraded program data;
step 30, generating a second check code according to the upgrading program data, judging whether the second check code is consistent with the first check code, if not, returning to the step 20, and if so, entering the step 40;
and step 40, replacing the current program data of the NBIOT terminal equipment with the upgrading program data.
Further, the step 10 is preceded by:
step A, the NBIOT terminal equipment sends equipment information and a current version number to the IOT cloud platform according to a set period and/or response user operation;
and step B, the NBIOT terminal equipment acquires the return information of the IOT cloud platform, returns to the step A when the return information is a common response, and executes the step 10 when the return information is an upgrade response.
Preferably, the steps 10 and 20 are further specifically:
step 10, when an NBIOT terminal device sends an upgrade request to the IOT cloud platform, acquiring a designated page, a designated address, a designated length, replacement data and a first check code, and storing the first check code in a first storage area, wherein the first check code is generated by the IOT cloud platform according to a latest version program of the NBIOT terminal device;
and step 20, acquiring current program data of the NBIOT terminal device, storing the current program data into a second storage area, and updating the current program data according to the appointed page, the appointed address, the appointed length and the replacement data to obtain upgrading program data.
Preferably, the step 10 and the step 20 are further specifically:
step 10, when an NBIOT terminal device sends an upgrade request to the IOT cloud platform, acquiring a designated page, a designated address, a designated length, replacement data, a program type and a first check code, and storing the first check code in a first storage area, wherein the first check code is generated by the IOT cloud platform according to a program of a latest version of the NBIOT terminal device;
and 20, acquiring a driving program, an application program and/or configuration information of the NBIOT terminal equipment according to the program type, storing the driving program, the application program and/or the configuration information into a second storage area, and updating the driving program, the application program and/or the configuration information data according to the specified page, the specified address, the specified length and the replacement data to obtain upgrading program data.
Preferably, the step 10 further specifically includes:
step 10, when an NBIOT terminal device sends an upgrade request to the IOT cloud platform, obtaining a difference file and a first check code, wherein the first check code is generated by the IOT cloud platform according to a latest version program of the NBIOT terminal device, the difference file is divided into a plurality of data packets according to a set size, and the NBIOT terminal device obtains the data packets from the IOT cloud platform one by one and stores the data packets into a first storage area.
The second technical problem to be solved by the present invention is to provide a remote upgrade system in NBIOT network, which can improve the speed of program upgrade of the terminal device, ensure the accuracy, and prolong the service life of the battery of the terminal device.
The second technical problem solved by the invention is realized as follows:
a remote upgrading system based on an NBIOT network comprises an upgrading file acquisition module, a data updating module, a data checking module and a program upgrading module;
the upgrade file acquisition module is used for acquiring a difference file and a first check code when the NBIOT terminal device sends an upgrade request to the IOT cloud platform, and storing the difference file and the first check code into a first storage area, wherein the first check code is generated by the IOT cloud platform according to a latest version program of the NBIOT terminal device;
the data updating module is used for acquiring current program data of the NBIOT terminal equipment, storing the current program data into a second storage area, and updating the current program data according to the difference file to obtain upgrading program data;
the data checking module is used for generating a second check code according to the upgrading program data, judging whether the second check code is consistent with the first check code or not, returning to the data updating module if the second check code is inconsistent with the first check code, and entering the program upgrading module if the second check code is consistent with the first check code;
the program upgrading module is used for replacing the current program of the NBIOT terminal equipment with the upgrading program.
Further, the system also comprises an upgrade inquiring module and a response receiving module:
the upgrading query module is used for sending equipment information and a current version number to the IOT cloud platform by the NBIOT terminal equipment according to a set period and/or responding to user operation;
the response receiving module is used for the NBIOT terminal equipment to obtain the return information of the IOT cloud platform, when the return information is a common response, the return information is returned to the upgrading query module, and when the return information is an upgrading response, the NBIOT terminal equipment enters the upgrading file obtaining module.
Preferably, the upgrade file obtaining module and the data updating module further specifically include:
the upgrade file acquisition module is used for acquiring a specified page, a specified address, a specified length, replacement data and a first check code when the NBIOT terminal device sends an upgrade request to the IOT cloud platform, and storing the specified page, the specified address, the specified length, the replacement data and the first check code into a first storage area, wherein the first check code is generated by the IOT cloud platform according to a latest version program of the NBIOT terminal device;
and the data updating module is used for acquiring current program data of the NBIOT terminal equipment, storing the current program data into a second storage area, and updating the current program data according to the appointed page, the appointed address, the appointed length and the replacement data to obtain upgrading program data.
Preferably, the upgrade file acquiring module and the data updating module further specifically include:
the upgrade file acquisition module is used for acquiring a specified page, a specified address, a specified length, replacement data, a program type and a first check code when the NBIOT terminal device sends an upgrade request to the IOT cloud platform, and storing the specified page, the specified address, the specified length, the replacement data, the program type and the first check code into a first storage area, wherein the first check code is generated by the IOT cloud platform according to a latest version program of the NBIOT terminal device;
and the data updating module is used for acquiring the drive program, the application program and/or the configuration information of the NBIOT terminal equipment according to the program type, storing the drive program, the application program and/or the configuration information into a second storage area, and updating the drive program, the application program and/or the configuration information data according to the appointed page, the address, the length and the replacement data to obtain upgrading program data.
Preferably, the upgrade file acquiring module further specifically includes:
the upgrading file acquisition module is used for acquiring a difference file and a first check code when NBIOT terminal equipment sends an upgrading request to the IOT cloud platform, the first check code is generated by the IOT cloud platform according to the latest version program of the NBIOT terminal equipment, the difference file is divided into a plurality of data packets according to a set size, and the NBIOT terminal equipment acquires the data packets from the IOT cloud platform one by one and stores the data packets into a first storage area.
The invention has the following advantages:
1. the IOT cloud platform generates a difference file by comparing the current version program and the latest version program of the NBIOT terminal device, and the terminal device only needs to be upgraded according to the obtained difference file, so that the transmission time and the upgrading time are saved, and the service life of a battery of the terminal device is prolonged;
2. the difference file and the first check code acquired by the IOT cloud platform are stored in the first storage area, the current program of the NBIOT terminal device is acquired and stored in the second storage area, the upgrading program acquired after all data packets are replaced generates the second check code, and the upgrading operation is executed after the two check codes are consistent, so that the accuracy of upgrading the program of the NBIOT terminal device is ensured.
Drawings
The invention will be further described with reference to the following examples and figures.
Fig. 1 is a flowchart illustrating an implementation of a remote upgrade method based on an NBIOT network according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a remote upgrade system based on an NBIOT network according to an embodiment of the present invention;
FIG. 3 is a schematic data interaction diagram of a remote upgrade system based on an NBIOT network according to an embodiment of the present invention;
FIG. 4 is a schematic diagram illustrating a workflow of an upgrade file acquisition module of a remote upgrade system based on an NBIOT network according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a data update module workflow of a remote upgrade system based on an NBIOT network according to an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating a program upgrade module of a remote upgrade system based on an NBIOT network according to an embodiment of the present invention;
fig. 7 is a program architecture address allocation diagram of a remote upgrade system based on an NBIOT network according to an embodiment of the present invention.
Detailed Description
Referring to fig. 1 to 7, an embodiment of a remote upgrade method based on an NBIOT network includes:
step 10, when an NBIOT terminal device sends an upgrade request to an IOT cloud platform, acquiring a difference file and a first check code, and storing the difference file and the first check code into a first storage area, wherein the first check code is generated by the IOT cloud platform according to a latest version program of the NBIOT terminal device;
step 20, obtaining current program data of the NBIOT terminal device, storing the current program data into a second storage area, and updating the current program data according to the difference file to obtain upgraded program data;
step 30, generating a second check code according to the upgrading program data, judging whether the second check code is consistent with the first check code, if not, returning to the step 20, and if so, entering the step 40;
and step 40, replacing the current program data of the NBIOT terminal equipment with the upgrading program data.
The IOT cloud platform stores various version programs of NBIOT terminal equipment, when the NBIOT terminal equipment sends an upgrade request to the IOT cloud platform, the NBIOT terminal equipment reports basic equipment information and a current program version number (such as 1.0) to the IOT cloud platform, and the IOT cloud platform acquires the current version program (such as A) and a latest version program (such as B with the version number of 1.1) of the NBIOT terminal equipment according to the basic equipment information and the current program version number (such as 1.0);
the IOT cloud platform obtains a difference file (such as C) by comparing a latest version program (such as B) with a current version program (such as A);
the IOT cloud platform generates a first check code according to the latest version program (such as B);
when the NBIOT terminal device sends an upgrade request to the IOT cloud platform, the difference file (for example, C) and the first check code are obtained.
Acquiring current program data (for example, a) of the NBIOT terminal device, storing the current program data into a second storage area, and updating the current program data according to the difference file (for example, C) to obtain upgrade program data (for example, B');
generating a second check code according to the upgrade program data (for example, B '), determining whether the second check code is consistent with the first check code, if not, the received upgrade program data is inconsistent with the latest version program (i.e., B ' ≠ B), returning to step 20, if so, the received upgrade program data is consistent with the latest version program (i.e., B ' ≠ B), and entering step 40.
The difference file comprises a designated page, a designated address, a designated length and replacement Data, is stored in a first storage area (such as a Data area divided in a Flash memory), acquires a current program of the NBIOT terminal device, stores the current program in a second storage area (such as a Bank area divided in the Flash memory), finds a designated position according to the designated page, the designated address and the designated length, updates the current program Data into the replacement Data, and obtains the upgrading program Data after the replacement Data of all designated positions are updated.
The comparison between the current program and the latest program is carried out through the IOT cloud platform to generate a difference file, the size of a transmission file can be reduced, and compared with the transmission of the whole upgrading file, the transmission time and the upgrading time are reduced through the NBIOT network transmission of the difference file, so that the service life of a terminal equipment battery is prolonged.
In a preferred embodiment, the step 10 further comprises:
step A, the NBIOT terminal equipment sends equipment information and a current version number to the IOT cloud platform according to a set period and/or response user operation;
and step B, the NBIOT terminal equipment acquires the return information of the IOT cloud platform, returns to the step A when the return information is a common response, and executes the step 10 when the return information is an upgrade response.
The NBIOT terminal equipment can perform upgrading inquiry according to a set period and/or response to user operation, and ensures that the equipment program is updated in time. And the NBIOT terminal equipment finds the latest program corresponding to the equipment according to the equipment information, finds the current program according to the current version number, and compares the current program data with the latest program data to obtain a difference file.
Referring to fig. 3, in a preferred embodiment, data interaction between the NBIOT terminal and the IOT cloud platform is as follows:
the NBIOT terminal equipment sends current equipment information and a current program version number to an IOT cloud platform;
the IOT cloud platform compares the latest version program with the current version program according to the equipment information to generate a difference file (if the latest version program is consistent with the current version program, the update is not needed, a common response is issued, and the NBIOT terminal equipment does not need to execute any operation after receiving the common response);
the IOT cloud platform issues an upgrade response and file parameter information to NBIOT terminal equipment;
the NBIOT terminal equipment initiates a request for obtaining an upgrade file;
the IOT cloud platform issues a difference file and a first check code generated according to the difference file to NBIOT terminal equipment to be upgraded, and the first check code is generated by the IOT cloud platform according to the latest version program of the NBIOT terminal equipment.
Referring to fig. 7, in an embodiment, the program of the NBIOT terminal device is separated into a Driver, an application and configuration information, which are respectively stored in different storage partitions of the Flash memory of the NBIOT terminal device (for example, the Driver is stored in the Driver area, the application is stored in the App area, and the configuration information is stored in the Config area). The program space is divided into more detailed and smaller programs, the programs are separated into the driving programs, the application programs and the configuration information, any one or more programs can be updated, the whole program does not need to be updated at the same time, and the upgrading efficiency is further improved. The driver, the application and the configuration information are respectively provided with different version numbers, when the return information is an upgrade response, the return information further comprises file parameter information (including a program type and a file size), and the driver, the application and/or the configuration information in the corresponding storage partition are/is obtained according to the file parameter information.
The difference file comprises the page, the address, the length, the replacement Data and the program type of the current program, is stored in a first storage area (such as a Data area divided from a Flash memory), acquires a drive program, an application program and/or configuration information of the NBIOT terminal device according to the program type, and stores the drive program, the application program and/or the configuration information into a second storage area (such as a Bank area divided from the Flash memory); and updating the data of the specified page, address and length of the driver, the application and/or the configuration information into replacement data according to the difference file.
Referring to fig. 4, the difference file is divided into a plurality of data packets according to a set size (for example, 256 bytes), the NBIOT terminal device acquires the data packets one by one from the IOT cloud platform, stores data after all the data packets are received, and then writes a reception completion flag. The NBIOT platform adopts a UDP data connection mode, the UDP adopts a connectionless protocol mode, and the NBIOT cloud platform can accurately issue data to the terminal equipment to be upgraded every time the NBIOT cloud platform sends the data to the terminal equipment to be upgraded and the terminal equipment is connected to the cloud platform. The NBIOT network has narrow bandwidth and unstable network, has the problem of data delay, and the packet transmission can better adapt to the narrow-band network and increase the reliability of data transmission.
Referring to fig. 5, in the foreground and background system, the program runs in the Flash memory and cannot be directly erased or written, so that the upgrade program generated by replacing the difference file is first stored in a second storage area (for example, a Bank area partitioned from the Flash memory), the restart system writes the upgrade program in the second storage area into a program partition to be upgraded (for example, a Driver is stored in a Driver area, an application is stored in an App area, and configuration information is stored in a Config area), thereby ensuring the reliability of system upgrade, and the specific steps are as follows:
step 1, when an NBIOT terminal equipment system is started, a program runs and reads a first storage area (such as a Data area divided from a Flash memory); judging whether an upgrade file (comprising a difference file and a first check code) exists or not, and if not, continuing to run the program;
step 2, if the upgrade file exists, reading a binary file of the program to be upgraded (namely data in a Flash address corresponding to the program to be upgraded), and writing the binary file into a read second storage area (for example, a Bank area divided from a Flash memory);
and 3, reading Data of page X in the Bank area and storing the Data in a RAM0, reading Data in the Data area difference file, modifying the Data in the RAM0 according to the Data in the difference file, then erasing the Data of page X in the Bank area, and writing the Data in the RAM0 to page X, and finally, the number of Flash pages is + 1.
And 4, repeating the step 3 until the Xth page is the last page of the specified program, writing a mark to be upgraded, and restarting the system by soft resetting the program.
Please refer to fig. 6, which is a schematic diagram of a program upgrade flow according to an embodiment of the present invention:
and (3) carrying out soft reset on the program of the NBIOT terminal equipment, starting to execute a Boot program stored in a storage area (such as a Boot area) from the Flash memory address 0, wherein the Boot program is mainly responsible for the upgrading function of the firmware.
The Boot program reads the data of the second storage area, judges whether the mark to be upgraded exists or not, and directly starts to run the equipment program if the mark to be upgraded does not exist; if the firmware to be upgraded is needed, reading an upgrading program of a second storage area (such as a Bank area divided from a Flash memory), erasing an address program of the area to be upgraded (such as a driving program stored in a Driver area, an application program stored in an App area and/or configuration information stored in a Config area), writing the upgrading program, erasing an upgrading mark, restarting an NBIOT terminal equipment program, and continuing to execute from a storage area starting from the Flash memory address 0.
Referring to fig. 7, the address allocation diagram of the program architecture according to the embodiment of the present invention includes:
a Boot area 16K space, which is mainly used for storing a downloading function in a factory mode and a program for upgrading operation (the program to be upgraded can be a driver, an application or a configuration program) of the program to be upgraded in a remote upgrading mode;
the Driver area 40K space is mainly used for storing a program of Driver design related to hardware at the bottom layer;
the App area 60K space is mainly used for storing and calling a bottom layer driver interface to complete a program for code development of an application protocol function;
the Config area 4K space is mainly used for storing Data such as the sizes of programs of a Driver area, an App area, a Bank area and a Data area, a starting address space, an application protocol, an IP address and the like;
a Bank area 60K space, i.e., a second storage area, which is mainly used for storing program bin file data (i.e., upgrade files) that need to be upgraded;
a Data area 76K space, namely a first storage area, which is mainly used for storing Data file information (including a difference file and a first check code) responsible for remote downloading;
partitioning the program can effectively reduce the firmware space of a single program and reduce the size of the upgraded firmware.
Referring to fig. 2 to 7 again, an embodiment of a remote upgrade system based on an NBIOT network includes: the system comprises an upgrade file acquisition module, a data updating module, a data verification module and a program upgrading module;
the upgrade file acquisition module is used for acquiring a difference file and a first check code when the NBIOT terminal device sends an upgrade request to the IOT cloud platform, and storing the difference file and the first check code into a first storage area, wherein the first check code is generated by the IOT cloud platform according to a latest version program of the NBIOT terminal device;
the data updating module is used for acquiring current program data of the NBIOT terminal equipment, storing the current program data into a second storage area, and updating the current program data according to the difference file to obtain upgraded program data;
the data checking module is used for generating a second check code according to the upgrading program data, judging whether the second check code is consistent with the first check code or not, returning to the data updating module if the second check code is inconsistent with the first check code (namely, the check is not passed), and entering the program upgrading module if the second check code is consistent with the first check code (namely, the check is passed);
the program upgrading module is used for replacing the current program of the NBIOT terminal equipment with the upgrading program.
The IOT cloud platform stores various version programs of NBIOT terminal equipment, when the NBIOT terminal equipment sends an upgrade request to the IOT cloud platform, the NBIOT terminal equipment reports basic equipment information and a current program version number (such as 1.0) to the IOT cloud platform, and the IOT cloud platform obtains the current version program (such as A) and the latest version program (such as B) of the NBIOT terminal equipment according to the basic equipment information and the current program version number (such as 1.0);
the IOT cloud platform obtains a difference file (such as C) by comparing a latest version program (such as B) with a current version program (such as A);
the IOT cloud platform generates a first check code according to the latest version program (such as B);
when an NBIOT terminal device sends an upgrade request to an IOT cloud platform, the upgrade file acquisition module acquires the difference file (such as C) and a first check code;
the data updating module acquires current program data (such as A) of the NBIOT terminal device, stores the current program data into a second storage area, and updates the current program data according to the difference file (such as C) to obtain upgrading program data (such as B');
the data checking module generates a second check code according to the upgrade program data (for example, B '), judges whether the second check code is consistent with the first check code, if not, the received upgrade program data is inconsistent with the latest version program (i.e., B ' ≠ B), returns to the upgrade file acquisition module, and if so, the received upgrade program data is consistent with the latest version program (i.e., B ' ≠ B), and enters the program upgrade module.
The difference file comprises a designated page, a designated address, a designated length and replacement Data, is stored in a first storage area (such as a Data area divided in a Flash memory), acquires a current program of the NBIOT terminal device, stores the current program in a second storage area (such as a Bank area divided in the Flash memory), finds a designated position according to the designated page, the designated address and the designated length, updates the current program Data into the replacement Data, and obtains the upgrading program Data after the replacement Data of all designated positions are updated.
The comparison between the current program and the latest program is carried out through the IOT cloud platform to generate a difference file, the size of a transmission file can be reduced, and compared with the transmission of the whole upgrading file, the transmission time and the upgrading time are reduced through the NBIOT network transmission of the difference file, so that the service life of a terminal equipment battery is prolonged.
In a preferred embodiment, the system further comprises an upgrade query module and a response receiving module:
the upgrading query module is used for sending equipment information and a current version number to the IOT cloud platform by the NBIOT terminal equipment according to a set period and/or responding to user operation;
the response receiving module is used for the NBIOT terminal equipment to obtain the return information of the IOT cloud platform, when the return information is a common response, the return information is returned to the upgrading query module, and when the return information is an upgrading response, the NBIOT terminal equipment enters the upgrading file obtaining module.
The NBIOT terminal equipment can perform upgrading inquiry according to a set period and/or response to user operation, and ensures that the equipment program is updated in time. And the NBIOT terminal equipment finds the latest program corresponding to the equipment according to the equipment information, finds the current program according to the current version number, and compares the current program data with the latest program data to obtain a difference file.
Referring to fig. 3, in a preferred embodiment, data interaction between the NBIOT terminal and the IOT cloud platform is as follows:
the NBIOT terminal equipment sends current equipment information and a program version number to an IOT cloud platform;
the IOT cloud platform compares the latest version program with the current version program according to the equipment information to generate a difference file (if the latest version program is consistent with the current version program, the update is not needed, a common response is issued, and the NBIOT terminal equipment does not need to execute any operation after receiving the common response);
the IOT cloud platform issues an upgrade response and file parameter information to NBIOT terminal equipment;
the NBIOT terminal equipment initiates a request for obtaining the upgrade file;
and the IOT cloud platform issues the difference file and a first check code generated according to the difference file to the NBIOT terminal equipment to be upgraded.
Referring to fig. 7, in an embodiment, the program of the NBIOT terminal device is separated into a Driver, an application program, and configuration information, and the Driver, the application program, and the configuration information are respectively stored in different storage partitions of the Flash memory of the NBIOT terminal device (for example, the Driver is stored in the Driver area, the application program is stored in the App area, and the configuration information is stored in the Config area). The program space is divided into more detailed and smaller programs, the programs are separated into the driving programs, the application programs and the configuration information, any one or more programs can be updated, the whole program does not need to be updated at the same time, and the upgrading efficiency is further improved. The driver, the application and the configuration information are respectively provided with different version numbers, when the return information is an upgrade response, the return information further comprises file parameter information (including a program type and a file size), and the driver, the application and/or the configuration information in the corresponding storage partition are/is obtained according to the file parameter information.
The difference file comprises the page, the address, the length, the replacement Data and the program type of the current program, is stored in a first storage area (such as a Data area divided from a Flash memory), acquires a drive program, an application program and/or configuration information of the NBIOT terminal device according to the program type, and stores the drive program, the application program and/or the configuration information into a second storage area (such as a Bank area divided from the Flash memory); and updating the data of the specified page, address and length of the driver, application and/or configuration information into replacement data according to the difference file.
Referring to fig. 4, the difference file is divided into a plurality of data packets according to a set size (for example, 256 bytes), the NBIOT terminal device acquires the data packets one by one from the IOT cloud platform, stores data after all the data packets are received, and then writes a reception completion flag. The NBIOT platform adopts a UDP data connection mode, the UDP adopts a connectionless protocol mode, and the NBIOT cloud platform can accurately issue data to the terminal equipment to be upgraded every time the NBIOT cloud platform sends the data to the terminal equipment to be upgraded and the terminal equipment is connected to the cloud platform. The NBIOT network has narrow bandwidth and unstable network, has the problem of data delay, and the packet transmission can better adapt to the narrow-band network and increase the reliability of data transmission.
Referring to fig. 5, a schematic diagram of a work flow of a data update module according to an embodiment of the present invention is shown, in a foreground/background system, a program runs in a Flash memory and cannot be directly erased/written, so that an upgrade program generated according to a difference file replacement is first stored in a second storage area (for example, a Bank area divided in the Flash memory), and a restart system writes the upgrade program in the second storage area into a program partition to be upgraded (for example, a Driver is stored in a Driver area, an application is stored in an App area, and configuration information is stored in a Config area), thereby ensuring reliability of system upgrade. The data updating module comprises the following working steps:
step 1, when an NBIOT terminal equipment system is started, a program runs and reads a first storage area (such as a Data area divided from a Flash memory); judging whether an upgrade file (comprising a difference file and a first check code) exists or not, and if not, continuing to run the program;
step 2, if the upgrade file exists, reading a binary file of the program to be upgraded (namely data in a Flash address corresponding to the program to be upgraded), and writing the binary file into a read second storage area (for example, a Bank area divided from a Flash memory);
and 3, reading Data of page X in the Bank area and storing the Data in a RAM0, reading Data in the Data area difference file, modifying the Data in the RAM0 according to the Data in the difference file, then erasing the Data of page X in the Bank area, and writing the Data in the RAM0 to page X, and finally, the number of Flash pages is + 1.
And 4, repeating the step 3 until the X page is the last page of the specified program, writing a mark to be upgraded, and restarting the system by soft resetting the program.
Please refer to fig. 6, which is a schematic diagram of a workflow of a program upgrade module according to an embodiment of the present invention:
and (3) carrying out soft reset on the program of the NBIOT terminal equipment, starting to execute a Boot program stored in a storage area (such as a Boot area) from the Flash memory address 0, wherein the Boot program is mainly responsible for the upgrading function of the firmware.
The Boot program reads the data of the second storage area, judges whether the mark to be upgraded exists or not, and directly starts to run the equipment program if the mark to be upgraded does not exist; if the firmware to be upgraded is needed, reading an upgrading program of a second storage area (such as a bankarea divided from a Flash memory), erasing an address program of the area to be upgraded (such as a driving program stored in a Driver area, an application program stored in an App area and/or configuration information stored in a Config area), writing the upgrading program, erasing an upgrading mark, restarting an NBIOT terminal equipment program, and continuing to execute from a storage area starting from the Flash memory address 0.
Referring to fig. 7, a program architecture address allocation diagram according to an embodiment of the present invention includes:
a Boot area 16K space, which is mainly used for storing a downloading function in a factory mode and a program for upgrading operation (the program to be upgraded can be a driver, an application or a configuration program) of the program to be upgraded in a remote upgrading mode;
the Driver area 40K space is mainly used for storing a program of Driver design related to hardware at the bottom layer;
the App area 60K space is mainly used for storing and calling a bottom layer driver interface to complete a program for code development of an application protocol function;
the Config area 4K space is mainly used for storing Data such as the sizes of programs of a Driver area, an App area, a Bank area and a Data area, a starting address space, an application protocol, an IP address and the like;
a Bank area 60K space, i.e., a second storage area, which is mainly used for storing program bin file data (i.e., upgrade files) that need to be upgraded;
the Data area 76K space, i.e., the first storage area, is mainly used for storing Data file information (including difference files and first check codes) responsible for remote downloading;
partitioning the program can effectively reduce the firmware space of a single program and reduce the size of the upgraded firmware.
According to the invention, the IOT cloud platform compares the program versions of the NBIOT terminal equipment to generate the difference file, and the terminal equipment only needs to be upgraded according to the obtained difference file, so that the transmission time and the upgrading time are saved, and the service life of a battery of the terminal equipment is prolonged; the difference file and the first check code acquired by the IOT cloud platform are stored in the first storage area, the current program of the NBIOT terminal device is acquired and stored in the second storage area, the upgrading program obtained after all data packet replacement is completed generates the second check code, and the upgrading operation is executed after the two check codes are consistent, so that the accuracy of upgrading the program of the NBIOT terminal device is guaranteed.
Although specific embodiments of the invention have been described above, it will be understood by those skilled in the art that the specific embodiments described are illustrative only and are not limiting upon the scope of the invention, and that equivalent modifications and variations can be made by those skilled in the art without departing from the spirit of the invention, which is to be limited only by the appended claims.

Claims (4)

1. A remote upgrading method based on an NBIOT network is characterized by comprising the following steps:
step 10, separating a program of the NBIOT terminal equipment into three program types of a driver program, an application program and configuration information, and respectively storing the three program types in different storage partitions of a Flash memory of the NBIOT terminal equipment; when NBIOT terminal equipment sends an upgrade request to an IOT cloud platform, a difference file and a first check code are obtained and stored in a first storage area, and the first check code is generated by the IOT cloud platform according to the latest version program of the NBIOT terminal equipment; the difference file comprises a designated page, a designated address, a designated length, replacement data and a program type, the difference file is divided into a plurality of data packets according to a set size, and the NBIOT terminal equipment acquires the data packets from the IOT cloud platform one by one and stores the data packets into a first storage area;
step 20, acquiring a driver, an application and/or configuration information of the NBIOT terminal device according to the program type, storing the driver, the application and/or the configuration information into a second storage area, and updating the driver, the application and/or the configuration information data according to the specified page, the specified address, the specified length and the replacement data to obtain upgrading program data;
step 30, generating a second check code according to the upgrading program data, judging whether the second check code is consistent with the first check code, if not, returning to the step 20, and if so, entering the step 40;
and step 40, replacing the driver, the application program and/or the configuration information data of the NBIOT terminal equipment with the upgrading program data.
2. The NBIOT network-based remote upgrade method according to claim 1, wherein step 10 is preceded by:
step A, the NBIOT terminal equipment sends equipment information and a current version number to the IOT cloud platform according to a set period and/or response user operation;
and step B, the NBIOT terminal equipment acquires the return information of the IOT cloud platform, returns to the step A when the return information is a common response, and executes the step 10 when the return information is an upgrade response.
3. A remote upgrading system based on an NBIOT network is characterized in that: the system comprises an upgrade file acquisition module, a data updating module, a data checking module and a program upgrading module;
the upgrading file acquisition module is used for separating a program of the NBIOT terminal equipment into three program types of a driver program, an application program and configuration information, and storing the program types in different storage partitions of a Flash memory of the NBIOT terminal equipment; when the NBIOT terminal device sends an upgrade request to an IOT cloud platform, a difference file and a first check code are obtained and stored in a first storage area, and the first check code is generated by the IOT cloud platform according to a latest version program of the NBIOT terminal device; the difference file comprises a designated page, a designated address, a designated length, replacement data and a program type, the difference file is divided into a plurality of data packets according to a set size, and the NBIOT terminal equipment acquires the data packets from the IOT cloud platform one by one and stores the data packets into a first storage area;
the data updating module is used for acquiring a driving program, an application program and/or configuration information of the NBIOT terminal equipment according to the program type, storing the driving program, the application program and/or the configuration information into a second storage area, and updating the driving program, the application program and/or the configuration information data according to the appointed page, the appointed address, the appointed length and the replacement data to obtain upgrading program data;
the data checking module is used for generating a second check code according to the upgrading program data, judging whether the second check code is consistent with the first check code or not, returning to the data updating module if the second check code is inconsistent with the first check code, and entering the program upgrading module if the second check code is consistent with the first check code;
and the program upgrading module is used for replacing a driver program, an application program and/or configuration information data of the NBIOT terminal equipment with the upgrading program data.
4. The remote upgrading system based on the NBIOT network of claim 3, further comprising an upgrade query module and a reply receiving module:
the upgrading query module is used for sending equipment information and a current version number to the IOT cloud platform by the NBIOT terminal equipment according to a set period and/or responding to user operation;
the response receiving module is used for the NBIOT terminal equipment to obtain the return information of the IOT cloud platform, when the return information is a common response, the return information is returned to the upgrading query module, and when the return information is an upgrading response, the NBIOT terminal equipment enters the upgrading file obtaining module.
CN201910748703.5A 2019-08-14 2019-08-14 Remote upgrading method and system based on NBIOT network Active CN110618830B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910748703.5A CN110618830B (en) 2019-08-14 2019-08-14 Remote upgrading method and system based on NBIOT network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910748703.5A CN110618830B (en) 2019-08-14 2019-08-14 Remote upgrading method and system based on NBIOT network

Publications (2)

Publication Number Publication Date
CN110618830A CN110618830A (en) 2019-12-27
CN110618830B true CN110618830B (en) 2022-07-08

Family

ID=68921936

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910748703.5A Active CN110618830B (en) 2019-08-14 2019-08-14 Remote upgrading method and system based on NBIOT network

Country Status (1)

Country Link
CN (1) CN110618830B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111897560A (en) * 2020-08-27 2020-11-06 吉林大学 NB-IoT module-based program upgrading system, method, device and storage medium
CN112433750A (en) * 2020-12-17 2021-03-02 潍柴动力股份有限公司 Vehicle-mounted terminal application program upgrading method, device, equipment, medium and product
CN113064669A (en) * 2021-04-02 2021-07-02 北京天空卫士网络安全技术有限公司 Loading control method and device
CN113282316A (en) * 2021-05-19 2021-08-20 武汉天喻信息产业股份有限公司 Remote upgrading method and device for Internet of things equipment
CN113326055B (en) * 2021-06-25 2022-10-28 潍柴动力股份有限公司 Equipment updating method and related device
CN113672270A (en) * 2021-08-19 2021-11-19 讯牧信息科技(上海)有限公司 Upgrading method, computer system and remote upgrading device
CN116521210B (en) * 2023-04-18 2024-05-03 宁夏隆基宁光仪表股份有限公司 Method for upgrading firmware difference of Internet of things water meter

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107707411A (en) * 2017-10-30 2018-02-16 深圳市飞鸿光电子有限公司 The upgrade method and system of a kind of EPON
CN109358872A (en) * 2018-09-21 2019-02-19 广东美的暖通设备有限公司 Remote firmware updating method, device and computer readable storage medium
CN109982294A (en) * 2019-03-08 2019-07-05 四川爱联科技有限公司 The method that NBIot module is upgraded using bluetooth equipment
CN110045980A (en) * 2019-05-22 2019-07-23 东信和平科技股份有限公司 Remote upgrade method, equipment and the system of a kind of pair of NB-IOT equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10776096B2 (en) * 2018-01-12 2020-09-15 Blackberry Limited Method and system for controlling software updates on a network connected device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107707411A (en) * 2017-10-30 2018-02-16 深圳市飞鸿光电子有限公司 The upgrade method and system of a kind of EPON
CN109358872A (en) * 2018-09-21 2019-02-19 广东美的暖通设备有限公司 Remote firmware updating method, device and computer readable storage medium
CN109982294A (en) * 2019-03-08 2019-07-05 四川爱联科技有限公司 The method that NBIot module is upgraded using bluetooth equipment
CN110045980A (en) * 2019-05-22 2019-07-23 东信和平科技股份有限公司 Remote upgrade method, equipment and the system of a kind of pair of NB-IOT equipment

Also Published As

Publication number Publication date
CN110618830A (en) 2019-12-27

Similar Documents

Publication Publication Date Title
CN110618830B (en) Remote upgrading method and system based on NBIOT network
CN110231952B (en) ECU program backup and cyclic upgrade control method and device
CN108388599B (en) Electronic device, data migration and calling method and storage medium
CN109471738B (en) Method for identifying application program downloading channel and related equipment
CN110597542B (en) Software automatic OTA (over the air) upgrading method and device and electronic equipment
US9710340B2 (en) Replacement of a corrupt driver variable record
US20160085456A1 (en) Data read apparatus, data read method, and storage medium storing data read program
CN111177243B (en) Data export method and device, storage medium and electronic device
CN111026417A (en) Embedded equipment upgrading method and embedded equipment
CN112667265B (en) Method and device for updating bootstrap program
US20230315213A1 (en) Program download method for intelligent terminal and intelligent terminal
CN112199109B (en) Firmware upgrading method, device, equipment and medium
CN103533534A (en) Firmware wireless upgrading method for DECT (Digital Enhanced Cordless Telecommunications) mobile phone
CN116991758A (en) Spatial layout updating method, device, equipment and medium
CN112579140A (en) Software upgrading method and device
CN111737161A (en) File transmission method of Flash memory, terminal and storage medium
CN110765125B (en) Method and device for storing data
CN105119944A (en) Application starting method and related device
CN112346771A (en) Upgrade file generation method and device
CN110262875B (en) Communication method and system of Windows virtual machine and KVM host based on patch mechanism
CN113900991A (en) Data interaction method, device, equipment and storage medium
US20050009514A1 (en) Resource efficient content management and delivery without using a file system
CN112578772A (en) Data processing method of electronic control unit and related device
US10437802B2 (en) Single IO operation integer-value database
CN117170696B (en) OTA upgrading method and system for air conditioner

Legal Events

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