CN112988197A - Stable remote upgrading method - Google Patents

Stable remote upgrading method Download PDF

Info

Publication number
CN112988197A
CN112988197A CN202110403986.7A CN202110403986A CN112988197A CN 112988197 A CN112988197 A CN 112988197A CN 202110403986 A CN202110403986 A CN 202110403986A CN 112988197 A CN112988197 A CN 112988197A
Authority
CN
China
Prior art keywords
upgrade
upgrading
control instruction
length
instruction
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
CN202110403986.7A
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.)
Guangdong Telepower Communication Co ltd
Original Assignee
Guangdong Telepower Communication 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 Guangdong Telepower Communication Co ltd filed Critical Guangdong Telepower Communication Co ltd
Priority to CN202110403986.7A priority Critical patent/CN112988197A/en
Publication of CN112988197A publication Critical patent/CN112988197A/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

Landscapes

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

Abstract

The application discloses a stable remote upgrading method, which responds to a one-key upgrading operation instruction of a user, and enables a temperature measuring module end to execute the following steps: receiving an upgrading control instruction sent by an APK; judging whether the upgrading control instruction is correct or not; when the upgrading control instruction is correct, restarting the temperature measuring module end; and after restarting, judging whether an upgrading mark of the upgrading control instruction is written in, if so, clearing the APP code area and entering an upgrading mode. The method can improve the stability of remote upgrading.

Description

Stable remote upgrading method
Technical Field
The application relates to the technical field of software upgrading, in particular to a stable remote software upgrading method.
Background
With the rapid development of the technology, various temperature measuring devices are widely applied to life.
In order to respond to the demands of different markets, the market layout of the equipment manufacturers of the temperature measuring equipment, which are taken by the applicant, is continuously expanded, and the related temperature measuring equipment is used all over the country and even all over the world.
However, with the increasing market expansion, product maintenance becomes a pain point problem, and the applicant as an equipment manufacturer needs to go to different regions nationwide or globally for equipment maintenance, or return temperature measurement equipment to the factory for maintenance, which causes high maintenance cost and affects user experience.
Disclosure of Invention
The embodiment of the application provides a stable remote upgrading method, so that remote upgrading of temperature measuring equipment is realized, and the upgrading process is stable and reliable.
The embodiment of the application provides a stable remote upgrading method, which responds to a one-key upgrading operation instruction of a user, and enables a temperature measuring module end to execute the following steps:
s1: receiving an upgrading control instruction sent by an APK;
s2: judging whether the upgrading control instruction is correct or not;
s3: when the upgrading control instruction is correct, restarting the temperature measuring module end;
s4: and after restarting, judging whether an upgrading mark of the upgrading control instruction is written in, if so, clearing the APP code area and entering an upgrading mode.
Further, the data structure of the upgrade control instruction is a prefix, a length, a control bit, an upgrade package length, an upgrade package checksum check bit.
Further, the step S2 specifically includes:
if the upgrade control instruction conforms to all upgrade instruction conditions, judging that the upgrade control instruction is correct;
and if the upgrading control instruction does not meet any upgrading instruction condition, judging that the upgrading control instruction is incorrect.
Further, the upgrade instruction condition includes at least one of:
the leading word of the upgrading control instruction is the same as the fixed leading word in the protocol;
the length of the upgrade control instruction is equal to the total length of the received upgrade control instruction minus the length of the prefix;
the control bit of the upgrading control instruction is a mark of the upgrading module task;
the check bit of the upgrade control instruction is the same as the result obtained by bitwise XOR calculation according to the length, the control bit, the length of the upgrade package and the test of the upgrade package;
and the length of the upgrade package of the upgrade control instruction is within a preset range of the length of the upgrade package.
Further, after entering the upgrade mode, the method further includes:
and sending a module state reporting instruction to the Android terminal to inform the Android terminal that the temperature measuring module enters an upgrading mode.
And further, receiving an upgrade package sent by the APK, wherein the upgrade package is sent by the APK sub-package after the Android end receives a module state reporting instruction of the temperature measuring module end.
Further, before restarting the temperature measuring module, the method further comprises the following steps:
and verifying and storing an upgrade mark, an upgrade package length and an upgrade package of the upgrade control instruction in Flash.
Further, after the upgrade package is received, the method further includes:
judging whether the length of the received upgrade package is consistent with that in the upgrade control instruction; if not, returning to the error upgrade message, and returning to the step S1.
Further, after the upgrade package is received, the method further includes:
calculating the CRC checksum of each frame of data in the APP code region;
judging whether the CRC checksum of each frame data in the APP code area is consistent with the CRC checksum in the upgrading control command or not;
if not, returning to the error upgrade message, and returning to the step S1.
Further, the method also includes:
clearing the length of an upgrade package, CRC checksum and an upgrade flag stored in the Flash after upgrading is finished; and returning an upgrade success confirmation message.
In this application embodiment, in response to user's one-key upgrading operation instruction, temperature measurement module end receives the upgrading control instruction that APK sent, and when upgrading control instruction is correct, restart temperature measurement module end, the module end that awaits measuring restarts the back and clears out APP code area and get into the upgrading mode, has improved remote upgrading's stability.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a remote upgrade method according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terminology used in the embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the examples of this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise, and "a plurality" typically includes at least two.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
As shown in fig. 1, which is a flowchart of a stable remote upgrade method according to an embodiment of the present application, the method responds to a user one-key upgrade operation instruction, and causes a temperature measurement module end to execute the following steps:
s1: and receiving an upgrading control instruction sent by the APK.
The APK is an Android application installation package, and in the embodiment of the application, the APK is a program installation package for remotely upgrading a temperature measurement module.
After modifying a driver or a temperature measurement algorithm program of the temperature measurement module, a developer compiles and generates an upgrade file project.
The APK is stored at the Android end of the embodiment, a user can open the APK at the Android end, click 'one-key upgrading' after the APK is opened, and respond to one-key upgrading operation instructions of the user, and the APK sends upgrading control instructions to the temperature measuring module end. And responding to a one-key upgrading operation instruction of a user, the APK is responsible for analyzing project.
The temperature measuring module end is in communication connection with the Android end, and optionally can be connected through a USB or a remote connection. And after the user clicks 'one-key upgrading', the temperature measuring module end responds to a user one-key upgrading operation instruction and executes the method steps of the application embodiment.
The module code area of the temperature measurement module comprises a Boot loader code area and an App code area, wherein the Boot loader code area is used for remote upgrading and guiding to enter the App code area, codes stored in the App code area are the core of the temperature measurement module and comprise a drive of the temperature measurement module, a temperature measurement algorithm and the like.
S2: and judging whether the upgrading control instruction is correct or not.
In the embodiment of the application, the integrity and the correctness of the upgrading control instruction are verified by judging whether the upgrading control instruction is correct, so that the stability of remote upgrading is obviously improved.
The data structure of the upgrade control instruction is a leading word, a length, a control bit, an upgrade package length, an upgrade package check sum check bit.
Figure BDA0003021509240000051
In this embodiment of the present application, the determining whether the upgrade control instruction is correct specifically includes:
if the upgrade control instruction conforms to all upgrade instruction conditions, judging that the upgrade control instruction is correct;
and if the upgrading control instruction does not meet any upgrading instruction condition, judging that the upgrading control instruction is incorrect.
The upgrade instruction condition includes at least one of:
(1) the preamble is the same as the preamble fixed in the protocol. The protocol is a communication protocol of the temperature measurement module end and the Android end.
When the prefix is different from the prefix fixed in the protocol, the control instruction is determined to be an interfering instruction or a faulty instruction.
(2) The length is equal to the total length of the received upgrade control instruction minus the length of the prefix word; the length is equal to the total length of the control bit, the length of the upgrade package, the test of the upgrade package and the check bit.
(3) The control bit is a mark of an upgrading module task; as shown in the above table, 80,20 represent the upgrade flag. If the flag is not received, the task is not the upgrading task.
(4) The check bit is the same as the result obtained by bitwise XOR calculation according to the length, the control bit, the upgrade package length and the upgrade package check;
(5) the length of the upgrade package is within a preset range of the length of the upgrade package. The minimum threshold value and the maximum threshold value of the length of the upgrade package are respectively set in the temperature measurement module, and when the length is smaller than the set minimum threshold value or larger than the set maximum threshold value, the data frame is discarded.
Preferably, the upgrade instruction condition includes the above conditions (1) - (5).
Preferably, when judging whether the upgrade control instruction is correct, the upgrade instruction conditions (1) - (5) are judged in sequence, and when the previous condition is met, the next condition is judged. And when one of the conditions is not met, ending the judgment. For example: and (5) judging according to the sequence of (1) to (5), and if the condition (1) is met, continuing to judge the condition (2) until a certain condition is not met or all the conditions are met. Or the judgment is carried out in the order of (3), (1) (2), (4) and (5).
S3: and when the upgrading control instruction is correct, restarting the temperature measuring module end.
Before restarting the temperature measuring module end, the method further comprises the following steps: and verifying and storing an upgrade mark, an upgrade package length and an upgrade package of the upgrade control instruction in Flash.
In the embodiment of the application, the Flash is a Flash memory. The upgrade package check is a CRC (cyclic redundancy check) checksum, namely a cyclic redundancy check code. Preferably a CRC16 checksum, which is calculated by a calculation formula.
By storing the length of the upgrade package and the verification of the upgrade package in Flash, the integrity and the correctness of the transmitted data frame can be conveniently verified in the subsequent steps, so that the upgrade stability is further improved.
S4: and after restarting, judging whether an upgrading mark of the upgrading control instruction is written in, if so, clearing the APP code area and entering an upgrading mode.
Further, the upgrade method according to the embodiment of the present application, after entering the upgrade mode, further includes step S5:
and sending a module state reporting instruction to the Android terminal to inform the Android terminal that the temperature measuring module enters an upgrading mode.
Further, the upgrading method according to the embodiment of the present application further includes step S6:
and receiving an upgrade package sent by the APK, wherein the upgrade package is sent by APK sub-package after the Android end receives a module state reporting instruction of the temperature measuring module end.
Specifically, after the Android end receives a module state reporting instruction of the temperature measurement module end, the APK sub-package sends an unscented char type large array. After each packet is sent, the temperature measurement module end replies a confirmation message to inform the Android end that the data is received and written into Flash.
Further, the upgrade method according to the embodiment of the present application, after the upgrade package is received, further includes step S7:
judging whether the length of the received upgrade package is consistent with that in the upgrade control instruction; if not, returning to the error upgrade message, and returning to the step S1.
By the upgrade packet length check mechanism, whether the problems of frame missing, frame loss and the like of received data loss exist in the data transmission process can be ensured.
Further, the upgrade method according to the embodiment of the present application, after the upgrade package is received, further includes step S8:
calculating the CRC checksum of each frame of data in the APP code region;
judging whether the CRC checksum of each frame data in the APP code area is consistent with the CRC checksum in the upgrading control command or not;
if not, returning to the error upgrade message, and returning to the step S1.
By doing so, it can be effectively detected whether there is an error in the received data frame, for example, what needs to be transmitted is 0x12 and what is actually transmitted is 0x 10.
Further, the method of the embodiment of the present application further includes step S9:
after upgrading is finished, clearing the length of an upgrading packet, CRC (cyclic redundancy check) checksum and an upgrading mark stored in the Flash;
and returning an upgrade success confirmation message.
According to the embodiment of the application, through the step S7 and the step S8, errors encountered by upgrading can be effectively avoided.
In order to further avoid the problem of data frame errors. Preferably, after step S8, the method of the embodiment of the present application further includes the steps of:
s101: judging the upgrading state to be 'upgrading pre-success'; specifically, the judgment is performed by a Bootloader code area.
S102: clearing the upgrade package length, the CRC checksum and the upgrade flag stored in the Flash.
S103: and writing a flag bit into the Flash, wherein the flag bit is defined as a flag for completing upgrading.
Specifically, the flag bit flag is used to complete the upgrade at this time, and is defined as a flag for completing the upgrade.
Further, the method of the embodiment of the present application further includes:
restarting the temperature measurement module and entering a bootloader mode;
and when the upgrading mark is judged to be completed, initializing the data receiving channel. Specifically, after entering bootloader mode, a preset time is initialized, for example, 3 seconds in the embodiment of the present application.
Entering an app code area, judging whether the version number of the temperature measuring module is read or not,
if yes, clearing the upgrading completion mark and completing the whole upgrading process.
If not, controlling the temperature measuring module end to power on and off again, and sending the upgrading command again to upgrade the module again. Wherein, when the application reads the module version, the app runs normally. And when the version number cannot be read by the version of the application sending query module, judging that the App of the temperature measurement module does not run.
Further, the method of the embodiment of the present application further includes: after initializing the data receiving channel, monitoring whether an upgrade command is transmitted in real time, and restarting the upgrade when receiving the upgrade command.
In this application embodiment, in response to user's one-key upgrading operation instruction, temperature measurement module end receives the upgrading control instruction that APK sent, and when upgrading control instruction is correct, restart temperature measurement module end, the module end that awaits measuring restarts the back and clears out APP code area and get into the upgrading mode, has improved remote upgrading's stability.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A stable remote upgrading method is characterized in that in response to a one-key upgrading operation instruction of a user, the temperature measuring module end executes the steps of:
s1: receiving an upgrading control instruction sent by an APK;
s2: judging whether the upgrading control instruction is correct or not;
s3: when the upgrading control instruction is correct, restarting the temperature measuring module end;
s4: and after restarting, judging whether an upgrading mark of the upgrading control instruction is written in, if so, clearing the APP code area and entering an upgrading mode.
2. The method of claim 1, wherein:
the data structure of the upgrade control instruction is a leading word, a length, a control bit, an upgrade package length, an upgrade package check sum check bit.
3. The method according to claim 1, wherein the step S2 specifically includes:
if the upgrade control instruction conforms to all upgrade instruction conditions, judging that the upgrade control instruction is correct;
and if the upgrading control instruction does not meet any upgrading instruction condition, judging that the upgrading control instruction is incorrect.
4. The method of claim 3, wherein the upgrade instruction condition comprises at least one of:
the leading word of the upgrading control instruction is the same as the fixed leading word in the protocol;
the length of the upgrade control instruction is equal to the total length of the received upgrade control instruction minus the length of the prefix;
the control bit of the upgrading control instruction is a mark of the upgrading module task;
the check bit of the upgrade control instruction is the same as the result obtained by bitwise XOR calculation according to the length, the control bit, the length of the upgrade package and the test of the upgrade package;
and the length of the upgrade package of the upgrade control instruction is within a preset range of the length of the upgrade package.
5. The method of claim 1, wherein upon entering the upgrade mode, the method further comprises:
and sending a module state reporting instruction to the Android terminal to inform the Android terminal that the temperature measuring module enters an upgrading mode.
6. The method of claim 1, further comprising:
and receiving an upgrade package sent by the APK, wherein the upgrade package is sent by APK sub-package after the Android end receives a module state reporting instruction of the temperature measuring module end.
7. The method of claim 1, further comprising, before restarting the thermometry module side:
and verifying and storing an upgrade mark, an upgrade package length and an upgrade package of the upgrade control instruction in Flash.
8. The method of claim 1, wherein after the upgrade package is received, the method further comprises:
judging whether the length of the received upgrade package is consistent with that in the upgrade control instruction;
if not, returning to the error upgrade message, and returning to the step S1.
9. The method of claim 1, wherein after the upgrade package is received, the method further comprises:
calculating a CRC checksum for each frame of data in the APP code region,
judging whether the CRC checksum of each frame data in the APP code area is consistent with the CRC checksum in the upgrading control command or not;
if not, returning to the error upgrade message, and returning to the step S1.
10. The method of claim 1, further comprising:
clearing the length of an upgrade package, CRC checksum and an upgrade flag stored in the Flash after upgrading is finished; and returning an upgrade success confirmation message.
CN202110403986.7A 2021-04-15 2021-04-15 Stable remote upgrading method Pending CN112988197A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110403986.7A CN112988197A (en) 2021-04-15 2021-04-15 Stable remote upgrading method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110403986.7A CN112988197A (en) 2021-04-15 2021-04-15 Stable remote upgrading method

Publications (1)

Publication Number Publication Date
CN112988197A true CN112988197A (en) 2021-06-18

Family

ID=76340472

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110403986.7A Pending CN112988197A (en) 2021-04-15 2021-04-15 Stable remote upgrading method

Country Status (1)

Country Link
CN (1) CN112988197A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108337120A (en) * 2018-02-01 2018-07-27 北京安控科技股份有限公司 A kind of remote upgrade method of internet-of-things terminal equipment
CN109032615A (en) * 2018-06-06 2018-12-18 咕咚网络(北京)有限公司 A kind of on-line software updating method for Wireless Networking door lock

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108337120A (en) * 2018-02-01 2018-07-27 北京安控科技股份有限公司 A kind of remote upgrade method of internet-of-things terminal equipment
CN109032615A (en) * 2018-06-06 2018-12-18 咕咚网络(北京)有限公司 A kind of on-line software updating method for Wireless Networking door lock

Similar Documents

Publication Publication Date Title
CN109189445B (en) Method for upgrading program of equipment of Internet of things
CN106569847B (en) Method for vehicle-mounted system to realize IAP remote upgrade based on mobile network
CN106843942B (en) Wearable device and firmware upgrading method thereof
CN106250192B (en) Software upgrading method and system of upper computer
CN102622253B (en) A kind of method of single-chip microcomputer and online upgrading thereof
US6715106B1 (en) Bios corruption detection system and method
CN109117168A (en) Unmanned plane firmware update, device, unmanned plane and storage medium
CN111190629B (en) Embedded terminal upgrading software package and analysis method thereof
CN111813428A (en) Method and device for upgrading terminal firmware, electronic equipment and storage medium
CN111176884B (en) SEC (SEC) verification method and device for FPGA (field programmable Gate array) configuration memory
CN114281394A (en) Method, system, equipment and medium for fast on-line upgrading program
CN106775778B (en) Program updating identification method and system in embedded program development
CN112015447B (en) System updating method and device of electronic equipment, electronic equipment and storage medium
CN112540725A (en) Nonvolatile data storage method, embedded system and storage medium
CN112631628A (en) Singlechip upgrading method, singlechip and storage medium
CN104133743B (en) A kind of by burning file to the method for EMMC chip and device
CN114489732A (en) Method and device for updating FPGA (field programmable Gate array) firmware of equipment and electronic equipment
CN117573181A (en) Power distribution terminal upgrading method and device, storage medium and electronic equipment
CN111459496B (en) Method for generating tamper-proof program file and method for upgrading equipment
CN112988197A (en) Stable remote upgrading method
CN112286532A (en) Method and system for realizing front-end code formatting based on ESLint and Prettier
US11586504B2 (en) Electronic apparatus and boot method thereof
CN112925546B (en) Multistage verification method and system for preventing vehicle-mounted ECU from refreshing errors
CN111124742B (en) Flash data verification method, flash controller, storage medium and device
CN111506330A (en) Program updating method and device, star affair computer and storage medium

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