Processor upgrading method and device, computer equipment and storage medium
By setting two running partitions in the processor memory and controlling their running state with the activation flag, the problem of MCU upgrade solution that relies on boot partitions in the existing technology is solved, and processor upgrade without boot partitions is realized, and upgrades are improved. Success rate and storage space utilization.
Patent Information
- Application Number
- CN202411350629.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-02-14
AI Technical Summary
The upgrade solution of the existing microprocessing unit MCU relies on the boot partition, which leads to failure to use normally after the upgrade failed, and the duplicate configuration of the boot partition and storage space occupancy are problems.
By setting up two running partitions in the processor memory, controlling their running state with the activation flag, replacing the traditional boot partition's Boot function, and realizing a processor upgrade without boot partitions.
It achieves an improvement in the success rate of processor upgrades, avoids the unavailability of functions after the upgrade failure, saves processor storage space, and simplifies the upgrade process.
Smart Images

Figure CN119440571A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a processor upgrade method, device, computer equipment and storage medium. Background Art
[0002] In the prior art, the MCU (Microcontroller Unit) upgrade solution is based on the design of the boot partition (BootLoader) and the running partition (application). The reception and verification of the upgrade data of this type of design is generally performed in the boot partition, and after the upgrade is successful, the MCU can be restarted to jump to the running partition to run the program.
[0003] One type is a boot partition plus a running partition mode, where the upgrade data is received and verified in the boot partition. After the upgrade is successful, the reboot jumps to the upgraded running partition via the boot partition. Once the upgrade fails, since the upgrade process has not been completed, even if it is rebooted, it can only run in the boot partition and wait for another upgrade, which affects the use of the function. The other type is a boot partition plus two running partition modes. One way is that both running partitions are functional running partitions. Since there are two running partitions, even after the upgrade fails, there is still one running partition that can run. After restarting, it can continue to run in the running partition without affecting the use of the function; another way is that there are two running partitions, one running partition is used as a running program area, and the other running partition is used as an upgrade program area. The storage area of the MCU includes a boot partition, a running program area, and an upgrade program area. If the boot partition determines that the upgrade conditions are met, the upgrade program stored in the upgrade program area will overwrite the current running program stored in the running program area as the new current running program. However, in the case of an upgrade failure, it will still stay in the boot partition after restarting and can only wait for another upgrade in the boot partition, which affects the use of the function.
[0004] Therefore, current microprocessor units all need to rely on the boot partition to achieve system upgrades. Moreover, the boot partition needs to meet the MCU operation configuration on the one hand, and on the other hand, it also needs to be configured as a communication interface for receiving upgrade data. The configuration is duplicated with the running partition, and the boot partition also occupies storage space. There are problems such as the inability to upgrade the boot partition data, and the inability to use it normally after the upgrade fails, and the system can only wait for another upgrade. Summary of the invention
[0005] Based on this, it is necessary to provide a processor upgrade method, apparatus, computer device and storage medium that can upgrade the processor without using a boot partition to address the above technical problems.
[0006] In one aspect, a processor upgrade method is provided, the method comprising:
[0007] Acquire a processor memory, and set the processor memory to include a first running partition and a second running partition, wherein the first running partition and the second running partition are used to store the same application program;
[0008] Setting an activation flag, and controlling the first running partition and the second running partition not to run at the same time by using the activation flag;
[0009] In response to receiving an upgrade instruction from the processor memory, detecting whether the first running partition and the second running partition are running, marking the running first running partition / the second running partition as a current running partition, and marking the non-running second running partition / the first running partition as an upgradeable partition;
[0010] Determine whether the application version in the upgradeable area is the same as the application version in the upgrade package, and if they are different, set the upgradeable area as the target upgrade area;
[0011] In response to the upgradeable area being a target upgrade area, the upgradeable area is upgraded according to the data of the upgrade package to obtain an upgraded application program.
[0012] In one embodiment, setting an activation flag and controlling the first running partition and the second running partition to not run simultaneously by using the activation flag comprises:
[0013] Storing the address of the first running partition and the address of the second running partition in a base address register;
[0014] Setting an activation flag in the base address register, the activation flag being used to point to an address of a run partition activated when the processor is started;
[0015] In response to the processor being powered on, the address pointed to by the activation flag is read, and the running partition corresponding to the address pointed to by the activation flag is controlled to be powered on and activated.
[0016] In one embodiment, the processor upgrade method further includes:
[0017] After the upgrade of the upgradeable area is completed, determining whether there is a problem with the upgrade of the upgradeable area;
[0018] If the upgrade of the upgradeable area fails, the address pointed to by the activation flag is kept unchanged, the processor is restarted, and the application of the currently running partition is continued to run;
[0019] If the upgradeable area is successfully upgraded, the activation mark is updated to point to the address of the upgradeable area, and the upgrade success of the upgradeable area is fed back to the system on chip and / or the user interaction interface.
[0020] In one embodiment, the processor upgrade method further includes:
[0021] After the upgrade of the upgradeable area is completed, a reminder message is sent to confirm whether to restart;
[0022] In response to receiving the restart instruction, controlling the processor to restart, and activating the corresponding running partition according to the address pointed to by the activation flag;
[0023] In response to not receiving a restart instruction or receiving a non-restart instruction, controlling the processor not to restart.
[0024] In one embodiment, the processor upgrade method further includes:
[0025] In response to the system on chip receiving the upgrade instruction, verifying the upgrade data to determine whether the system on chip and the processor are upgraded;
[0026] If yes, the system on chip controls its own system upgrade, and the system on chip sends the upgrade instruction and upgrade data of the processor memory to the processor;
[0027] After receiving the upgrade instruction of the processor memory, the processor verifies the upgrade data and feeds back the verification result of the processor to the system on chip;
[0028] The system on chip determines whether to restart the processor according to its own upgrade status and the verification result of the processor.
[0029] In one embodiment, the processor upgrade method further includes:
[0030] Determine whether the application version in the current running partition is the same as the application version in the upgrade package, if they are different, the current running partition is the target upgrade area;
[0031] When the current running partition is the target upgrade area, after the upgrade of the upgradeable area is completed, the address pointed to by the activation mark is changed to the address of the upgradeable area, and the processor is controlled to restart.
[0032] In one embodiment, the step of upgrading the upgradeable area according to the data of the upgrade package to obtain the upgraded application program comprises:
[0033] The application data in the upgradeable area is cleared, and the received upgrade data is written into the corresponding address of the upgradeable area.
[0034] In another aspect, a processor upgrading device is provided, the device comprising:
[0035] An operation partition setting module, used for acquiring a processor memory, and setting the processor memory to include a first operation partition and a second operation partition, wherein the first operation partition and the second operation partition are used for storing the same application program;
[0036] an activation flag management module, used to set an activation flag, and control the first running partition and the second running partition not to run at the same time through the activation flag;
[0037] an upgradeable area identification module, configured to detect whether the first running partition and the second running partition are running in response to receiving an upgrade instruction from the processor memory, mark the running first running partition / the second running partition as a current running partition, and mark the non-running second running partition / the first running partition as an upgradeable area;
[0038] An upgrade target determination module, used to determine whether the application version in the upgradeable area is the same as the application version in the upgrade package, and if they are different, set the upgradeable area as the target upgrade area;
[0039] The upgrade control module is used to upgrade the upgradeable area according to the data of the upgrade package to obtain an upgraded application program in response to the upgradeable area being a target upgrade area.
[0040] In another aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0041] Acquire a processor memory, and set the processor memory to include a first running partition and a second running partition, wherein the first running partition and the second running partition are used to store the same application program;
[0042] Setting an activation flag, and controlling the first running partition and the second running partition not to run at the same time by using the activation flag;
[0043] In response to receiving an upgrade instruction from the processor memory, detecting whether the first running partition and the second running partition are running, marking the running first running partition / the second running partition as a current running partition, and marking the non-running second running partition / the first running partition as an upgradeable partition;
[0044] Determine whether the application version in the upgradeable area is the same as the application version in the upgrade package, and if they are different, set the upgradeable area as the target upgrade area;
[0045] In response to the upgradeable area being a target upgrade area, the upgradeable area is upgraded according to the data of the upgrade package to obtain an upgraded application program.
[0046] In another aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0047] Acquire a processor memory, and set the processor memory to include a first running partition and a second running partition, wherein the first running partition and the second running partition are used to store the same application program;
[0048] Setting an activation flag, and controlling the first running partition and the second running partition not to run at the same time by using the activation flag;
[0049] In response to receiving an upgrade instruction from the processor memory, detecting whether the first running partition and the second running partition are running, marking the running first running partition / the second running partition as a current running partition, and marking the non-running second running partition / the first running partition as an upgradeable partition;
[0050] Determine whether the application version in the upgradeable area is the same as the application version in the upgrade package, and if they are different, set the upgradeable area as the target upgrade area;
[0051] In response to the upgradeable area being a target upgrade area, the upgradeable area is upgraded according to the data of the upgrade package to obtain an upgraded application program.
[0052] The above-mentioned processor upgrade method, device, computer equipment and storage medium can clearly define the current running partition and the upgradeable area by setting an activation flag. When the processor is started, the activation flag is used as a judgment mark to activate the running partition, replacing the Boot function of the traditional boot partition. There is no need to set a boot partition, saving processor storage space. The processor memory is set to include a first running partition and a second running partition. Function processing and upgrade processes are executed in the current running partition. Even if the upgrade of the upgradeable area fails, it will not affect the use of the function. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0054] Figure 1 This is an application environment diagram of a processor upgrade method in one embodiment of the present application;
[0055] Figure 2 This is a structural block diagram of a processor memory in one embodiment of the present application;
[0056] Figure 3 A schematic diagram of a process of activating a corresponding running partition according to an activation flag in one embodiment of the present application;
[0057] Figure 4 This is a flowchart of a processor upgrade method in one embodiment of the present application;
[0058] Figure 5 This is a structural block diagram of a processor upgrade device in one embodiment of the present application;
[0059] Figure 6 This is a diagram of the internal structure of a computer device in one embodiment of the present application. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application 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 application and are not used to limit the present application.
[0061] The processor upgrade method provided in this application can be applied to Figure 1 In the application environment shown. The processor corresponds to the microprocessor unit (MCU), where the car entertainment host IHU (Infotainment Head Unit) includes a system on chip (SOC) and a microprocessor unit (MCU). The car entertainment host IHU function needs to adapt to different configurations, so the system on chip (SOC) and the microprocessor unit (MCU) are required to match the functions. Otherwise, there is a possibility of functional mismatch causing abnormal functions of the car entertainment host IHU. Therefore, the upgrade operations of the system on chip (SOC) and the microprocessor unit (MCU) are set to be performed synchronously. During version integration, the versions of the system on chip (SOC) and the microprocessor unit (MCU) will be matched and managed, and the matching versions will be released at the same time.
[0062] The interaction process between the system on chip (SOC) and the microprocessor unit (MCU) is as follows Figure 1 As shown. The system on chip (SOC) obtains the upgrade version through OTA (Over the Air) or USB, and the upgrade data of the microprocessor unit (MCU) version is always sent synchronously from the system on chip (SOC) to the system on chip (SOC) through a serial interface (SPI, etc.). The system on chip (SOC) is responsible for its own upgrades, the selection of the system on chip (SOC) upgrade version, and the control of the upgrade process. When the SOC detects the upgrade data from OTA or USB, it will determine whether to upgrade.
[0063] like Figure 2 As shown, there is no boot partition in the microprocessor unit (MCU) memory (ROM), which consists of a first running partition and a second running partition. Under the same version, the two running partitions have exactly the same functional processing, except for the different ROM partition addresses. The first running partition and the second running partition do not run at the same time, only one is an activated running partition, and the other partition is inactivated and can be used as an upgradeable area. The upgrade process is also run in the activated running partition, including the start of the upgrade, the reception of upgrade data, the judgment of abnormalities during the upgrade process, and the verification of the upgrade data after the upgrade is completed. During the MCU upgrade process, the reception of upgrade instructions, the reception of upgrade data packets, and the verification of upgrade data are all executed in the current running partition, replacing the loader function of the traditional boot partition, and the communication channel used for the upgrade is reused with the normal running data interaction channel to avoid duplicate function development.
[0064] like Figure 3 As shown, at startup, the activation flag in the base address register is read to determine the partition address to be run. If there is no abnormality in the upgrade status and the SOC requires switching the running version, the MCU updates the activation flag to determine the activated running partition at the next restart.
[0065] In one embodiment, Figure 4 As shown, a processor upgrade method is provided, comprising the following steps:
[0066] Step S1, obtaining a processor memory, setting the processor memory to include a first running partition and a second running partition, wherein the first running partition and the second running partition are used to store the same application program;
[0067] Step S2, setting an activation flag, and controlling the first running partition and the second running partition not to run at the same time by the activation flag;
[0068] Step S3, in response to receiving the upgrade instruction of the processor memory, detecting whether the first running partition and the second running partition are running, marking the running first running partition / the second running partition as the current running partition, and marking the non-running second running partition / the first running partition as an upgradeable partition;
[0069] Step S4, determining whether the application version in the upgradeable area is the same as the application version in the upgrade package, and if they are different, setting the upgradeable area as the target upgrade area;
[0070] Step S5: in response to the upgradeable area being a target upgrade area, upgrading the upgradeable area according to the data of the upgrade package to obtain an upgraded application program.
[0071] Specifically, the processor is a microprocessing unit (MCU), and the processor memory does not include a boot partition, so as to avoid wasting time on repeated configuration and development of the running partition and save processor memory (ROM) resources. The processor memory uses two running partitions, and the upgrade process is performed in the activated running partition, so that in the event of an upgrade failure, one running partition can still run normally without affecting the normal use of functions.
[0072] In this embodiment, the setting of the activation flag and controlling the first running partition and the second running partition to not run at the same time by the activation flag includes:
[0073] Storing the address of the first running partition and the address of the second running partition in a base address register;
[0074] Setting an activation flag in the base address register, the activation flag being used to point to an address of a run partition activated when the processor is started;
[0075] In response to the processor being powered on, the address pointed to by the activation flag is read, and the running partition corresponding to the address pointed to by the activation flag is controlled to be powered on and activated.
[0076] The use of the activation flag can clarify the current running partition and the upgradeable area. It is also used as a judgment mark for the running partition when the MCU starts, replacing the Boot function of the traditional boot partition.
[0077] In this embodiment, the processor upgrade method further includes:
[0078] After the upgrade of the upgradeable area is completed, determining whether there is a problem with the upgrade of the upgradeable area;
[0079] If the upgrade of the upgradeable area fails, the address pointed to by the activation flag is kept unchanged, the processor is restarted, and the application of the currently running partition is continued to run;
[0080] If the upgradeable area is successfully upgraded, the activation mark is updated to point to the address of the upgradeable area, and the upgrade success of the upgradeable area is fed back to the system on chip and / or the user interaction interface.
[0081] It is understandable that feeding back the upgrade success of the upgradeable area to the system on chip facilitates the system on chip to determine whether to restart the processor, and feeding back the upgrade success of the upgradeable area to the user interaction interface can inform the user of the upgrade status.
[0082] In this embodiment, the processor upgrade method further includes:
[0083] After the upgrade of the upgradeable area is completed, a reminder message is sent to confirm whether to restart;
[0084] In response to receiving the restart instruction, controlling the processor to restart, and activating the corresponding running partition according to the address pointed to by the activation flag;
[0085] In response to not receiving a restart instruction or receiving a non-restart instruction, controlling the processor not to restart.
[0086] In this embodiment, the processor upgrade method further includes:
[0087] In response to the system on chip receiving the upgrade instruction, verifying the upgrade data to determine whether the system on chip and the processor are upgraded;
[0088] If yes, the system on chip controls its own system upgrade, and the system on chip sends the upgrade instruction and upgrade data of the processor memory to the processor;
[0089] After receiving the upgrade instruction of the processor memory, the processor verifies the upgrade data and feeds back the verification result of the processor to the system on chip;
[0090] The system on chip determines whether to restart the processor according to its own upgrade status and the verification result of the processor.
[0091] When the system on chip is upgraded and the verification result shows that the upgrade data has been sent and the upgradeable area has been upgraded, the processor may be restarted.
[0092] It is understandable that the functions of the system on chip (SOC) and the processor are matched, the versions of the system on chip (SOC) and the processor are matched and managed, and the upgrade operations of the system on chip (SOC) and the processor are performed synchronously. Therefore, the processor restart can only be achieved after the upgrade of the system on chip itself is completed. Only when there is no problem with the processor verification result and there is no problem with the SOC upgrade, the SOC may issue instructions to restart and switch the running partition; if there is a problem with the upgrade of either side, the running partition will not be restarted and switched. After restarting again, the application of the current partition will continue to run. After the processor receives the restart and switch running partition instruction, it will update the first address of the upgradeable area to the activation flag. The next time the processor starts, the running partition will be selected according to the read activation flag data status.
[0093] like Figure 3 As shown, in this embodiment, in response to receiving the upgrade instruction of the processor memory, detecting whether the first running partition and the second running partition are running, marking the running first running partition / the second running partition as the current running partition, and marking the non-running second running partition / the first running partition as an upgradeable area includes:
[0094] When the processor receives the upgrade instruction from the processor memory, the processor reads the address pointed to by the activation flag;
[0095] When the address pointed to by the activation mark is the address of the first running partition, the first running partition is used as the current running partition, and the second running partition is used as the upgradeable partition;
[0096] When the address pointed to by the activation mark is the address of the second running partition, the second running partition is used as the current running partition, and the first running partition is used as the upgradeable partition.
[0097] In other embodiments, the activation flag may also be set to directly store the address of the first running partition or the address of the second running partition, so that the stored data of the activation flag needs to be rewritten each time the activation flag is updated.
[0098] In this embodiment, the determining whether the application version in the upgradeable area is the same as the application version in the upgrade package, and if they are different, setting the upgradeable area as the target upgrade area includes:
[0099] Setting the first running partition and the second running partition to store application version data respectively;
[0100] Comparing the application version data in the upgradeable area and the upgrade package;
[0101] If the application version in the upgradeable area is the same as the application version in the upgrade package, determining that the upgradeable area is not a target upgrade area;
[0102] If the application version in the upgradeable area is different from the application version in the upgrade package, the upgradeable area is determined to be a target upgrade area.
[0103] It is understandable that the application version data that needs to be upgraded can be quickly compared and obtained, and the data with inconsistent application versions can be packaged into an upgrade package and sent to the processor, thereby reducing the upgrade data transmission.
[0104] In this embodiment, the processor upgrade method further includes:
[0105] Determine whether the application version in the current running partition is the same as the application version in the upgrade package, if they are different, the current running partition is the target upgrade area;
[0106] When the current running partition is the target upgrade area, after the upgrade of the upgradeable area is completed, the address pointed to by the activation mark is changed to the address of the upgradeable area, and the processor is controlled to restart.
[0107] Specifically, the determining whether the application version in the current running partition is the same as the application version in the upgrade package, and if they are different, determining that the current running partition is the target upgrade area includes:
[0108] Comparing the application version data in the current running partition and the upgrade package;
[0109] If the application version in the current running partition is the same as the application version in the upgrade package, determining that the current running partition is not a target upgrade area;
[0110] If the application version in the current running partition is different from the application version in the upgrade package, the current running partition is determined to be a target upgrade area.
[0111] Since the current running partition is the target upgrade area, after the current running partition is successfully upgraded, it is not necessarily necessary to control the processor to restart. When the processor is controlled not to restart, there may be a situation where the current running partition needs to be upgraded. At this time, the current running partition can only be upgraded when the processor is powered on next time. Therefore, when the processor receives the upgrade instruction of the processor memory, the following situations may occur:
[0112] When the current running partition is not the target upgrade area and the upgradeable area is the target upgrade area, after the upgrade of the upgradeable area is completed, the application version data in the upgradeable area is updated according to the upgraded application version, and the address pointed to by the activation mark is changed to the address of the upgradeable area;
[0113] When the current running partition and the upgradeable area are both target upgrade areas, after the upgrade of the upgradeable area is completed, the application version data in the upgradeable area is updated according to the upgraded application version, the address pointed to by the activation mark is changed to the address of the upgradeable area, and the processor is controlled to restart;
[0114] When the current running partition is the target upgrade area and the upgradeable area is not the target upgrade area, changing the address pointed to by the activation mark to the address of the upgradeable area, and controlling the processor to restart;
[0115] When neither the current running partition nor the upgradeable area is the target upgrade area, the upgrade is terminated and feedback is given that the processor does not need to be upgraded.
[0116] In the actual upgrade process, there will be multiple scenarios. This application sets up each scenario to avoid upgrade errors.
[0117] In this embodiment, the step of upgrading the upgradeable area according to the data of the upgrade package to obtain the upgraded application program includes:
[0118] The application data in the upgradeable area is cleared, and the received upgrade data is written into the corresponding address of the upgradeable area.
[0119] During the upgrade process of the upgradeable area of the processor, the system on chip repeatedly sends upgrade data until the upgrade is completed and sends an upgrade completion instruction.
[0120] In the above processor upgrade method, the current running partition and the upgradeable area can be clearly identified by setting the activation flag. When the processor starts, the activation flag is used as a judgment mark to activate the running partition, replacing the Boot function of the traditional boot partition. There is no need to set the boot partition, saving processor storage space. The processor memory is set to include the first running partition and the second running partition. Function processing and upgrade processes are executed in the current running partition. Even if the upgrade of the upgradeable area fails, it will not affect the use of the function.
[0121] In one embodiment, Figure 5 As shown, a processor upgrade device 10 is provided, comprising: an operation partition setting module 1, an activation mark management module 2, an upgradeable area identification module 3, an upgrade target judgment module 4, and an upgrade control module 5.
[0122] The running partition setting module 1 is used to obtain processor memory, and set the processor memory to include a first running partition and a second running partition, wherein the first running partition and the second running partition are used to store the same application program.
[0123] The activation flag management module 2 is used to set an activation flag, and control the first running partition and the second running partition not to run at the same time through the activation flag.
[0124] The upgradeable area identification module 3 is used for detecting whether the first running partition and the second running partition are running in response to receiving an upgrade instruction from the processor memory, marking the running first running partition / the second running partition as the current running partition, and marking the non-running second running partition / the first running partition as an upgradeable area.
[0125] The upgrade target determination module 4 is used to determine whether the application version in the upgradeable area is the same as the application version in the upgrade package. If they are different, the upgradeable area is set as the target upgrade area.
[0126] The upgrade control module 5 is used for upgrading the upgradeable area according to the data of the upgrade package to obtain an upgraded application program in response to the upgradeable area being a target upgrade area.
[0127] In this embodiment, the setting of the activation flag and controlling the first running partition and the second running partition to not run at the same time by the activation flag includes:
[0128] Storing the address of the first running partition and the address of the second running partition in a base address register;
[0129] Setting an activation flag in the base address register, the activation flag being used to point to an address of a run partition activated when the processor is started;
[0130] In response to the processor being powered on, the address pointed to by the activation flag is read, and the running partition corresponding to the address pointed to by the activation flag is controlled to be powered on and activated.
[0131] In this embodiment, if Figure 5 As shown, the processor upgrade device 10 also includes an update management module 6. The update management module 6 is used to: after the upgrade of the upgradeable area is completed, determine whether there is a problem with the upgrade of the upgradeable area; if there is a problem with the upgrade of the upgradeable area, keep the address pointed to by the activation mark unchanged, and continue to run the application of the currently running partition after the processor is restarted; if there is no problem with the upgrade of the upgradeable area, update the address of the activation mark to point to the upgradeable area, and feedback the success of the upgrade of the upgradeable area to the system on chip and / or the user interaction interface.
[0132] In this embodiment, if Figure 5 As shown, the processor upgrading device 10 further includes a restart management module 7 .
[0133] The restart management module 7 is used to: after the upgrade of the upgradeable area is completed, send a reminder message to confirm whether to restart; in response to receiving a restart instruction, control the processor to restart, and activate the corresponding running partition according to the address pointed to by the activation flag; in response to not receiving a restart instruction or receiving a no restart instruction, control the processor not to restart.
[0134] In this embodiment, the upgrade control module 5 is also used for: in response to the system on chip receiving an upgrade instruction, verifying the upgrade data to determine whether the system on chip and the processor are upgraded; if so, the system on chip controls its own system upgrade, and the system on chip sends the upgrade instruction and upgrade data of the processor memory to the processor; after the processor receives the upgrade instruction of the processor memory, the processor verifies the upgrade data and feeds back the verification result of the processor to the system on chip; the system on chip determines whether the processor is restarted based on its own upgrade status and the verification result of the processor.
[0135] In this embodiment, the upgrade target determination module 4 is used to: determine whether the application version in the current running partition is the same as the application version in the upgrade package, and if they are different, the current running partition is the target upgrade area;
[0136] The update management module 6 is used for: when the current running partition is the target upgrade area, after the upgrade of the upgradeable area is completed, changing the address pointed by the activation mark to the address of the upgradeable area, and controlling the processor to restart.
[0137] Specifically, the upgrade target determination module 4 is used to determine whether the upgradeable area is a target upgrade area according to whether the application version in the upgradeable area is different from the application version in the upgrade package, including:
[0138] Setting the first running partition and the second running partition to store application version data respectively;
[0139] Comparing the application version data in the upgradeable area and the upgrade package;
[0140] If the application version in the upgradeable area is the same as the application version in the upgrade package, determining that the upgradeable area is not a target upgrade area;
[0141] If the application version in the upgradeable area is different from the application version in the upgrade package, the upgradeable area is determined to be a target upgrade area.
[0142] In this embodiment, the upgrade target judgment module 4 is used to: compare the application version data in the current running partition and the upgrade package; if the application version in the current running partition is the same as the application version in the upgrade package, then determine that the current running partition is not the target upgrade area; if the application version in the current running partition is different from the application version in the upgrade package, then determine that the current running partition is the target upgrade area.
[0143] The update management module 6 is used for: when the current running partition is not the target upgrade area and the upgradeable area is the target upgrade area, after the upgrade of the upgradeable area is completed, updating the application version data in the upgradeable area according to the upgraded application version, and changing the address pointed by the activation mark to the address of the upgradeable area; when the current running partition and the upgradeable area are both target upgrade areas, after the upgrade of the upgradeable area is completed, updating the application version data in the upgradeable area according to the upgraded application version, changing the address pointed by the activation mark to the address of the upgradeable area, and controlling the processor to restart; when the current running partition is the target upgrade area and the upgradeable area is not the target upgrade area, changing the address pointed by the activation mark to the address of the upgradeable area, and controlling the processor to restart.
[0144] The upgrade control module 5 is further used for: when neither the current running partition nor the upgradeable area is the target upgrade area, terminating the upgrade and feeding back that the processor does not need to be upgraded.
[0145] In this embodiment, the step of upgrading the upgradeable area according to the data of the upgrade package to obtain the upgraded application program includes:
[0146] The application data in the upgradeable area is cleared, and the received upgrade data is written into the corresponding address of the upgradeable area.
[0147] In the above-mentioned processor upgrade device, the current running partition and the upgradeable area can be clearly identified by setting the activation flag. When the processor is started, the activation flag is used as a judgment mark to activate the running partition, replacing the Boot function of the traditional boot partition. There is no need to set the boot partition, saving processor storage space. The processor memory is set to include the first running partition and the second running partition. Function processing and upgrade processes are executed in the current running partition. Even if the upgrade of the upgradeable area fails, it will not affect the use of the function.
[0148] For the specific definition of the processor upgrade device, please refer to the definition of the processor upgrade method above, which will not be repeated here. Each module in the above-mentioned processor upgrade device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0149] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0150] Acquire a processor memory, and set the processor memory to include a first running partition and a second running partition, wherein the first running partition and the second running partition are used to store the same application program;
[0151] Setting an activation flag, and controlling the first running partition and the second running partition not to run at the same time by using the activation flag;
[0152] In response to receiving an upgrade instruction from the processor memory, detecting whether the first running partition and the second running partition are running, marking the running first running partition / the second running partition as a current running partition, and marking the non-running second running partition / the first running partition as an upgradeable partition;
[0153] Determine whether the application version in the upgradeable area is the same as the application version in the upgrade package, and if they are different, set the upgradeable area as the target upgrade area;
[0154] In response to the upgradeable area being a target upgrade area, the upgradeable area is upgraded according to the data of the upgrade package to obtain an upgraded application program.
[0155] In one embodiment, the computer program further implements the following steps when executed by a processor:
[0156] The setting of the activation flag, and controlling the first running partition and the second running partition to not run at the same time by using the activation flag, comprises:
[0157] Storing the address of the first running partition and the address of the second running partition in a base address register;
[0158] An activation flag is set in the base address register, the activation flag being used to point to the processor
[0159] In response to the processor being powered on, the address pointed to by the activation flag is read, and the running partition corresponding to the address pointed to by the activation flag is controlled to be powered on and activated.
[0160] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0161] After the upgrade of the upgradeable area is completed, determining whether there is a problem with the upgrade of the upgradeable area;
[0162] If the upgrade of the upgradeable area fails, the address pointed to by the activation flag is kept unchanged, the processor is restarted, and the application of the currently running partition is continued to run;
[0163] If the upgradeable area is successfully upgraded, the activation mark is updated to point to the address of the upgradeable area, and the upgrade success of the upgradeable area is fed back to the system on chip and / or the user interaction interface.
[0164] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0165] After the upgrade of the upgradeable area is completed, a reminder message is sent to confirm whether to restart;
[0166] In response to receiving the restart instruction, controlling the processor to restart, and activating the corresponding running partition according to the address pointed to by the activation flag;
[0167] In response to not receiving a restart instruction or receiving a non-restart instruction, controlling the processor not to restart.
[0168] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0169] In response to the system on chip receiving the upgrade instruction, verifying the upgrade data to determine whether the system on chip and the processor are upgraded;
[0170] If yes, the system on chip controls its own system upgrade, and the system on chip sends the upgrade instruction and upgrade data of the processor memory to the processor;
[0171] After receiving the upgrade instruction of the processor memory, the processor verifies the upgrade data and feeds back the verification result of the processor to the system on chip;
[0172] The system on chip determines whether to restart the processor according to its own upgrade status and the verification result of the processor.
[0173] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0174] Determine whether the application version in the current running partition is the same as the application version in the upgrade package, if they are different, the current running partition is the target upgrade area;
[0175] When the current running partition is the target upgrade area, after the upgrade of the upgradeable area is completed, the address pointed to by the activation mark is changed to the address of the upgradeable area, and the processor is controlled to restart.
[0176] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0177] The step of upgrading the upgradeable area according to the data of the upgrade package to obtain the upgraded application program comprises:
[0178] The application data in the upgradeable area is cleared, and the received upgrade data is written into the corresponding address of the upgradeable area.
[0179] For specific limitations on the steps implemented when the computer program is executed by the processor, please refer to the limitations on the method for processor upgrade mentioned above, which will not be repeated here.
[0180] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store processor upgrade data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a processor upgrade method is implemented.
[0181] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0182] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0183] Acquire a processor memory, and set the processor memory to include a first running partition and a second running partition, wherein the first running partition and the second running partition are used to store the same application program;
[0184] Setting an activation flag, and controlling the first running partition and the second running partition not to run at the same time by using the activation flag;
[0185] In response to receiving an upgrade instruction from the processor memory, detecting whether the first running partition and the second running partition are running, marking the running first running partition / the second running partition as a current running partition, and marking the non-running second running partition / the first running partition as an upgradeable partition;
[0186] Determine whether the application version in the upgradeable area is the same as the application version in the upgrade package, and if they are different, set the upgradeable area as the target upgrade area;
[0187] In response to the upgradeable area being a target upgrade area, the upgradeable area is upgraded according to the data of the upgrade package to obtain an upgraded application program.
[0188] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0189] The setting of the activation flag, and controlling the first running partition and the second running partition to not run at the same time by using the activation flag, comprises:
[0190] Storing the address of the first running partition and the address of the second running partition in a base address register;
[0191] Setting an activation flag in the base address register, the activation flag being used to point to an address of a run partition activated when the processor is started;
[0192] In response to the processor being powered on, the address pointed to by the activation flag is read, and the running partition corresponding to the address pointed to by the activation flag is controlled to be powered on and activated.
[0193] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0194] After the upgrade of the upgradeable area is completed, determining whether there is a problem with the upgrade of the upgradeable area;
[0195] If the upgrade of the upgradeable area fails, the address pointed to by the activation flag is kept unchanged, the processor is restarted, and the application of the currently running partition is continued to run;
[0196] If the upgradeable area is successfully upgraded, the activation mark is updated to point to the address of the upgradeable area, and the upgrade success of the upgradeable area is fed back to the system on chip and / or the user interaction interface.
[0197] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0198] After the upgrade of the upgradeable area is completed, a reminder message is sent to confirm whether to restart;
[0199] In response to receiving the restart instruction, controlling the processor to restart, and activating the corresponding running partition according to the address pointed to by the activation flag;
[0200] In response to not receiving a restart instruction or receiving a non-restart instruction, controlling the processor not to restart.
[0201] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0202] In response to the system on chip receiving the upgrade instruction, verifying the upgrade data to determine whether the system on chip and the processor are upgraded;
[0203] If yes, the system on chip controls its own system upgrade, and the system on chip sends the upgrade instruction and upgrade data of the processor memory to the processor;
[0204] After receiving the upgrade instruction of the processor memory, the processor verifies the upgrade data and feeds back the verification result of the processor to the system on chip;
[0205] The system on chip determines whether to restart the processor according to its own upgrade status and the verification result of the processor.
[0206] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0207] Determine whether the application version in the current running partition is the same as the application version in the upgrade package, if they are different, the current running partition is the target upgrade area;
[0208] When the current running partition is the target upgrade area, after the upgrade of the upgradeable area is completed, the address pointed to by the activation mark is changed to the address of the upgradeable area, and the processor is controlled to restart.
[0209] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0210] The step of upgrading the upgradeable area according to the data of the upgrade package to obtain the upgraded application program comprises:
[0211] The application data in the upgradeable area is cleared, and the received upgrade data is written into the corresponding address of the upgradeable area.
[0212] For specific limitations on the steps implemented when the processor executes a computer program, please refer to the limitations on the method for processor upgrade mentioned above, which will not be repeated here.
[0213] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0214] Acquire a processor memory, and set the processor memory to include a first running partition and a second running partition, wherein the first running partition and the second running partition are used to store the same application program;
[0215] Setting an activation flag, and controlling the first running partition and the second running partition not to run at the same time by using the activation flag;
[0216] In response to receiving an upgrade instruction from the processor memory, detecting whether the first running partition and the second running partition are running, marking the running first running partition / the second running partition as a current running partition, and marking the non-running second running partition / the first running partition as an upgradeable partition;
[0217] Determine whether the application version in the upgradeable area is the same as the application version in the upgrade package, and if they are different, set the upgradeable area as the target upgrade area;
[0218] In response to the upgradeable area being a target upgrade area, the upgradeable area is upgraded according to the data of the upgrade package to obtain an upgraded application program.
[0219] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0220] The setting of the activation flag, and controlling the first running partition and the second running partition to not run at the same time by using the activation flag, comprises:
[0221] Storing the address of the first running partition and the address of the second running partition in a base address register;
[0222] Setting an activation flag in the base address register, the activation flag being used to point to an address of a run partition activated when the processor is started;
[0223] In response to the processor being powered on, the address pointed to by the activation flag is read, and the running partition corresponding to the address pointed to by the activation flag is controlled to be powered on and activated.
[0224] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0225] After the upgrade of the upgradeable area is completed, determining whether there is a problem with the upgrade of the upgradeable area;
[0226] If the upgrade of the upgradeable area fails, the address pointed to by the activation flag is kept unchanged, the processor is restarted, and the application of the currently running partition is continued to run;
[0227] If the upgradeable area is successfully upgraded, the activation mark is updated to point to the address of the upgradeable area, and the upgrade success of the upgradeable area is fed back to the system on chip and / or the user interaction interface.
[0228] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0229] After the upgrade of the upgradeable area is completed, a reminder message is sent to confirm whether to restart;
[0230] In response to receiving the restart instruction, controlling the processor to restart, and activating the corresponding running partition according to the address pointed to by the activation flag;
[0231] In response to not receiving a restart instruction or receiving a non-restart instruction, controlling the processor not to restart.
[0232] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0233] In response to the system on chip receiving the upgrade instruction, verifying the upgrade data to determine whether the system on chip and the processor are upgraded;
[0234] If yes, the system on chip controls its own system upgrade, and the system on chip sends the upgrade instruction and upgrade data of the processor memory to the processor;
[0235] After receiving the upgrade instruction of the processor memory, the processor verifies the upgrade data and feeds back the verification result of the processor to the system on chip;
[0236] The system on chip determines whether to restart the processor according to its own upgrade status and the verification result of the processor.
[0237] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0238] Determine whether the application version in the current running partition is the same as the application version in the upgrade package, if they are different, the current running partition is the target upgrade area;
[0239] When the current running partition is the target upgrade area, after the upgrade of the upgradeable area is completed, the address pointed to by the activation mark is changed to the address of the upgradeable area, and the processor is controlled to restart.
[0240] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0241] The step of upgrading the upgradeable area according to the data of the upgrade package to obtain the upgraded application program comprises:
[0242] The application data in the upgradeable area is cleared, and the received upgrade data is written into the corresponding address of the upgradeable area.
[0243] For specific limitations on the steps implemented when the computer program is executed by the processor, please refer to the limitations on the method for processor upgrade mentioned above, which will not be repeated here.
[0244] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0245] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0246] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A processor upgrade method, characterized in that: include: Acquire a processor memory, and set the processor memory to include a first running partition and a second running partition, wherein the first running partition and the second running partition are used to store the same application program; Setting an activation flag, and controlling the first running partition and the second running partition not to run at the same time by using the activation flag; In response to receiving an upgrade instruction from the processor memory, detecting whether the first running partition and the second running partition are running, marking the running first running partition / the second running partition as a current running partition, and marking the non-running second running partition / the first running partition as an upgradeable partition; Determine whether the application version in the upgradeable area is the same as the application version in the upgrade package, and if they are different, set the upgradeable area as the target upgrade area; The upgradeable area is upgraded according to the data of the upgrade package to obtain an upgraded application program.
2. The processor upgrade method according to claim 1, characterized in that: The setting of the activation flag, and controlling the first running partition and the second running partition to not run at the same time by using the activation flag, comprises: Storing the address of the first running partition and the address of the second running partition in a base address register; Setting an activation flag in the base address register, the activation flag being used to point to an address of a run partition activated when the processor is started; In response to the processor being powered on, the address pointed to by the activation flag is read, and the running partition corresponding to the address pointed to by the activation flag is controlled to be powered on and activated.
3. The processor upgrade method according to claim 2, characterized in that: The processor upgrade method further includes: After the upgrade of the upgradeable area is completed, determining whether there is a problem with the upgrade of the upgradeable area; If the upgrade of the upgradeable area fails, the address pointed to by the activation flag is kept unchanged, the processor is restarted, and the application of the currently running partition is continued to run; If the upgradeable area is successfully upgraded, the activation mark is updated to point to the address of the upgradeable area, and the upgrade success of the upgradeable area is fed back to the system on chip and / or the user interaction interface.
4. The processor upgrade method according to claim 3, characterized in that: The processor upgrade method further includes: After the upgrade of the upgradeable area is completed, a reminder message is sent to confirm whether to restart; In response to receiving the restart instruction, controlling the processor to restart, and activating the corresponding running partition according to the address pointed to by the activation flag; In response to not receiving a restart instruction or receiving a non-restart instruction, controlling the processor not to restart.
5. The processor upgrade method according to claim 2, characterized in that: The processor upgrade method further includes: In response to the system on chip receiving the upgrade instruction, verifying the upgrade data to determine whether the system on chip and the processor are upgraded; If yes, the system on chip controls its own system upgrade, and the system on chip sends the upgrade instruction and upgrade data of the processor memory to the processor; After receiving the upgrade instruction of the processor memory, the processor verifies the upgrade data and feeds back the verification result of the processor to the system on chip; The system on chip determines whether to restart the processor according to its own upgrade status and the verification result of the processor.
6. The processor upgrade method according to claim 1, characterized in that: The processor upgrade method further includes: Determine whether the application version in the current running partition is the same as the application version in the upgrade package, if they are different, the current running partition is the target upgrade area; When the current running partition is the target upgrade area, after the upgrade of the upgradeable area is completed, the address pointed to by the activation mark is changed to the address of the upgradeable area, and the processor is controlled to restart.
7. The processor upgrade method according to claim 1, characterized in that: The step of upgrading the upgradeable area according to the data of the upgrade package to obtain the upgraded application program comprises: The application data in the upgradeable area is cleared, and the received upgrade data is written into the corresponding address of the upgradeable area.
8. A processor upgrade device, characterized in that: The device comprises: An operation partition setting module, used for acquiring a processor memory, and setting the processor memory to include a first operation partition and a second operation partition, wherein the first operation partition and the second operation partition are used for storing the same application program; an activation flag management module, used to set an activation flag, and control the first running partition and the second running partition not to run at the same time through the activation flag; an upgradeable area identification module, configured to detect whether the first running partition and the second running partition are running in response to receiving an upgrade instruction from the processor memory, mark the running first running partition / the second running partition as a current running partition, and mark the non-running second running partition / the first running partition as an upgradeable area; An upgrade target determination module, used to determine whether the application version in the upgradeable area is the same as the application version in the upgrade package, and if they are different, set the upgradeable area as the target upgrade area; The upgrade control module is used to upgrade the upgradeable area according to the data of the upgrade package to obtain an upgraded application program in response to the upgradeable area being a target upgrade area.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.