CN112559349A - Program running method and device - Google Patents

Program running method and device Download PDF

Info

Publication number
CN112559349A
CN112559349A CN202011487728.3A CN202011487728A CN112559349A CN 112559349 A CN112559349 A CN 112559349A CN 202011487728 A CN202011487728 A CN 202011487728A CN 112559349 A CN112559349 A CN 112559349A
Authority
CN
China
Prior art keywords
program
running
area
state
determined
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011487728.3A
Other languages
Chinese (zh)
Other versions
CN112559349B (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.)
He'an Technology Co ltd
Original Assignee
He'an 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 He'an Technology Co ltd filed Critical He'an Technology Co ltd
Priority to CN202011487728.3A priority Critical patent/CN112559349B/en
Publication of CN112559349A publication Critical patent/CN112559349A/en
Application granted granted Critical
Publication of CN112559349B publication Critical patent/CN112559349B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution

Abstract

The application is applicable to the technical field of program operation, and provides a program operation and operation device, wherein the operation method comprises the following steps: respectively storing an upgrading version program and a non-upgrading version program in a backup area; determining the current stage according to a preset identifier; checking the current state of the running program in the running area; if the current state of the running program is determined to be an abnormal state, transferring the program with the first running state in the backup area as a normal state to the running area, and running the program in the running area; according to the scheme, before the program is operated, the program of the upgrading version and the program of the non-upgrading version are stored in advance by using the free storage space of the program storage. When the running program is abnormal, the program with normal running state is selected from the prestored upgrading version program and the prestored non-upgrading version program to run, thereby ensuring the seamless running of the program and preventing the conditions that the equipment cannot work normally due to running pause and the like.

Description

Program running method and device
Technical Field
The present application belongs to the technical field of program operation, and in particular, relates to a program operation method, an operation apparatus, a terminal device, and a computer-readable storage medium.
Background
A program (program) is a collection of command sequences written in a computer language to achieve a specific goal or to solve a specific problem. However, in the running process of the program, BUGs (BUGs) or parameter initialization errors are often easy to occur, which causes the product to crash. In some real-time application scenarios, for example: product programs such as the intelligent street lamp need to be operated in real time, and if errors occur in the program operation process, the intelligent street lamp can not work normally. This is a technical problem which needs to be solved urgently.
Disclosure of Invention
In view of this, embodiments of the present application provide a program running method, a running apparatus, a terminal device, and a computer-readable storage medium, which can solve the technical problem that if an error occurs in the program running process, the intelligent street lamp may not work normally.
A first aspect of an embodiment of the present application provides an operation method of a program, where the operation method includes:
respectively storing an upgrading version program and a non-upgrading version program in a backup area;
determining the current stage according to a preset identifier; the current stage comprises a trial operation stage and a non-trial operation stage;
checking the current state of the running program in the running area; the operation area and the backup area are storage areas divided in advance by a program memory;
if the current state of the running program is determined to be an abnormal state, transferring the program with the first running state in the backup area as a normal state to the running area, and running the program in the running area; the abnormal state includes that the second running state of the running program in the running area is abnormal or the running program in the running area is not a target version program corresponding to the current stage.
A second aspect of an embodiment of the present application provides an execution apparatus of a program, including:
the storage unit is used for respectively storing an upgrading version program and a non-upgrading version program in the backup area;
the first judging unit is used for determining the current stage according to the preset identification; the current stage comprises a trial operation stage and a non-trial operation stage;
the checking unit is used for checking the current state of the running program in the running area; the operation area and the backup area are storage areas divided in advance by a program memory;
a second determining unit, configured to transfer the program in which the first operating state in the backup area is normal to the operating area and operate the program in the operating area if it is determined that the current state of the operating program is an abnormal state; the abnormal state includes that the second running state of the running program in the running area is abnormal or the running program in the running area is not a target version program corresponding to the current stage.
A third aspect of embodiments of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method according to the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program, when executed by a processor, implements the steps of the method according to the first aspect.
Compared with the prior art, the embodiment of the application has the advantages that: the method comprises the steps of respectively storing an upgrading version program and a non-upgrading version program in a backup area; determining the current stage according to a preset identifier; the current stage comprises a trial operation stage and a non-trial operation stage; checking the current state of the running program in the running area; the operation area and the backup area are storage areas divided in advance by a program memory; if the current state of the running program is determined to be an abnormal state, transferring the program with the first running state in the backup area as a normal state to the running area, and running the program in the running area; the abnormal state includes that the second running state of the running program in the running area is abnormal or the running program in the running area is not a target version program corresponding to the current stage. According to the scheme, before the program is operated, the program of the upgrading version and the program of the non-upgrading version are stored in advance by using the free storage space of the program storage. When the running program is abnormal, the program with normal running state is selected from the prestored upgrading version program and the prestored non-upgrading version program to run, thereby ensuring the seamless running of the program and preventing the conditions that the equipment cannot work normally due to running pause and the like.
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 embodiments or the related technical descriptions will be briefly described below, and it is obvious that the drawings in the following description are only 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 shows a schematic flow chart of a method of operating a program provided herein;
FIG. 2 is a schematic diagram of a FLASH partition provided in the present application;
FIG. 3 shows a schematic flow chart of the obtain upgrade version program provided herein;
FIG. 4 is a specific schematic flowchart of step 104 in a method for running a program provided by the present application;
FIG. 5 is a flow chart illustrating a specific schematic diagram of step 104 in a method for running a program provided by the present application;
FIG. 6 is a flow chart showing a specific schematic of step 104 in a method for running a program provided by the present application;
FIG. 7 is a flowchart illustrating a specific schematic diagram of step 104 in a method for operating a program provided by the present application;
FIG. 8 shows a schematic flow chart diagram of another method of operation of a program as provided herein;
FIG. 9 is a schematic diagram of an apparatus for running a program provided herein;
fig. 10 is a schematic diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The intelligent street lamp application method is suitable for various application scenes, and in order to better explain the technical scheme of the application, the application uses the application scene of the intelligent street lamp as an example, and explains the scheme.
The intelligent street lamp is street lamp equipment with network access capability, and can realize functions such as remote upgrading. In the process of upgrading or normal operation of the intelligent street lamp, due to the fact that BUG (BUG) or parameter initialization error and the like easily occur, the intelligent street lamp cannot normally work, and a series of associated reactions are caused. Therefore, the present application provides a program running method, an apparatus, a terminal device, and a computer-readable storage medium, which can solve the above technical problems.
Referring to fig. 1, fig. 1 shows a schematic flow chart of a method for running a program provided in the present application.
As shown in fig. 1, the method may include the steps of:
step 101, storing an upgrade version program and a non-upgrade version program in a backup area respectively.
The backup area refers to a storage area divided in advance in the program memory. The program Memory includes, but is not limited to, a combination of one or more memories such as a FLASH Memory (FLASH Memory) and a Random Access Memory (RAM). In order to better explain the technical scheme of the application, the application takes FLASH as an example to explain the technical scheme of the application. Among them, FLASH is a Non-Volatile (Non-Volatile) memory, which can hold data for a long time even without current supply, and is often applied to a single chip for running programs.
The method partitions the FLASH to respectively store the upgrading version program and the non-upgrading version program. It is understood that the non-upgraded version program is an old version program.
For example, please refer to fig. 2 for FLASH partition, and fig. 2 shows a schematic diagram of a FLASH partition provided in the present application. As shown in fig. 2, in the present application, FLASH is divided into four storage areas, which are: a "Bootloader" region, an "APP-0" region, an "APP-1" region, and an "APP-2" region. The Bootloader area is a storage area of a bootstrap program, and the bootstrap program is used for loading other programs (namely selecting APP-1 or APP-2 to run) so as to realize the technical scheme of the application. The "APP-0" area is the area where the program runs, i.e., the run area. The APP-1 area is used for storing an upgraded version program or a non-upgraded version program. The APP-2 area is used for storing an upgraded version program or a non-upgraded version program. Wherein the "APP-1" region and the "APP-2" region are used for storing different programs. Namely, when the program stored in the APP-1 area is an upgraded program, the program stored in the APP-2 area is a non-upgraded program. And when the program stored in the APP-1 area is a non-upgrade version program, the program stored in the APP-2 area is an upgrade version program. It should be noted that, for the FLASH partitions, the above description is only an example, and the number and the location of the FLASH partitions are not limited at all, and the number of the FLASH partitions may be more or less in an actual application scenario.
As an optional embodiment of the present application, in order to better distinguish between an upgraded version program and a non-upgraded version program, the present application assigns different identifiers to the upgraded version program and the non-upgraded version program, and distinguishes between the upgraded version program and the non-upgraded version program according to the identifiers.
Before explaining the technical scheme of the present application, in order to better understand the technical scheme of the present application, a short description is given, where an interaction flow between the terminal device and the platform when the terminal device upgrades the running program: referring to fig. 3, fig. 3 shows a schematic flowchart of the procedure for obtaining an upgraded version provided by the present application. As shown in fig. 3, the terminal device interacts with the platform to download the upgrade version program, and the interaction process is as follows: the platform queries the current version of the running program (the running program refers to the program currently running) in the terminal device. And the terminal equipment returns the current version of the running program to the platform. And the platform judges whether the current version of the running program is the most upgraded version, and if the current version is not the most upgraded version, the platform sends an upgraded version notification to the terminal equipment. And after receiving the update version notification, the terminal equipment sends a response to the platform to inform that the notification is received. The terminal equipment selects an upgrade version program storage area (the upgrade version program storage area and the non-upgrade version program storage area are preset areas) according to the storage area of the running program, erases data in the upgrade version program storage area, and stores parameters of the upgrade version program (for example, segmentation parameters and the like, wherein the segmentation parameters refer to serial numbers corresponding to different segmented data packets of the upgrade version program). And the terminal equipment requests the platform for the segmented data packet (serial number 0) of the version upgrading program. When the transmission of one of the segmented data packets is interrupted, only the segmented data packet needs to be retransmitted after the interruption, and the whole data packet does not need to be retransmitted. When the terminal equipment receives the segmented data packet (serial number 0), the header information in the segmented data packet (serial number 0) is checked so as to ensure the legality of the data packet. After determining the validity of the data packet, the terminal device requests the platform for a segmented data packet [ number 1 ] of the version upgrading program. And the platform returns the segmented data packets (serial number 1) to the terminal equipment, and by analogy, N segmented data packets are obtained. And the terminal equipment checks the data packet and stores the parameters of the data packet to obtain an upgrade version program, and uploads the download state of the data packet to the platform. And the platform responds to the downloading state sent by the terminal equipment. And the terminal equipment sets an operation state identifier and an upgrade version program identifier and restarts the system. And the terminal equipment logs in the platform. The platform responds to the login request of the terminal equipment. And the terminal equipment starts a trial operation stage, modifies the identification of the operation program (namely, the identification of the upgrade version program is a non-upgrade version program) after the trial operation is successful, upgrades the program successfully and uploads the upgrade result. And the platform responds to the upgrading result. Wherein, the execution sequence of the non-commissioning phase can be before or after the commissioning phase.
It should be noted that the header information in the segmented data packet [ serial number 0 ] includes, but is not limited to, a company identifier, a device type, a Micro Control Unit (MCU) model, a hardware version, a file type, a file version, a file content length, a Cyclic Redundancy Check (CRC) of the file content, a CRC of the file header, and the file content. And (3) company identification: the street lamp controller is used for judging whether the street lamp controller is a company file or not, the equipment type is used for judging whether the street lamp controller is an upgrade file of the product or not, the MCU type is used for judging whether an upgrade version program is matched with an MCU of the street lamp controller or not, the hardware version is used for judging the hardware version matched with the upgrade version program, the file type comprises a configuration file, an APP program and a Bootloader program, the file version is used for distinguishing the version numbers of different files, the file content CRC is used for checking the CRC value of the file content, and the file content comprises configuration data, application program data and Bootloader program data.
For the trial run stage and the non-trial run stage, the running logic of the program is as follows:
before the operation program is operated in the operation area, the upgrading version program and the non-upgrading version program are respectively stored in the corresponding backup areas (namely an APP-1 area and an APP-2 area).
Step 102, determining a current stage according to a preset identifier; the current phase comprises a commissioning phase and a non-commissioning phase.
When the terminal device receives the upgrade version program, it needs to perform a commissioning (i.e. enter a commissioning phase). And when the program of the upgrade version is not received, the normal starting is carried out without trial operation (namely, entering a non-trial operation stage). Therefore, in order to distinguish the two stages, the two stages are distinguished by the preset identifier.
103, checking the current state of the running program in the running area; the operation area and the backup area are storage areas divided in advance by a program memory.
The operation area refers to a storage area divided in advance in the program memory for operating the program.
And when the current stage is determined to be a trial operation stage, judging whether the operation program in the operation area is an upgrade version program. And if the running program in the running area is determined not to be the upgraded program, determining that the current state of the running program is an abnormal state. And if the running program in the running area is determined to be the upgraded program, checking a second running state of the running program (namely the upgraded program) in the running area. And if the second running state is determined to be normal, determining that the current state of the running program is a normal state, and continuing to run the running program without executing subsequent steps. And if the second running state is determined to be abnormal, determining that the current state of the running program is an abnormal state, and executing the subsequent steps.
And when the current stage is determined to be a non-trial operation stage, judging whether the operation program in the operation area is a non-upgrade version program. And if the running program in the running area is determined not to be the non-upgrade version program, determining that the current state of the running program is an abnormal state. And if the running program in the running area is determined to be the non-upgrade version program, checking a second running state of the running program (namely the non-upgrade version program) in the running area. And if the second running state is determined to be normal, determining that the current state of the running program is a normal state, and continuing to run the running program without executing subsequent steps. And if the second running state is determined to be abnormal, determining that the current state of the running program is an abnormal state, and executing the subsequent steps.
The method for checking the running state of the program comprises one or more of determining whether an error exists in the running log, determining whether the running result is correct or determining whether an error code exists.
Step 104, if it is determined that the current state of the running program is an abnormal state, transferring the program with a first running state in the backup area as a normal state to the running area, and running the program in the running area; the abnormal state includes that the second running state of the running program in the running area is abnormal or the running program in the running area is not a target version program corresponding to the current stage.
In order to enable the running program in the normal state to continuously run in the running area, when the current state of the running program in the running area is determined to be the abnormal state, the program with the first running state in the backup area being the normal state is transferred to the running area, and the program in the running area is run.
The abnormal state includes, but is not limited to, that the second running state of the running program in the running area is abnormal, or that the running program in the running area is not a target version program corresponding to the current stage. And the target version program corresponding to the commissioning phase is an upgraded version program. And the target version program corresponding to the non-trial operation stage is a non-upgrading version program.
Different stages and different abnormal states correspond to different execution steps:
as an optional embodiment of the present application, when the current stage is a trial-run stage, the abnormal state is that the second running state of the running program in the running area is abnormal, and the target version program corresponding to the trial-run stage is an upgraded version program, step 104 includes the following steps 1041 to 1044. Referring to fig. 4, fig. 4 is a specific schematic flowchart illustrating step 104 in an operating method of a program provided by the present application.
Step 1041, if it is determined that the running program in the running area is the upgraded version program, determining whether a second running state of the running program in the running area is normal.
Since the terminal device may have an error of the initial parameter during the initial operation, and the operating program in the operating area is not the upgraded program, it needs to be determined whether the operating program in the operating area is the upgraded program.
And if the running program in the running area is determined to be the upgraded program, determining whether a second running state of the running program in the running area is normal.
And if the second running state of the running program in the running area is determined to be normal, running the program in the running area.
And if the running program in the running area is determined not to be the upgraded version program, executing the steps 104a to 104 d.
Step 1042, if it is determined that the second running state of the running program in the running area is abnormal, checking the third running state of the upgraded version program in the backup area.
Step 1043, if it is determined that the third operating state is normal, transferring the upgraded version program in the backup area to the operating area, and operating the program in the operating area.
Step 1044 of checking a fourth operating status of the non-upgraded version program in the backup area if it is determined that the third operating status is abnormal.
Step 1045, if it is determined that the fourth operating state is normal, transferring the non-upgraded version program in the backup area to the operating area, and operating the program in the operating area.
It can be understood that, since the present implementation is a trial operation stage, when the program in the backup area is selected, it is preferentially determined whether the third operation state of the upgraded program is normal, and then the upgraded program is preferentially selected as the operation program in the operation area.
As an optional embodiment of the present application, when the current stage is a commissioning stage, and the abnormal state is that an operating program in an operating area is not a target version program corresponding to the current stage; when the target version program corresponding to the commissioning phase is the upgraded version program, the step 104 includes the following steps 104a to 104 d. Referring to fig. 5, fig. 5 is a specific schematic flowchart illustrating step 104 in an operating method of a program provided by the present application.
Step 104a, if it is determined that the running program in the running area is not the upgraded version program, checking a third running state of the upgraded version program in the backup area.
And 104b, if the third running state is determined to be normal, transferring the upgraded version program in the backup area to the running area, and running the program in the running area.
And 104c, if the third running state is determined to be abnormal, checking a fourth running state of the non-upgrade version program in the backup area.
And step 104d, if it is determined that the fourth operating state is normal, transferring the non-upgraded program in the backup area to the operating area, and operating the program in the operating area.
As an optional embodiment of the present application, when the current stage is the non-commissioning stage, the abnormal state is that the second running state of the running program in the running area is abnormal, and the target version program corresponding to the non-commissioning stage is a non-upgraded version program, step 104 includes the following steps 104e to 104 h. Referring to fig. 6, fig. 6 is a specific schematic flowchart illustrating step 104 in an operating method of a program provided by the present application.
And step 104e, if it is determined that the running program in the running area is the non-upgrade version program, determining whether a second running state of the running program in the running area is normal.
Since the terminal device may have an error of the initial parameter during initial operation, which causes the operating program in the operating area not to be the non-upgraded program, it is necessary to determine whether the operating program in the operating area is the non-upgraded program.
And if the running program in the running area is determined to be the non-upgrade version program, determining whether a second running state of the running program in the running area is normal.
And if the second running state of the running program in the running area is determined to be normal, running the program in the running area.
And if the running program in the running area is determined not to be the non-upgrade version program, executing the steps 104j to 104 m.
And step 104f, if the second running state of the running program in the running area is determined to be abnormal, checking a fourth running state of the non-upgrade version program in the backup area.
And step 104g, if the fourth running state is determined to be normal, transferring the non-upgraded program in the backup area to the running area, and running the program in the running area.
And 104h, if the fourth running state is determined to be abnormal, checking the third running state of the upgraded version program in the backup area.
And step 104i, if the third running state is determined to be normal, transferring the upgraded version program in the backup area to the running area, and running the program in the running area.
It can be understood that, since the implementation is a non-trial operation stage, when the program in the backup area is selected, it is preferentially determined whether the fourth operation state of the non-upgrade version program is normal, and then the non-upgrade version program is preferentially selected as the operation program in the operation area.
As an optional embodiment of the present application, when the current stage is the non-commissioning stage, the abnormal state is that the second running state of the running program in the running area is abnormal, and the target version program corresponding to the non-commissioning stage is a non-upgraded version program, step 104 includes the following steps 104i to 104 n. Referring to fig. 7, fig. 7 is a specific schematic flowchart illustrating step 104 in an operating method of a program provided by the present application.
And 104j, if the operating program in the operating area is determined not to be the non-upgrade version program, checking a fourth operating state of the non-upgrade version program in the backup area.
And 104k, if the fourth running state is determined to be normal, transferring the non-upgraded program in the backup area to the running area, and running the program in the running area.
And 104n, if the fourth running state is determined to be abnormal, checking the third running state of the upgraded version program in the backup area.
And 104m, if the third running state is determined to be normal, transferring the upgraded version program in the backup area to the running area, and running the program in the running area.
It can be understood that, since the implementation is a non-trial operation stage, when the program in the backup area is selected, it is preferentially determined whether the fourth operation state of the non-upgrade version program is normal, and then the non-upgrade version program is preferentially selected as the operation program in the operation area.
It should be noted that, in this embodiment, the free storage space of the program memory is used to store the programs of the two versions, so that when the operation fails, the program can be switched to the upgraded version program or the non-upgraded version program at will, thereby achieving the effect of double insurance and ensuring the seamless operation of the program.
In the embodiment, an upgrade version program and a non-upgrade version program are respectively stored in a backup area; determining the current stage according to a preset identifier; the current stage comprises a trial operation stage and a non-trial operation stage; checking the current state of the running program in the running area; the operation area and the backup area are storage areas divided in advance by a program memory; if the current state of the running program is determined to be an abnormal state, transferring the program with the first running state in the backup area as a normal state to the running area, and running the program in the running area; the abnormal state includes that the second running state of the running program in the running area is abnormal or the running program in the running area is not a target version program corresponding to the current stage. According to the scheme, before the program is operated, the program of the upgrading version and the program of the non-upgrading version are stored in advance by using the free storage space of the program storage. When the running program is abnormal, the program with normal running state is selected from the prestored upgrading version program and the prestored non-upgrading version program to run, thereby ensuring the seamless running of the program and preventing the conditions that the equipment cannot work normally due to running pause and the like.
Optionally, on the basis of the embodiment shown in fig. 1, before step 101, the following steps are further included, please refer to fig. 8, and fig. 8 shows a schematic flowchart of an operation method of another program provided by the present application.
Step 801, acquiring a segmentation parameter of the upgrade version program; the section parameters refer to sequence numbers corresponding to different section data packets of the upgraded version program.
In order to prevent the whole upgrade packet data from being retransmitted when transmission is interrupted, the embodiment transmits the upgrade version program data packets in segments (distinguished by different sequence numbers).
The terminal device obtains the segmentation parameters sent by the platform, and executes the steps 702 to 703.
And step 802, sequentially obtaining the different segment data packets of the upgraded version program according to the sequence numbers corresponding to the different segment data packets.
Step 803, the different segmented data packets are spliced to obtain the upgraded version program.
In the embodiment, the section parameters of the upgraded version program are obtained; the segmentation parameters refer to sequence numbers corresponding to different segmented data packets of the upgraded version program; sequentially acquiring the different segmented data packets of the upgraded version program according to the sequence numbers corresponding to the different segmented data packets; and splicing the different segmented data packets to obtain the upgraded version program. By the scheme, the situation that the whole upgrade packet data needs to be retransmitted when transmission is interrupted is prevented, and transmission resources are saved.
Fig. 9 shows a schematic diagram of an apparatus for running a program according to the present application, where fig. 9 shows a schematic diagram of an apparatus for running a program according to the present application, and the apparatus for running a program shown in fig. 9 includes:
a storage unit 91 for storing an upgraded version program and a non-upgraded version program in the backup area, respectively;
a first judging unit 92, configured to determine a current stage according to a preset identifier; the current stage comprises a trial operation stage and a non-trial operation stage;
a checking unit 93 configured to check a current state of the running program in the running area; the operation area and the backup area are storage areas divided in advance by a program memory;
a second determining unit 94, configured to transfer the program in the backup area whose first operating state is normal to the operating area and operate the program in the operating area if it is determined that the current state of the operating program is an abnormal state; the abnormal state includes that the second running state of the running program in the running area is abnormal or the running program in the running area is not a target version program corresponding to the current stage.
The program running device provided by the application stores an upgrade version program and a non-upgrade version program in a backup area respectively; determining the current stage according to a preset identifier; the current stage comprises a trial operation stage and a non-trial operation stage; checking the current state of the running program in the running area; the operation area and the backup area are storage areas divided in advance by a program memory; if the current state of the running program is determined to be an abnormal state, transferring the program with the first running state in the backup area as a normal state to the running area, and running the program in the running area; the abnormal state includes that the second running state of the running program in the running area is abnormal or the running program in the running area is not a target version program corresponding to the current stage. According to the scheme, before the program is operated, the program of the upgrading version and the program of the non-upgrading version are stored in advance by using the free storage space of the program storage. When the running program is abnormal, the program with normal running state is selected from the prestored upgrading version program and the prestored non-upgrading version program to run, thereby ensuring the seamless running of the program and preventing the conditions that the equipment cannot work normally due to running pause and the like.
Fig. 10 is a schematic diagram of a terminal device according to an embodiment of the present invention. As shown in fig. 10, a terminal device 100 of this embodiment includes: a processor 1001, a memory 1002 and a computer program 1003, e.g. a running program of a program, stored in said memory 1002 and being executable on said processor 1001. When the processor 1001 executes the computer program 1003, the steps in the above-described operation method embodiment of each program, for example, steps 101 to 104 shown in fig. 1, are implemented. Alternatively, the processor 1001, when executing the computer program 1003, implements the functions of the units in the above-described device embodiments, for example, the functions of the units 91 to 94 shown in fig. 9.
Illustratively, the computer program 1003 may be divided into one or more units, which are stored in the memory 1002 and executed by the processor 1001 to implement the present invention. The one or more units may be a series of computer program instruction segments capable of performing specific functions, which are used for describing the execution process of the computer program 1003 in the terminal device 100. For example, the computer program 1003 may be divided into an acquisition unit and a calculation unit, and the specific functions of the units are as follows:
the storage unit is used for respectively storing an upgrading version program and a non-upgrading version program in the backup area;
the first judging unit is used for determining the current stage according to the preset identification; the current stage comprises a trial operation stage and a non-trial operation stage;
the checking unit is used for checking the current state of the running program in the running area; the operation area and the backup area are storage areas divided in advance by a program memory;
a second determining unit, configured to transfer the program in which the first operating state in the backup area is normal to the operating area and operate the program in the operating area if it is determined that the current state of the operating program is an abnormal state; the abnormal state includes that the second running state of the running program in the running area is abnormal or the running program in the running area is not a target version program corresponding to the current stage.
The terminal device may include, but is not limited to, a processor 1001 and a memory 1002. Those skilled in the art will appreciate that fig. 10 is merely an example of one type of terminal device 100 and is not intended to limit one type of terminal device 100 and may include more or fewer components than shown, or some components may be combined, or different components, for example, the one type of terminal device may also include input-output devices, network access devices, buses, etc.
The camera module 1000 is configured to capture a plurality of biased images in the same scene or capture a plurality of subsequent images in the same scene.
The Processor 1001 may be a Central Processing Unit (CPU), other 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, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 1002 may be an internal storage unit of the terminal device 100, such as a hard disk or a memory of the terminal device 100. The memory 1002 may also be an external storage device of the terminal device 100, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the terminal device 100. Further, the memory 1002 may also include both an internal storage unit and an external storage device of the terminal device 100. The memory 1002 is used for storing the computer programs and other programs and data required by the kind of terminal equipment. The memory 1002 may also be used to temporarily store data that has been output or is to be output.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in the above-mentioned method embodiments.
The embodiments of the present application provide a computer program product, which when running on a mobile terminal, enables the mobile terminal to implement the steps in the above method embodiments when executed.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing apparatus/terminal apparatus, a recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signal, telecommunication signal, and software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will 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.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/network device and method may be implemented in other ways. For example, the above-described apparatus/network device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. 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.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to monitoring ". Similarly, the phrase "if it is determined" or "if [ a described condition or event ] is monitored" may be interpreted depending on the context to mean "upon determining" or "in response to determining" or "upon monitoring [ a described condition or event ]" or "in response to monitoring [ a described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A program execution method, comprising:
respectively storing an upgrading version program and a non-upgrading version program in a backup area;
determining the current stage according to a preset identifier; the current stage comprises a trial operation stage and a non-trial operation stage;
checking the current state of the running program in the running area; the operation area and the backup area are storage areas divided in advance by a program memory;
if the current state of the running program is determined to be an abnormal state, transferring the program with the first running state in the backup area as a normal state to the running area, and running the program in the running area; the abnormal state includes that the second running state of the running program in the running area is abnormal or the running program in the running area is not a target version program corresponding to the current stage.
2. The operating method according to claim 1, wherein when the current stage is a trial operation stage, and the abnormal state is an abnormality in a second operating state of the program in the operating area; the target version program corresponding to the commissioning phase is an upgraded version program;
if it is determined that the current state of the running program is an abnormal state, transferring the program with the first running state in the backup area as a normal state to the running area, and running the program in the running area, including:
if the running program in the running area is determined to be the upgraded program, determining whether a second running state of the running program in the running area is normal;
if the second running state of the running program in the running area is determined to be abnormal, checking a third running state of the upgraded version program in the backup area;
if the third running state is determined to be normal, transferring the upgraded version program in the backup area to the running area, and running the program in the running area;
if the third running state is determined to be abnormal, verifying a fourth running state of the non-upgrade version program in the backup area;
and if the fourth running state is determined to be normal, transferring the non-upgraded program in the backup area to the running area, and running the program in the running area.
3. The operating method according to claim 1, wherein when the current stage is a trial operation stage, and the abnormal state is a case where an operating program in the operating area is not a target version program corresponding to the current stage; the target version program corresponding to the commissioning phase is an upgraded version program;
if it is determined that the current state of the running program is an abnormal state, transferring the program with the first running state in the backup area as a normal state to the running area, and running the program in the running area, including:
if the running program in the running area is determined not to be the upgrading version program, checking a third running state of the upgrading version program in the backup area;
if the third running state is determined to be normal, transferring the upgraded version program in the backup area to the running area, and running the program in the running area;
if the third running state is determined to be abnormal, verifying a fourth running state of the non-upgrade version program in the backup area;
and if the fourth running state is determined to be normal, transferring the non-upgraded program in the backup area to the running area, and running the program in the running area.
4. The operating method according to claim 1, wherein when the current stage is the non-trial operation stage, and the abnormal state is an abnormality in a second operation state of the program in the operation area; the target version program corresponding to the non-trial operation stage is a non-upgrade version program;
if it is determined that the current state of the running program is an abnormal state, transferring the program with the first running state in the backup area as a normal state to the running area, and running the program in the running area, including:
if the running program in the running area is determined to be the non-upgrade version program, determining whether a second running state of the running program in the running area is normal;
if the second running state of the running program in the running area is determined to be abnormal, checking a fourth running state of the non-upgraded program in the backup area;
if the fourth running state is determined to be normal, transferring the non-upgraded version program in the backup area to the running area, and running the program in the running area;
if the fourth running state is determined to be abnormal, checking a third running state of the upgraded version program in the backup area;
and if the third running state is determined to be normal, transferring the upgraded version program in the backup area to the running area, and running the program in the running area.
5. The operating method according to claim 1, wherein when the current stage is the non-commissioning stage and the abnormal state is that the operating program in the operating area is not a target version program corresponding to the current stage; the target version program corresponding to the non-trial operation stage is a non-upgrade version program;
if it is determined that the current state of the running program is an abnormal state, transferring the program with the first running state in the backup area as a normal state to the running area, and running the program in the running area, including:
if the running program in the running area is determined not to be the non-upgrade version program, verifying a fourth running state of the non-upgrade version program in the backup area;
if the fourth running state is determined to be normal, transferring the non-upgraded version program in the backup area to the running area, and running the program in the running area;
if the fourth running state is determined to be abnormal, checking a third running state of the upgraded version program in the backup area;
and if the third running state is determined to be normal, transferring the upgraded version program in the backup area to the running area, and running the program in the running area.
6. The operating method according to claim 1, wherein before storing the upgraded version program and the non-upgraded version program in the backup area, respectively, further comprising:
acquiring the segmentation parameters of the upgraded version program; the segmentation parameters refer to sequence numbers corresponding to different segmented data packets of the upgraded version program;
sequentially acquiring the different segmented data packets of the upgraded version program according to the sequence numbers corresponding to the different segmented data packets;
and splicing the different segmented data packets to obtain the upgraded version program.
7. The method of operating according to any one of claims 1 to 6, wherein the method further comprises:
giving different identification symbols to the upgraded version program and the non-upgraded version program;
and distinguishing the upgrading version program from the non-upgrading version program according to the identification symbol.
8. An execution apparatus of a program, characterized in that the execution apparatus comprises:
the storage unit is used for respectively storing an upgrading version program and a non-upgrading version program in the backup area;
the first judging unit is used for determining the current stage according to the preset identification; the current stage comprises a trial operation stage and a non-trial operation stage;
the checking unit is used for checking the current state of the running program in the running area; the operation area and the backup area are storage areas divided in advance by a program memory;
a second determining unit, configured to transfer the program in which the first operating state in the backup area is normal to the operating area and operate the program in the operating area if it is determined that the current state of the operating program is an abnormal state; the abnormal state includes that the second running state of the running program in the running area is abnormal or the running program in the running area is not a target version program corresponding to the current stage.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202011487728.3A 2020-12-16 2020-12-16 Program running method and running device Active CN112559349B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011487728.3A CN112559349B (en) 2020-12-16 2020-12-16 Program running method and running device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011487728.3A CN112559349B (en) 2020-12-16 2020-12-16 Program running method and running device

Publications (2)

Publication Number Publication Date
CN112559349A true CN112559349A (en) 2021-03-26
CN112559349B CN112559349B (en) 2024-04-09

Family

ID=75064869

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011487728.3A Active CN112559349B (en) 2020-12-16 2020-12-16 Program running method and running device

Country Status (1)

Country Link
CN (1) CN112559349B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023155701A1 (en) * 2022-02-15 2023-08-24 上海美控智慧建筑有限公司 Air conditioning unit, and remote debugging method therefor and apparatus thereof

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6681389B1 (en) * 2000-02-28 2004-01-20 Lucent Technologies Inc. Method for providing scaleable restart and backout of software upgrades for clustered computing
CN1684427A (en) * 2004-04-14 2005-10-19 华为技术有限公司 Method for software upgrading and withdrawing
JP2009048557A (en) * 2007-08-22 2009-03-05 Mitsubishi Electric Corp Data update device, data update method, and data update program
CN101626463A (en) * 2008-07-11 2010-01-13 深圳Tcl新技术有限公司 Method for back-upping digital television software
CN103902299A (en) * 2012-12-24 2014-07-02 航天信息股份有限公司 Software version updating method and system
CN104572206A (en) * 2015-01-14 2015-04-29 厦门为那通信科技有限公司 Application program self updating and backup recovery method
CN105094903A (en) * 2015-07-16 2015-11-25 广州飞米电子科技有限公司 Method and device for upgrading firmware
US20170206079A1 (en) * 2014-05-19 2017-07-20 Zte Corporation Method and Device for Upgrading Software
US20170214568A1 (en) * 2014-07-23 2017-07-27 Huawei Technologies Co., Ltd. Terminal upgrade method and related device
CN107908496A (en) * 2017-11-21 2018-04-13 东峡大通(北京)管理咨询有限公司 For the method and MCU recovered automatically after the error of MCU firmwares
CN109189451A (en) * 2018-10-25 2019-01-11 京信通信系统(中国)有限公司 A kind of firmware upgrade method and device
CN112015447A (en) * 2020-08-10 2020-12-01 上海高仙自动化科技发展有限公司 System updating method and device for electronic equipment, electronic equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6681389B1 (en) * 2000-02-28 2004-01-20 Lucent Technologies Inc. Method for providing scaleable restart and backout of software upgrades for clustered computing
CN1684427A (en) * 2004-04-14 2005-10-19 华为技术有限公司 Method for software upgrading and withdrawing
JP2009048557A (en) * 2007-08-22 2009-03-05 Mitsubishi Electric Corp Data update device, data update method, and data update program
CN101626463A (en) * 2008-07-11 2010-01-13 深圳Tcl新技术有限公司 Method for back-upping digital television software
CN103902299A (en) * 2012-12-24 2014-07-02 航天信息股份有限公司 Software version updating method and system
US20170206079A1 (en) * 2014-05-19 2017-07-20 Zte Corporation Method and Device for Upgrading Software
US20170214568A1 (en) * 2014-07-23 2017-07-27 Huawei Technologies Co., Ltd. Terminal upgrade method and related device
CN104572206A (en) * 2015-01-14 2015-04-29 厦门为那通信科技有限公司 Application program self updating and backup recovery method
CN105094903A (en) * 2015-07-16 2015-11-25 广州飞米电子科技有限公司 Method and device for upgrading firmware
CN107908496A (en) * 2017-11-21 2018-04-13 东峡大通(北京)管理咨询有限公司 For the method and MCU recovered automatically after the error of MCU firmwares
CN109189451A (en) * 2018-10-25 2019-01-11 京信通信系统(中国)有限公司 A kind of firmware upgrade method and device
CN112015447A (en) * 2020-08-10 2020-12-01 上海高仙自动化科技发展有限公司 System updating method and device for electronic equipment, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
SHARON CRAWFORD等: "《Microsoft BackOffice Small Business Server使用大全》", 人民邮电出版社, pages: 328 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023155701A1 (en) * 2022-02-15 2023-08-24 上海美控智慧建筑有限公司 Air conditioning unit, and remote debugging method therefor and apparatus thereof

Also Published As

Publication number Publication date
CN112559349B (en) 2024-04-09

Similar Documents

Publication Publication Date Title
US10409587B2 (en) Method for programming vehicle electronic control modules
US7991988B2 (en) Communication device and firmware update method thereof
CN110083374B (en) Upgrade rollback method, system and terminal equipment
CN110209405B (en) Automatic upgrading method and device for distributed system
US10274919B2 (en) Method, device and computer program product for programming a plurality of control units
JP2007528534A (en) Using a loader to notify system software update services
CN109002312A (en) Method for upgrading software, device and upgrade server and equipment
CN110597545A (en) Hot patch intelligent upgrading method and system based on OTA component
CN105045640A (en) Software upgrading method and device and intelligent equipment
CN111522571B (en) Equipment upgrading method and device, terminal equipment and storage medium
CN112559349A (en) Program running method and device
CN116820528A (en) Firmware version upgrading method and device, chip and electronic equipment
CN115421745A (en) Equipment remote upgrading method, device, terminal and storage medium
CN112328288A (en) Method, system, equipment and storage medium for updating server component
CN110825406A (en) Software upgrading method and related equipment
CN113434163B (en) Online calibration method, system, device and medium suitable for electronic control unit
CN117560285B (en) Intelligent control internet of things OTA upgrading method, client and server
CN112954036B (en) Software upgrading method, terminal equipment and system
CN114968314B (en) Firmware upgrading method and device for display equipment, electronic equipment and storage medium
CN111124461B (en) Method and device for upgrading OTA (over the air) of singlechip and singlechip
CN114268624B (en) Version file transmission method and device and server
CN112269583B (en) Method for processing equipment operation abnormal file upgrade, server and storage medium
CN114500532A (en) Application deployment method and system in elastically telescopic cluster service
CN114895936A (en) Server firmware upgrading system and method
CN116048572A (en) Firmware upgrading method and device of terminal equipment, terminal equipment 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
GR01 Patent grant