Software upgrading method of embedded system, optical communication equipment and system
By replacing and upgrading the boot program in the boot loading area using the main original boot program and the main target boot program in the embedded system of the optical communication device, the problem of current network business interruption during software upgrade is solved, online upgrade is achieved and maintenance costs are reduced.
Patent Information
- Application Number
- CN202510002780.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-05-06
AI Technical Summary
The embedded system of optical communication equipment often leads to interruption of current network services during software upgrades, and the method of updating the Bootloader program in the prior art is less practical.
By replacing the backup original boot program in the backup boot loading area with the main raw boot program, receiving the main target boot program from the network management controller, writing the main target boot program to the main boot loading area, and then upgrading the application using the main target boot program or the main raw boot program.
Without interrupting the operation of the current network, the online upgrade of the boot program and application of the embedded system of the optical communication equipment is realized, solving the problem of interruption of the current network business caused by software upgrades and reducing the maintenance and upgrade costs.
Smart Images

Figure CN119938110A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded systems, and in particular to a software upgrading method, optical communication equipment and system for embedded systems. Background Art
[0002] The embedded systems of optical communication equipment usually need to regularly upgrade their software versions, update equipment functions, and improve equipment reliability. Since different optical communication equipment on the optical communication line are usually far apart, the embedded systems of optical communication equipment are generally upgraded by online upgrade using application programming (IAP).
[0003] IAP online upgrade requires upgrading the bootloader and application. Bootloader is a key component in embedded systems. It runs first when the system starts up and is responsible for initializing hardware devices, loading and running user applications.
[0004] When the optical communication equipment is produced, the Bootloader program is burned and fixed in the optical communication equipment through tools such as JLINK, and is sent to the customer after production is completed. However, if the software needs to be upgraded later, if the Bootloader program needs to be updated, the technician needs to go to the customer's site to burn the updated Bootloader program to the memory of the optical communication equipment (for example, Flash memory), or return the entire batch of optical communication equipment to the factory for maintenance; both of these situations will interrupt the services provided by the optical communication equipment, that is, cause the current network services to be interrupted; the methods of updating the Bootloader program in the prior art are less practical.
[0005] In view of this, overcoming the defects of the prior art is an urgent problem to be solved in the field of this technology. Summary of the invention
[0006] The technical problem to be solved by the present invention is to provide a software upgrade method, optical communication equipment and system for an embedded system, using a main original boot program to replace a backup original boot program in a backup boot loading area, and writing a main target boot program into the main boot loading area, and using the main target boot program or the main original boot program to upgrade the application program, the purpose of which is to upgrade the boot program of the optical communication equipment without interrupting the existing network running business, so as to facilitate the application program upgrade, thereby solving the problem of interruption of the existing network business when the embedded system software is upgraded.
[0007] The present invention adopts the following technical solution:
[0008] In a first aspect, the present invention provides a software upgrade method for an embedded system, comprising:
[0009] After receiving the boot program upgrade instruction, the primary original boot program is used to replace the backup original boot program in the backup startup loading area;
[0010] Receiving a main target boot program from a network management controller, and writing the main target boot program into a main boot loading area; wherein the main target boot program is a boot program to be upgraded;
[0011] After receiving the application upgrade instruction, the application is upgraded using the main target boot program or the main original boot program.
[0012] Further, after receiving the boot program upgrade instruction, using the main original boot program to replace the backup original boot program in the backup startup loading area includes:
[0013] When receiving a boot program upgrade instruction, erasing the backup original boot program in the backup boot loading area;
[0014] The main original boot program is written into the backup boot loading area.
[0015] Further, the receiving of the main target boot program from the network management controller and writing the main target boot program into the main boot loading area includes:
[0016] Erasing the main original boot program in the main boot loading area;
[0017] The main target boot program is written into the main boot loading area.
[0018] Further, after receiving the application upgrade instruction, using the main target boot program or the main original boot program to upgrade the application includes:
[0019] When a reset instruction is received, the main target boot program is verified for legitimacy, and selectively jumps to the main boot loading area or the backup boot loading area according to the verification result;
[0020] After receiving the application upgrade instruction, the application in the main application area is upgraded through the currently used boot program, and the current boot loading area is jumped to the main application area to run the application in the main application area.
[0021] Further, a jump area is set at the default startup address of the microcontroller unit;
[0022] When receiving the reset instruction, verifying the legitimacy of the main target boot program, and selectively jumping to the main boot loading area or the backup boot loading area according to the verification result includes:
[0023] Determining whether the main target boot program complies with a first preset legal rule to perform legality verification;
[0024] When the main target boot program meets the first preset legal rule, jump from the jump area to the main boot loading area;
[0025] When the main target boot program does not comply with the first preset legal rule, determine whether the main original boot program complies with the first preset legal rule; when the main original boot program complies with the first preset legal rule, jump from the jump area to the backup boot loading area.
[0026] Further, after receiving the application upgrade instruction, upgrading the application in the main application area through the currently used boot program includes:
[0027] Erase the original application in the main application area;
[0028] The application to be upgraded is written into the main application area.
[0029] Further, the step of jumping from the currently used boot loading area to the main application area so as to run the application in the main application area includes:
[0030] Determining whether the application in the main application area complies with a second preset legal rule;
[0031] When the application in the main application area meets the second preset legal rule, directly jump from the currently used boot loading area to the main application area;
[0032] When the application in the main application area does not comply with the second preset legal rule, the application in the standby application area is used to update the application in the main application area; and the application is jumped from the currently used boot loading area to the main application area.
[0033] Furthermore, the boot program upgrade instruction and the application program upgrade instruction are sent by the network management controller to the optical communication device managed by it; the software upgrade method of the embedded system also includes:
[0034] When the versions of the application in the main application area of the optical communication device are different from those of the target application, the network management controller first sends a reset instruction to the corresponding optical communication device, and then sends an application upgrade instruction and the target application;
[0035] And / or, when the boot program in the main boot loading area of the optical communication device is different from the main target boot program in version, the network management controller sends a boot program upgrade instruction and the main target boot program to the corresponding optical communication device.
[0036] In a second aspect, the present invention further provides an optical communication device, comprising:
[0037] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor to execute the software upgrade method for the embedded system described in the first aspect.
[0038] In a third aspect, the present invention further provides a non-volatile computer storage medium, wherein the computer storage medium stores computer executable instructions, which are executed by one or more processors to complete the software upgrade method for the embedded system described in the first aspect.
[0039] In a fourth aspect, a chip is provided, comprising: a processor and an interface, for calling and running a computer program stored in the memory from a memory, and executing the software upgrade method of the embedded system in the first aspect.
[0040] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer or a processor, enables the computer or the processor to execute the software upgrade method for an embedded system as described in the first to fourth aspects and any one of the aspects.
[0041] In a sixth aspect, the present invention further provides a software upgrade system for an embedded system, comprising a network management controller and the optical communication device as described in the second aspect; the software upgrade system for the embedded system uses the software upgrade method for the embedded system as described in the first aspect to complete the interaction of the optical communication device of the second aspect;
[0042] The network management controller is used to send a reset instruction to the corresponding optical communication device first, and then send an application upgrade instruction and the target application when the application in the main application area of the optical communication device is different from the version of the target application;
[0043] The network management controller is also used to send a boot program upgrade instruction and the main target boot program to the corresponding optical communication device when the boot program in the main startup loading area of the optical communication device is different from the main target boot program version.
[0044] Different from the prior art, the present invention has at least the following beneficial effects:
[0045] After receiving a boot program upgrade instruction, the present invention uses a main original boot program to replace a backup original boot program in a backup startup loading area; receives a main target boot program from a network management controller, and writes the main target boot program into a main startup loading area; after receiving an application upgrade instruction, uses the main target boot program or the main original boot program to upgrade the application; wherein, the present invention can perform online upgrades on the boot program and application program of the embedded system without interrupting the existing network running services, thereby solving the problem of existing network service interruption caused by the embedded system of the optical communication equipment having to be powered on during the software upgrade; it avoids the huge impact caused by the existing network service interruption, and avoids the waste of manpower and material resources caused by re-burning the boot programs of a large number of optical communication equipment, thereby greatly reducing the maintenance and upgrade costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0047] Figure 1 It is a flowchart of a software upgrade method for an embedded system provided by an embodiment of the present invention;
[0048] Figure 2 is a flow chart of step 10 provided in an embodiment of the present invention;
[0049] Figure 3 It is a schematic diagram of a process of upgrading management of a network management controller provided by an embodiment of the present invention;
[0050] Figure 4 is another flowchart of step 10 provided in an embodiment of the present invention;
[0051] Figure 5 It is a schematic diagram of an execution flow of a micro control unit provided by an embodiment of the present invention;
[0052] Figure 6 is a flow chart of step 20 provided in an embodiment of the present invention;
[0053] Figure 7 is a flow chart of step 30 provided in an embodiment of the present invention;
[0054] Figure 8 This is a flow chart of a microcontroller unit that runs a current application program normally after being reset, provided by an embodiment of the present invention;
[0055] Fig. 9is a flowchart of step 301 provided by an embodiment of the present invention;
[0056] Fig.10 It is a schematic diagram of a process of legitimacy verification provided by an embodiment of the present invention;
[0057] Fig.11 is a flowchart of step 302 provided by an embodiment of the present invention;
[0058] Fig.12 It is a schematic diagram of the architecture of an optical communication device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0060] Unless the context requires otherwise, throughout the specification and claims, the term "including" is to be interpreted as open inclusion, that is, "including, but not limited to". In the description of the specification, the terms "one embodiment", "some embodiments", "exemplary embodiments", "examples", "specific examples" or "some examples" and the like are intended to indicate that specific features, structures, materials or characteristics associated with the embodiment or example are included in at least one embodiment or example of the present disclosure. The schematic representation of the above terms does not necessarily refer to the same embodiment or example. In addition, the specific features, structures, materials or characteristics may be included in any one or more embodiments or examples in any appropriate manner, that is, although they may be carried in the embodiments or examples of the above terms due to reasons such as the order and position of appearance, it is not limited to that they can be carried in combination by one embodiment or example.
[0061] In the description of the present invention, it is necessary to understand that the terms "center", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present disclosure and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present disclosure.
[0062] In the description of the present invention, the terms "first" and "second" are used only for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, the meaning of "multiple" is two or more. In addition, for example, the same type of nouns may be described as two independent individuals by adding "A" and "B" at the end. In this case, the corresponding features defined as "A" and "B" are only used to distinguish the same type of individuals for description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features.
[0063] When describing some embodiments, the expressions "coupling", "coupling" and "connection" and their derivatives may be used. For example, when describing some embodiments, the term "connection" may be used to indicate that two or more components are in direct physical or electrical contact with each other. For another example, when describing some embodiments, the term "coupling" may be used to indicate that two or more components are in direct physical or electrical contact. However, the terms "connection" or "coupling" may also refer to two or more components that are not in direct contact with each other, but still cooperate or interact with each other, such as "optical path coupling", "wireless connection", etc. The embodiments disclosed herein are not necessarily limited to the contents of the present invention.
[0064] In the description of the present invention, the expression "A and / or B" (where A and B are used to formally represent specific characteristic contents) will be involved, and the corresponding expressions include the following three combinations: only A, only B, and a combination of A and B.
[0065] As used herein, "about," "substantially," or "approximately" includes the stated value and an average value that is within an acceptable range of deviation from the particular value as determined by one of ordinary skill in the art taking into account the measurements in question and the errors associated with the measurement of the particular quantity (i.e., the limitations of the measurement system).
[0066] In order to facilitate understanding of the solution of the embodiment of the present invention, the application scenario of the embodiment of the present invention is first described below:
[0067] Optical communication equipment is usually connected to a single-chip microcomputer or embedded system through a standard communication interface (such as serial port, Ethernet, etc.). The single-chip microcomputer is the core control unit of the embedded system. It communicates and exchanges data with optical communication equipment and other external devices through its built-in input and output interfaces. It is responsible for processing data from optical communication equipment and performing corresponding control or monitoring tasks as needed; the embedded system realizes specific application functions through the collaborative work of software and hardware such as single-chip microcomputer. Among them, the single-chip microcomputer is also called a single-chip microcomputer (Single Chip Microcomputer), that is, a micro controller unit (Micro Controller Unit, abbreviated as MCU).
[0068] The bootloader program is the first program to be executed after the embedded system is powered on or reset. After completing the necessary hardware initialization and system environment settings, it will boot and load the application program. The application program starts running under the guidance of the bootloader to achieve the functions or tasks specified by the user. The bootloader must be placed at the default running address after the microcontroller is powered on or reset again. Its functions are to clear the data in the application area, receive the application data, write to the application area after successful verification, check the jump flag, and determine whether to stay in the boot loading area (i.e., the area storing the bootloader) or jump to the application area; the boot loading area is the area in the non-volatile memory (such as Flash memory) used by the embedded system that stores the bootloader, and the application area stores the corresponding application.
[0069] When a software upgrade is required, the bootloader can receive new firmware (including a new bootloader and a new application) through a specific communication interface and write it into the non-volatile memory. After the upgrade is completed, the new bootloader will reboot and load the new application to achieve the software update.
[0070] The non-volatile memory of the embodiment of the present invention includes a main boot loading area, a backup boot loading area and an application area; before or after each software upgrade, the main boot loading area is used to store the current latest version of the boot program, the backup boot loading area is used to store the previous version of the boot program, and the application area is used to store the application.
[0071] Embodiment 1:
[0072] In order to solve the above problems, Figure 1 As shown, an embodiment of the present invention provides a software upgrade method for an embedded system, the software upgrade method includes upgrading a boot program and upgrading an application program, specifically including:
[0073] Step 10: After receiving the boot program upgrade instruction, the backup original boot program in the backup boot loading area is replaced with the main original boot program.
[0074] This embodiment modifies the application program running on the optical communication device. During the execution of the application program, after receiving the boot program upgrade instruction, the application program executes steps 10 and 20 to complete the upgrade of the boot program.
[0075] During the software upgrade process, the boot program originally stored in the main boot loading area is the main original boot program, and the boot program originally stored in the backup boot loading area is the backup original boot program.
[0076] In an embodiment of the present invention, when the embedded system of the optical communication device runs the application program normally, it receives a boot program upgrade instruction; when the optical communication device receives the boot program upgrade instruction, it needs to upgrade the boot program of its own embedded system, so through the currently normally running application program, the main original boot program is first used to replace the backup original boot program in the backup startup loading area, so the software upgrade can be performed without interrupting the existing network operation business.
[0077] In an optional embodiment, program code for upgrading the main original boot program may be added to the application program of the embedded system to implement the function of upgrading the main original boot program through the normally running application program.
[0078] Step 20: receiving the main target boot program from the network management controller, and writing the main target boot program into the main boot loading area; wherein the main target boot program is the boot program to be upgraded.
[0079] The main target boot program may be a file in bin format, and the bin file is obtained by compiling the boot program to be upgraded.
[0080] The network management controller manages multiple optical communication devices, and the network management controller can also be a host computer.
[0081] When the main target boot program is received, the main target boot program is used to replace the main original boot program in the main boot loading area. At this time, the main original boot program is in the standby boot loading area, and the main target boot program is in the main boot loading area. The boot program upgrade of the embedded system has been completed. Then, the micro control unit where the embedded system is located is reset; wherein, the reset refers to the software restart of the embedded system, which does not involve powering off first and then powering on, so the existing network services will not be interrupted.
[0082] Step 30: After receiving the application upgrade instruction, the application is upgraded using the main target boot program or the main original boot program.
[0083] In this embodiment, the application program can be selectively upgraded using the main target boot program or the main original boot program according to the legality of the main target boot program or the main original boot program.
[0084] In this embodiment, after the embedded system is started, it is first checked whether the main target boot program is legal. When the main target boot program is legal, the main boot loading area is entered again through the main target boot program; when the main target boot program is not legal, it is checked whether the main original boot program is legal. When the main original boot program is legal, the backup boot loading area is entered again through the main original boot program; when the main original boot program is not legal, it is checked again whether the main target boot program is legal until the corresponding boot loading area is entered through the legal boot program.
[0085] In one embodiment, if the main target boot program is legal, after entering the main boot loading area through the main target boot program, after receiving the application upgrade instruction, the main target boot program is used to upgrade the application.
[0086] In another embodiment, if the main target boot program is not legal but the main original boot program is legal, after entering the backup boot loading area through the main original boot program, after receiving the application upgrade instruction, the main original boot program is used to upgrade the application.
[0087] In an optional embodiment, a main application program area and a backup application program area may be set; after the application program upgrade is completed, the micro control unit of the optical communication device is reset to enter the legal boot loading area.
[0088] Each time after entering the legal boot loading area, when no application upgrade instruction is received, first check whether the application in the main application area is legal. When the application in the main application area is legal, enter the main application area directly through the application in the main application area; when the application in the main application area is illegal, check whether the application in the backup application area is legal. When the application in the backup application area is legal, enter the backup application area directly through the application in the backup application area; when the application in the backup application area is illegal, check whether the application in the main application area is legal again until it is possible to jump from the legal boot loading area to the legal application area; when the application in the currently used application area is started and running, the function of the application is implemented.
[0089] After receiving the boot program upgrade instruction, the present invention uses the main original boot program to replace the backup original boot program in the backup boot loading area; receives the main target boot program from the network management controller, and writes the main target boot program into the main boot loading area; after receiving the application upgrade instruction, the application is upgraded using the main target boot program or the main original boot program. The present invention can upgrade the boot program and application program of the embedded system online without interrupting the existing network operation service, solving the problem of the existing network service interruption caused by the embedded system of the optical communication equipment having to be powered on during the software upgrade; it not only avoids the huge impact caused by the interruption of the existing network service, but also avoids the waste of manpower and material resources caused by re-burning the boot program of a large number of optical communication equipment, and greatly reduces the maintenance and upgrade costs.
[0090] The software upgrade method of the embedded system of the embodiment of the present invention is an online upgrade method based on IAP. The upgrade process will be described in detail below.
[0091] like Figure 2 As shown, the boot program upgrade instruction and the application program upgrade instruction are sent by the network management controller to the optical communication device managed by it. The software upgrade method of the embedded system also includes:
[0092] Step 101a: When the versions of the application in the main application area of the optical communication device are different from those of the target application, the network management controller first sends a reset instruction to the corresponding optical communication device, and then sends an application upgrade instruction and the target application.
[0093] In the software upgrade process, the target application is the application to be upgraded this time; in an optional embodiment, the user may first determine the target application and then upload it to the network management controller. Figure 3 As shown, the network management controller checks the software version of each optical communication device it manages. When the version of the application in the main application area is different from that of the target application, it means that the optical communication device needs to upgrade the application. At this time, the network management controller first sends a reset instruction to the optical communication device to reset the micro control unit of the optical communication device. After resetting, it enters the main startup loading area or the backup startup loading area; then the network management controller sends an application upgrade instruction and a target application to the optical communication device, so as to upgrade the application based on the application upgrade instruction and the target application.
[0094] Step 102a: and / or, when the boot program in the main boot loading area of the optical communication device is different from the main target boot program in version, the network management controller sends a boot program upgrade instruction and the main target boot program to the corresponding optical communication device.
[0095] In an optional embodiment, the user may first determine the main target boot program and then upload it to the network management controller. Figure 3 As shown, the network management controller checks the software version of each optical communication device it manages. When the current boot program is different from the main target boot program version, it means that the optical communication device needs to upgrade the boot program. At this time, the network management controller sends the boot program upgrade instruction and the main target boot program to the optical communication device, so as to upgrade the boot program based on the boot program upgrade instruction and the main target boot program.
[0096] In an optional embodiment, the network management controller may convert the main target boot program into a binary stream, and send it to the micro control unit through the network interface in a single frame response manner.
[0097] The embodiment of the present invention uses a network management controller to first determine whether each optical communication device needs a software upgrade, and then sends a command to the optical communication device that needs the software upgrade, as well as a program required for the upgrade, so that the optical communication device that receives the command completes its own software upgrade, avoiding problems such as missed upgrades and wrong upgrades caused by incorrect user operations.
[0098] In an optional embodiment, the microcontroller unit of the embedded system may use STM32F207; the partitioning of the Flash memory of STM32F207 is shown in the following table:
[0099]
[0100] Among them, sectors 1, 2 and 3 can be used as the main boot loading area, and sector 4 can be used as the backup boot loading area; the application area can be divided into the main application area and the backup application area, sectors 5, 6 and 7 can be used as the main application area, and sectors 8, 9 and 10 can be used as the backup application area; the size of the boot loading firmware can be less than 48Kbytes.
[0101] The following is a description of the process of upgrading the boot program. In order to use the main original boot program to replace the backup original boot program in the backup boot loader area, Figure 4 As shown, the step 10 includes:
[0102] Step 101b: When a boot program upgrade instruction is received, the backup original boot program is erased in the backup boot loading area.
[0103] When receiving the bootloader upgrade command, it starts executing Figure 5 The process shown in Figure 1 upgrades the bootloader in the main application area.
[0104] Step 102b: Write the main original boot program into the backup boot loading area.
[0105] After the main original boot program is written into the backup boot loading area, the backup original boot program is backed up. Even if the upgrade of the main boot loading area fails, the backup boot loading area can be used to boot into the legal application area through the main original boot program to ensure the normal operation of the optical communication equipment.
[0106] Next, in order to write the main target boot program to the main boot loader area, such as Figure 6 As shown, the step 20 includes:
[0107] Step 201: Erasing the main original boot program in the main boot loading area.
[0108] Step 202: Write the main target boot program into the main boot loading area.
[0109] like Figure 5 As shown, the main original boot program in the main boot loading area is erased, and then the received main target boot program is written into the main boot loading area; for example, the received binary stream is copied to sectors 1, 2 and 3 in sequence; after all data transmission is completed and data verification is completed; after confirming that there is no abnormality in the updated main target boot program, the micro control unit is reset, and the micro control unit uses the main target boot program to start.
[0110] According to the above process, the embodiment of the present invention can upgrade the boot program of the optical communication equipment without interrupting the existing network operation services, thereby creating conditions for the subsequent upgrade of the application program.
[0111] like Figure 5 As shown in FIG. 1 , after upgrading the current main area program, the micro control unit is reset first, and then needs to jump to the application area. A specific embodiment of the jump process is described below. Figure 7 As shown, the step 30 includes:
[0112] Step 301: When a reset instruction is received, the main target boot program is verified for legitimacy, and the program is selectively jumped to the main boot loading area or the backup boot loading area according to the verification result.
[0113] The specific process of jumping based on the verification results of the legality verification will be explained below.
[0114] Step 302: after receiving the application upgrade instruction, the application in the main application area is upgraded through the currently used boot program, and the current boot loading area is jumped to the main application area to run the application in the main application area.
[0115] like Figure 8As shown, after receiving the application upgrade instruction, the microcontroller unit jumps to the main boot loading area and executes the main target boot program, or jumps to the backup boot loading area and executes the main original boot program; then the application upgrade process of the application is performed, and after the application upgrade is completed, the microcontroller unit is reset.
[0116] In order to explain the process of legality verification, Fig. 9 As shown, a jump area is set at the default startup address of the micro control unit; the step 301 includes:
[0117] Step 3011: Determine whether the main target boot program complies with the first preset legal rule to perform legality verification.
[0118] Among them, the first preset legal rule is used to exclude program errors or upgrade errors that may occur in the boot program; the first preset legal rule is selected by technical personnel in this field based on their own experience according to the specific usage scenario and is not limited here.
[0119] The jump area is used to first check the legitimacy of the boot program in the main boot loading area after each reset of the microcontroller unit and startup. Fig.10 As shown, first enter the jump area to verify the legitimacy.
[0120] Step 3012: When the main target boot program meets the first preset legal rule, jump from the jump area to the main boot loading area.
[0121] When the boot program in the main boot loading area is legal, it jumps from the jump area to the main boot loading area.
[0122] Step 3013: When the main target boot program does not comply with the first preset legal rule, determine whether the main original boot program complies with the first preset legal rule; when the main original boot program complies with the first preset legal rule, jump from the jump area to the backup boot loading area.
[0123] When the boot program in the main boot loading area is illegal, the legality of the boot program in the backup boot loading area is checked again. When the boot program in the backup boot loading area is legal, the system jumps from the jump area to the backup boot loading area. When the boot program in the backup boot loading area is illegal, the system rechecks whether the boot program in the main boot loading area is legal, until the legal boot program is passed, the system jumps from the jump area to the legal boot loading area.
[0124] The embodiment of the present invention eliminates program errors or upgrade errors of the main target boot program as much as possible through legitimacy verification; when there is an error in the main target boot program, since the main original boot program has been used, the probability of an error is small, so the main original boot program is used to boot and jump to the application program area; when there is no error in the main target boot program, the main target boot program is directly used to boot and jump to the application program area.
[0125] To illustrate the process of upgrading the application, in step 302, after receiving the application upgrade instruction, upgrading the application in the main application area through the currently used boot program includes:
[0126] Erasing the original application in the main application area; writing the application to be upgraded into the main application area. After jumping to the legal boot loading area, upgrading the application; replacing the original application in the main application area with the application to be upgraded to complete the upgrade of the application.
[0127] like Fig.11 As shown, in step 302, the process of jumping from the currently used boot loading area to the main application area so as to run the application in the main application area includes:
[0128] Step 3021: Determine whether the application in the main application area complies with the second preset legal rule.
[0129] Among them, the second preset legal rule is used to exclude program errors or upgrade errors that may occur in the application; the second preset legal rule is selected by technical personnel in this field based on their own experience according to the specific usage scenario, and is not limited here.
[0130] After the application is upgraded, the application in the main application area is checked for legality according to the second preset legal rule.
[0131] Step 3022: When the application in the main application area meets the second preset legal rule, directly jump from the currently used boot loading area to the main application area.
[0132] When the application in the main application area is legal, it directly jumps to the main application area.
[0133] Step 3023: When the application in the main application area does not comply with the second preset legal rule, use the application in the backup application area to update the application in the main application area; and jump from the currently used boot loading area to the main application area.
[0134] When the application in the main application area is illegal, the application in the backup application area is copied to the main application area, so as to ensure that the application can be run normally after jumping to the main application area through the application in the backup application area. This avoids the inability to upgrade the application after the upgrade boot program fails due to errors in the application. It also solves the problem that the main target boot program is erased due to accidental power failure during the upgrade of the boot program, resulting in the inability to start subsequent applications.
[0135] Embodiment 2:
[0136] like Fig.12 , which is a schematic diagram of the architecture of an optical communication device according to an embodiment of the present invention. The optical communication device according to this embodiment includes one or more processors 21 and a memory 22. Fig.12 A processor 21 is taken as an example.
[0137] The processor 21 and the memory 22 may be connected via a bus or other means. Fig.12 The example of connecting through bus is taken in the following.
[0138] The memory 22 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs and non-volatile computer executable programs, such as the software upgrade method for the embedded system in this embodiment. The processor 21 executes the software upgrade method for the embedded system by running the non-volatile software programs and instructions stored in the memory 22.
[0139] The memory 22 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 22 may optionally include a memory remotely arranged relative to the processor 21, and these remote memories may be connected to the processor 21 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0140] The program instructions / modules are stored in the memory 22, and when executed by the one or more processors 21, the software upgrade method of the embedded system in the above-mentioned embodiment is executed, for example, each step of the software upgrade method of the embedded system in the embodiment of the present invention described above is executed.
[0141] An embodiment of the present invention further provides a non-volatile computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are executed by one or more processors, such as Fig.12A processor 21 can enable the above one or more processors to execute the software upgrade method of the embedded system in the specific implementation of the present invention, for example, to execute each step of the software upgrade method of the embedded system in the embodiment of the present invention described above; it can also realize Fig.12 The modules and units described above; or executing the software upgrade method of the embedded system in the specific implementation of the present invention, for example, executing the various steps of the software upgrade method of the embedded system in the embodiment of the present invention described above; it can also be realized Fig.12 The various modules and units described.
[0142] In one embodiment, the present invention further provides a software upgrade system for an embedded system, comprising a network management controller and at least one optical communication device according to an embodiment of the present invention. The network management controller is used to first send a reset instruction to the corresponding optical communication device, and then send an application upgrade instruction and the target application when the application in the main application area of the optical communication device is different from the version of the target application; the network management controller is also used to send a boot program upgrade instruction and the main target boot program to the corresponding optical communication device when the boot program in the main boot loading area of the optical communication device is different from the version of the main target boot program.
[0143] It is worth noting that the information interaction, execution process, etc. between the modules and units within the above-mentioned devices and systems are based on the same concept as the processing method embodiment of the present invention. The specific contents can be found in the description of the method embodiment of the present invention and will not be repeated here.
[0144] A person skilled in the art may understand that all or part of the steps in the various methods of the embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0145] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A software upgrade method for an embedded system, characterized in that: include: After receiving the boot program upgrade instruction, the primary original boot program is used to replace the backup original boot program in the backup startup loading area; Receiving a main target boot program from a network management controller, and writing the main target boot program into a main boot loading area; wherein the main target boot program is a boot program to be upgraded; After receiving the application upgrade instruction, the application is upgraded using the main target boot program or the main original boot program.
2. The software upgrade method of the embedded system according to claim 1, characterized in that: After receiving the boot program upgrade instruction, using the main original boot program to replace the backup original boot program in the backup startup loading area includes: When receiving a boot program upgrade instruction, erasing the backup original boot program in the backup boot loading area; The main original boot program is written into the backup boot loading area.
3. The software upgrade method of the embedded system according to claim 2, characterized in that: The receiving of the main target boot program from the network management controller and writing the main target boot program into the main boot loading area comprises: Erasing the main original boot program in the main boot loading area; The main target boot program is written into the main boot loading area.
4. The software upgrade method of the embedded system according to claim 3, characterized in that: After receiving the application upgrade instruction, using the main target boot program or the main original boot program to upgrade the application includes: When a reset instruction is received, the main target boot program is verified for legitimacy, and selectively jumps to the main boot loading area or the backup boot loading area according to the verification result; After receiving the application upgrade instruction, the application in the main application area is upgraded through the currently used boot program, and the current boot loading area is jumped to the main application area to run the application in the main application area.
5. The software upgrade method of the embedded system according to claim 4, characterized in that: A jump area is set at the default startup address of the microcontroller unit; When receiving the reset instruction, verifying the legitimacy of the main target boot program, and selectively jumping to the main boot loading area or the backup boot loading area according to the verification result includes: Determining whether the main target boot program complies with a first preset legal rule to perform legality verification; When the main target boot program meets the first preset legal rule, jump from the jump area to the main boot loading area; When the main target boot program does not comply with the first preset legal rule, determine whether the main original boot program complies with the first preset legal rule; when the main original boot program complies with the first preset legal rule, jump from the jump area to the backup boot loading area.
6. The software upgrade method of the embedded system according to claim 4, characterized in that: After receiving the application upgrade instruction, upgrading the application in the main application area through the currently used boot program includes: Erase the original application in the main application area; The application to be upgraded is written into the main application area.
7. The software upgrade method of the embedded system according to claim 4, characterized in that: The step of jumping from the currently used boot loading area to the main application area so as to run the application in the main application area includes: Determining whether the application in the main application area complies with a second preset legal rule; When the application in the main application area meets the second preset legal rule, directly jump from the currently used boot loading area to the main application area; When the application in the main application area does not comply with the second preset legal rule, the application in the standby application area is used to update the application in the main application area; and the application is jumped from the currently used boot loading area to the main application area.
8. The software upgrade method of the embedded system according to claim 1, characterized in that: The boot program upgrade instruction and the application program upgrade instruction are sent by the network management controller to the optical communication equipment managed by it; The software upgrade method of the embedded system also includes: When the versions of the application in the main application area of the optical communication device are different from those of the target application, the network management controller first sends a reset instruction to the corresponding optical communication device, and then sends an application upgrade instruction and the target application; And / or, when the boot program in the main boot loading area of the optical communication device is different from the main target boot program in version, the network management controller sends a boot program upgrade instruction and the main target boot program to the corresponding optical communication device.
9. An optical communication device, characterized in that: The optical communication device includes at least one processor and a memory, wherein the at least one processor and the memory are connected via a data bus, and the memory stores instructions that can be executed by the at least one processor, and after being executed by the processor, the instructions are used to implement the software upgrade method of the embedded system described in any one of claims 1-8.
10. A software upgrade system for an embedded system, characterized in that: comprising a network management controller and at least one optical communication device as claimed in claim 9; The network management controller is used to send a reset instruction to the corresponding optical communication device first, and then send an application upgrade instruction and the target application when the application in the main application area of the optical communication device is different from the version of the target application; The network management controller is also used to send a boot program upgrade instruction and the main target boot program to the corresponding optical communication device when the boot program in the main startup loading area of the optical communication device is different from the main target boot program version.