Software upgrade method and system
By obtaining the startup address when the chip is powered on or reset and using the network to obtain the upgrade software package, the problem of slow update of the enterprise management software version is solved, personalized and accurate recommendations of software upgrades are achieved, and version update efficiency is improved.
Patent Information
- Application Number
- CN202210535287.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-17
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2042-05-17
AI Technical Summary
The slow update of the enterprise management software version is mainly due to the difficulty of customers to obtain targeted upgrade information, the upgrade notification lacks accuracy, and the information is difficult to organize during use.
By obtaining the startup address when the chip is powered on or reset, running the program to obtain the upgrade instructions, using Wi-Fi, USB or Ethernet to obtain the software package to be upgraded, and writing it at the specified address to complete the software upgrade, flexibly selecting the upgrade Which part of the software?
It realizes personalized and accurate recommendations for software upgrades, improves the efficiency of version updates, allows accurate upgrades during use, and avoids the delay in version updates.
Smart Images

Figure CN114880008B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software upgrade, in particular to a software upgrade method and system, and more particularly to a method for flexibly upgrading any program inside a chip. Background Art
[0002] The current enterprise management software versions are developing rapidly, and different upgraded versions make it difficult for customers to obtain targeted upgrade information, resulting in slow version updates.
[0003] The main reasons for slow version updates are:
[0004] (1) Customers receive a large amount of version upgrade information, but cannot be sure which upgrade information is relevant to them. As a result, they stop paying attention to it over time, which results in a lack of accuracy in the delivery of version upgrades.
[0005] (2) Version upgrade notifications are sent via email, promotional materials, etc. rather than during use, making it difficult for customers to sort out this information.
[0006] Therefore, a software update method is needed to obtain recommended customer groups in a personalized manner; and to make accurate recommendations when customers actually use relevant functional modules.
[0007] Patent document CN101630263B (application number: 200910090976.1) discloses a software upgrade method, including: step S102, setting the applicable conditions of the new version of the software, and creating an applicable customer set based on the applicable conditions; step S104, when the customer uses the software, determining whether the customer belongs to the applicable customer set; and step S106, determining whether to upgrade the software based on the determination result. Summary of the invention
[0008] In view of the defects in the prior art, an object of the present invention is to provide a software upgrading method and system.
[0009] A software upgrade method provided according to the present invention includes:
[0010] Step S1: When the chip is powered on or reset, the address of the program to be run is obtained through the startup address;
[0011] Step S2: running the program based on the running program address, obtaining an upgrade instruction, and when the obtained upgrade flag is valid, obtaining the software package to be upgraded, and writing the obtained software package to be upgraded into the corresponding address, thereby completing the software upgrade.
[0012] Preferably, the step S2 adopts: running the program based on the running program address, obtaining the upgrade instruction, and when the obtained upgrade flag is valid, obtaining the software package to be upgraded through a method including Wi-Fi, USB or Ethernet.
[0013] Preferably, the step S2 adopts: running the program based on the running program address, obtaining the upgrade instruction, when the obtained upgrade flag is valid, clearing the upgrade flag, and upgrading the self-update program or the new application; when the obtained upgrade flag is invalid, judging whether the application flag is valid, when the application flag is valid, jumping to the application and running the application; when the application flag is invalid, upgrading the self-update program or the new application.
[0014] Preferably, when the self-update program is upgraded and the program verification is valid, the startup address 2 of the self-update program is written to the startup address; when a new application is upgraded, the current startup address is updated; the chip is reset; when the self-update program is upgraded, the self-update program is run based on startup address 2; when a new application is upgraded, the program is run based on the updated startup address.
[0015] Preferably, determine whether the boot program upgrade request flag is valid. When the boot program upgrade request flag is valid, upgrade the new boot program, update the new boot program to the specified address, and write the boot program upgrade completion flag into the non-volatile memory; reset the chip; determine whether the boot program upgrade completion flag is valid. When valid, determine whether the boot program upgrade request flag is valid. When valid, upgrade the new application, set the boot program upgrade completion flag to invalid, and reset the chip.
[0016] A software upgrade system provided according to the present invention includes:
[0017] Module M1: When the chip is powered on or reset, the address of the program to be run is obtained through the startup address;
[0018] Module M2: Run the program based on the running program address, obtain the upgrade instruction, and when the obtained upgrade flag is valid, obtain the software package to be upgraded, and write the obtained software package to be upgraded to the corresponding address, thereby completing the software upgrade.
[0019] Preferably, the module M2 adopts: running a program based on the running program address, obtaining an upgrade instruction, and when the obtained upgrade flag is valid, obtaining the software package to be upgraded through a method including Wi-Fi, USB or Ethernet.
[0020] Preferably, the module M2 adopts: running the program based on the running program address, obtaining the upgrade instruction, when the obtained upgrade flag is valid, clearing the upgrade flag, upgrading the self-update program or the new application; when the obtained upgrade flag is invalid, judging whether the application flag is valid, when the application flag is valid, jumping to the application and running the application; when the application flag is invalid, upgrading the self-update program or the new application.
[0021] Preferably, when the self-update program is upgraded and the program verification is valid, the startup address 2 of the self-update program is written to the startup address; when a new application is upgraded, the current startup address is updated; the chip is reset; when the self-update program is upgraded, the self-update program is run based on startup address 2; when a new application is upgraded, the program is run based on the updated startup address.
[0022] Preferably, determine whether the boot program upgrade request flag is valid. When the boot program upgrade request flag is valid, upgrade the new boot program, update the new boot program to the specified address, and write the boot program upgrade completion flag into the non-volatile memory; reset the chip; determine whether the boot program upgrade completion flag is valid. When valid, determine whether the boot program upgrade request flag is valid. When valid, upgrade the new application, set the boot program upgrade completion flag to invalid, and reset the chip.
[0023] Compared with the prior art, the present invention has the following beneficial effects:
[0024] 1. The present invention adopts the method of using a "startup address" to store the startup address of the program that is first run when power is turned on or reset. The "startup address" can be flexibly rewritten according to actual needs, so as to realize whether to run the boot program first or the application program or other program first. The program that runs first can obtain the software package through Wi-Fi, USB, Ethernet, etc., and then upgrade the software package to the specified location, thereby completing the software upgrade;
[0025] 2. Compared with the prior art, the present invention does not fix which part of the program is run first when the chip is powered on or reset, but depends on the content stored in the "startup address"; BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0027] Figure 1 The figure is a flow chart of the software upgrade method.
[0028] Figure 2 This is a diagram of program flash distribution.
[0029] Figure 3 This is a schematic diagram of the boot program upgrade process.
[0030] Figure 4 Schematic diagram of the application upgrade process. DETAILED DESCRIPTION
[0031] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0032] The present invention provides a software upgrade method and system, which selects which part of the software to upgrade according to the needs, and by setting the "startup address", when the chip is powered on or reset, the address stored in the "startup address" will be taken out, and then the program will be run. Which program is run first when the chip is powered on or reset is not fixed, but depends on the content in the "startup address", because the "startup address" stores the startup address of the program that needs to be run first, so different programs can be run when powered on or reset by changing the content in the "startup address". Then the running program obtains the software package through Wi-Fi, USB, Ethernet, etc., and writes the software package into the specified address, thereby completing the software upgrade.
[0033] The present invention can flexibly solve the following technical problems as needed: 1: Upgrade the boot program; 2: Upgrade the application program. The chip "startup address" stores the boot program's startup address, so the boot program is the first thing to run when the chip is powered on. The distribution of programs in the chip is as follows: Figure 3 As shown in state 1.
[0034] For the first case, you can use the boot program to flash the "self-update program" into the chip. After the flash is successful, change the "startup address" to the startup address of the self-update program. The next time the chip is powered on, the self-update program will be run first. Figure 3 Then use the self-update program to upgrade the boot program. After the flash is successful, change the "boot address" to the boot address of the new boot program. The next time the chip is powered on, the new boot program will be run first. Figure 3 In state 3, the bootloader upgrade has been completed. If the previous self-update program occupies the application space, you need to rewrite the original application to restore it to its original state. Figure 3 If not, there is no need to restore the original application. Through the above steps, the bootloader upgrade is successfully completed.
[0035] For the second case, that is, only upgrading the application, the corresponding Figure 4 , upgrade the application directly through the bootloader.
[0036] From the above description, it can be clearly seen that the flexibility of the present invention is: Figure 3 State 2 and Figure 4 It is a principle. It depends on whether the self-update program or a new application is flashed, so it can be determined whether the boot program or the application is upgraded later.
[0037] According to a software upgrade method provided by the present invention, Figure 1-4 As shown, including:
[0038] Step 1: Power on or reset the chip, and first get the address of the program to be run from the "startup address".
[0039] Step 2: Determine whether the "upgrade flag" is valid. If it is valid, proceed to step 8; if it is invalid, proceed to step 3.
[0040] Step 3: Determine whether the "application flag" is valid. If not, proceed to step 9. If valid, proceed to step 4.
[0041] Step 4: Jump to the app and run it.
[0042] Step 5: The application determines in real time whether there is a new refresh request, that is, whether the "upgrade request flag" is valid. If it is valid, proceed to step 6; if it is invalid, continue to determine.
[0043] Step 6: Write the “upgrade request flag” effectively into the non-volatile memory.
[0044] Step 7: Reset the chip.
[0045] Step 8: Write the "upgrade request flag" invalid into the non-volatile memory.
[0046] Step 9: Upgrade the self-update program or new application (the running program can use some communication method, such as Wi-Fi, USB, Ethernet, etc. to obtain the software package to be upgraded).
[0047] Step 10: If the self-update program is upgraded in step 9 and the program verification is valid, the startup address of the self-update program (i.e. startup address 2) needs to be written into the "Startup Address". If a new application is upgraded, there is no need to change the "Startup Address", and the "Startup Address" still stores startup address 1.
[0048] Step 11: Reset the chip. If you are only upgrading a new application, the entire upgrade process is complete after this step. After the chip is reset, it will start from step 1.
[0049] Step 12: If the upgrade is the self-update program, since the "startup address" stores the startup address 2, the self-update program will be run first when the chip is reset.
[0050] Step 13: Determine whether the "upgrade request flag" is valid.
[0051] Step 14: Update the new boot program to the original boot program address, such as Figure 3 State 3, here you need to verify the validity of the new bootloader.
[0052] Step 15: After verifying that the program is valid, the startup address of the new boot program, i.e., startup address 1, needs to be written into the "Startup Address". If it is invalid, the "Startup Address" will not be rewritten (note that at this time, the "Startup Address" position still stores startup address 2, thereby ensuring that if the new boot program fails to upgrade due to other reasons, the next time the chip is powered on, the program will still start running from startup address 2 (i.e., the self-update program), and then the process of upgrading the new boot program can be executed again).
[0053] Step 16: Write the "boot program upgrade completed" flag into the non-volatile memory effectively, and do not write the new boot program if it is invalid (if the self-update program and the application do not share storage space, there is no need to write this flag, and the new boot program does not need to judge "boot program upgrade completed". When designing the code, the software designer has to think about which flash space to put the "self-update program" upgrade in. If the flash space is insufficient, the flash space where the "application" is located needs to temporarily store the "self-update program", and the application needs to be restored later. If the flash space is sufficient or you want to go through fewer processes, you can put the "self-update program" upgrade in another unused flash. Software designers can design according to actual needs, which also reflects the flexibility of the present invention.).
[0054] Step 17: Reset the chip. If the self-update program and the application do not share storage space, after executing this step, the new boot program has been upgraded and the subsequent process starts from step 1.
[0055] Step 18: If the self-update program and the application have a shared storage space, because the self-update program has destroyed the application, the application needs to be restored. The new boot program needs to determine whether the "boot program upgrade completed" flag is valid. If valid, it waits for the upgrade request.
[0056] Step 19: Determine whether the "upgrade request flag" is valid.
[0057] Step 20: Upgrade the new application and verify the validity of the new application.
[0058] Step 21: If the new application is valid, clear the "boot program upgrade completed" flag so that the next time the new boot program can jump to the startup address 2 to run the new application. If it is invalid, it will not be cleared. The next time the power is turned on or reset, the program will still start from the startup address 1 and wait for instructions to upgrade the new application.
[0059] Step 22: Reset the chip.
[0060] A software upgrade system provided according to the present invention includes:
[0061] Module 1: When the chip is powered on or reset, the address of the program to be run is first obtained from the "startup address".
[0062] Module 2: Determine whether the "upgrade flag" is valid. If it is valid, module 8 is triggered; if it is invalid, module 3 is triggered.
[0063] Module 3: Determine whether the "application flag" is valid. If it is invalid, module 9 is triggered; if it is valid, module 4 is triggered.
[0064] Module 4: Jump to running on the application.
[0065] Module 5: The application determines in real time whether there is a new refresh request, that is, whether the "upgrade request flag" is valid. If it is valid, module 6 is triggered; if it is invalid, the judgment continues.
[0066] Module 6: Write the "upgrade request flag" effectively into the non-volatile memory.
[0067] Module 7: Reset the chip.
[0068] Module 8: Write the "upgrade request flag" invalid into the non-volatile memory.
[0069] Module 9: Upgrade self-update program or new application (the running program can use some communication method, such as Wi-Fi, USB, Ethernet, etc. to obtain the software package to be upgraded).
[0070] Module 10: If module 9 upgrades the self-update program and the program verification is valid, the startup address of the self-update program (i.e. startup address 2) needs to be written into the "startup address". If the upgrade is a new application, there is no need to change the "startup address", and the "startup address" still stores startup address 1.
[0071] Module 11: Reset the chip. If you are only upgrading a new application, the entire upgrade process is completed after executing this module, and the chip will be reset and will start from module 1.
[0072] Module 12: If the self-update program is upgraded, since the "startup address" stores the startup address 2, the self-update program will be run first when the chip is reset.
[0073] Module 13: Determine whether the "upgrade request flag" is valid.
[0074] Module 14: Update the new boot program to the original boot program address, such as Figure 3 State 3, here you need to verify the validity of the new bootloader.
[0075] Module 15: After verifying that the program is valid, the startup address of the new boot program, i.e., startup address 1, needs to be written into the "startup address". If it is invalid, the "startup address" will not be rewritten (note that at this time, the "startup address" position still stores startup address 2, thereby ensuring that if the new boot program fails to be upgraded due to other reasons, the next time the chip is powered on, the program will still start running from startup address 2 (i.e., the self-update program), and then the process of upgrading the new boot program can be executed again).
[0076] Module 16: Write the "boot program upgrade completed" flag into the non-volatile memory effectively, and do not write the new boot program if it is invalid (if the self-update program and the application do not share storage space, there is no need to write this flag, and the new boot program does not need to judge "boot program upgrade completed". When designing the code, the software designer has to think about which flash space to put the "self-update program" upgrade in. If the flash space is insufficient, the flash space where the "application" is located needs to temporarily store the "self-update program", and the application needs to be restored later. If the flash space is sufficient or you want to go through fewer processes, you can put the "self-update program" upgrade in another unused flash. Software designers can design according to actual needs, which also reflects the flexibility of the present invention.).
[0077] Module 17: Reset the chip. If the self-update program and the application program do not share storage space, after executing this module, the new boot program has been upgraded and the subsequent process starts according to module 1.
[0078] Module 18: If the self-update program and the application have a shared storage space, because the self-update program has destroyed the application, the application needs to be restored. The new boot program needs to determine whether the "boot program upgrade completed" flag is valid. If valid, it waits for the upgrade request.
[0079] Module 19: Determine whether the "upgrade request flag" is valid.
[0080] Module 20: Upgrade new applications and verify the effectiveness of new applications.
[0081] Module 21: If the new application is valid, the "boot program upgrade completed" flag is cleared so that the next time the new boot program can jump to the startup address 2 to run the new application. If it is invalid, it will not be cleared. The next time the power is turned on or reset, the program will still start from the startup address 1 and wait for instructions to upgrade the new application.
[0082] Module 22: Reset the chip.
[0083] Those skilled in the art know that, in addition to implementing the system, device and its various modules provided by the present invention in a purely computer-readable program code, it is entirely possible to implement the same program in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, the system, device and its various modules provided by the present invention can be considered as a hardware component, and the modules included therein for implementing various programs can also be considered as structures within the hardware component; the modules for implementing various functions can also be considered as both software programs for implementing the method and structures within the hardware component.
[0084] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.
Claims
1. A software upgrade method, characterized in that: include: Step S1: When the chip is powered on or reset, the address of the program to be run is obtained through the startup address; Step S2: running the program based on the running program address, obtaining an upgrade instruction, and when the obtained upgrade flag is valid, obtaining the software package to be upgraded, and writing the obtained software package to be upgraded to the corresponding address, thereby completing the software upgrade; The step S2 adopts: running the program based on the running program address, obtaining the upgrade instruction, and when the obtained upgrade flag is valid, obtaining the software package to be upgraded through a method including Wi-Fi, USB or Ethernet; The step S2 adopts: running the program based on the running program address, obtaining the upgrade instruction, and when the obtained upgrade flag is valid, clearing the upgrade flag, and upgrading the self-update program or the new application; when the obtained upgrade flag is invalid, judging whether the application flag is valid, and when the application flag is valid, jumping to the application and running the application; When the application flag is invalid, the upgrade is from the updater or new application; When the self-update program is upgraded and the program verification is valid, the startup address 2 of the self-update program is written to the startup address; when a new application is upgraded, the current startup address is updated; the chip is reset; when the self-update program is upgraded, the self-update program is run based on the startup address 2; when a new application is upgraded, the program is run based on the updated startup address; Determine whether the boot program upgrade request flag is valid. When the boot program upgrade request flag is valid, upgrade the new boot program, update the new boot program to the specified address, and write the boot program upgrade completion flag into the non-volatile memory; Chip reset; Determine whether the boot program upgrade completion flag is valid. If so, determine whether the boot program upgrade request flag is valid. If so, upgrade the new application, set the boot program upgrade completion flag to invalid, and reset the chip.
2. A software upgrade system, characterized in that: include: Module M1: When the chip is powered on or reset, the address of the program to be run is obtained through the startup address; Module M2: runs the program based on the running program address, obtains the upgrade instruction, and when the obtained upgrade flag is valid, obtains the software package to be upgraded, and writes the obtained software package to be upgraded to the corresponding address, thereby completing the software upgrade; The module M2 adopts: running the program based on the running program address, obtaining the upgrade instruction, and when the obtained upgrade flag is valid, obtaining the software package to be upgraded through a method including Wi-Fi, USB or Ethernet; The module M2 adopts: running the program based on the running program address, obtaining the upgrade instruction, and when the obtained upgrade flag is valid, clearing the upgrade flag, upgrading the self-update program or the new application; when the obtained upgrade flag is invalid, judging whether the application flag is valid, and when the application flag is valid, jumping to the application and running the application; When the application flag is invalid, the upgrade is from the updater or new application; When the self-update program is upgraded and the program verification is valid, the startup address 2 of the self-update program is written to the startup address; when a new application is upgraded, the current startup address is updated; the chip is reset; when the self-update program is upgraded, the self-update program is run based on the startup address 2; when a new application is upgraded, the program is run based on the updated startup address; Determine whether the boot program upgrade request flag is valid. When the boot program upgrade request flag is valid, upgrade the new boot program, update the new boot program to the specified address, and write the boot program upgrade completion flag into the non-volatile memory; Chip reset; Determine whether the boot program upgrade completion flag is valid. If so, determine whether the boot program upgrade request flag is valid. If so, upgrade the new application, set the boot program upgrade completion flag to invalid, and reset the chip.