Chip online upgrading method and device
By deploying online upgrades in the film and independently upgraded, the problem of poor online upgrade security of chip has been solved, and higher upgrade security and reliability are achieved.
Patent Information
- Application Number
- CN202411475602.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-01-28
AI Technical Summary
The existing chip online upgrade technology has poor security problems, and the failure of the upgrade may cause the software application to fail to run normally.
By deploying online upgrade data in the videos of the film, and using a communication interface to establish a connection with the memory internal memory of the chip, the online upgrade data and software applications are independently upgraded to avoid unexpectedly trigger the Bootloader function.
Improving the security of the online upgrade of the chip and ensuring that software applications will not be accidentally interrupted during the upgrade process, which improves the reliability and security of upgrade.
Smart Images

Figure CN119376773A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a chip online upgrade method and device. Background Art
[0002] The bootloader is a program that runs before the operating system kernel or user application runs. The bootloader function is used to implement online chip upgrades, which allows the firmware or software application (Application, app) on the chip to be updated and upgraded through the network without physically updating the chip.
[0003] At present, the Bootloader is basically stored in the chip's on-chip memory. It is possible that the software application in the chip's on-chip memory is accidentally triggered to use the Bootloader function. If the upgrade fails, the software application in the chip's on-chip memory will not be able to run normally, causing serious impact on the software application. Alternatively, when the Bootloader function needs to be upgraded, if the upgrade fails, the software application may not be able to run normally. Based on the above two situations, the security of the chip online upgrade is poor.
[0004] Therefore, how to improve the security of online chip upgrades has become an urgent problem that needs to be solved. Summary of the invention
[0005] In view of this, an embodiment of the present application provides a chip online upgrade method and device, aiming to improve the security of chip online upgrade.
[0006] In a first aspect, an embodiment of the present application provides a chip online upgrade method, the method comprising:
[0007] Establishing a connection with an on-chip memory of a chip through a communication interface, wherein the on-chip memory of the chip is used to store software applications;
[0008] If an upgrade instruction for the online upgrade data is received, programming operation is performed on the online upgrade data through the chip to obtain upgraded online upgrade data;
[0009] If an upgrade instruction for the software application is received, the online upgrade data is read based on the off-chip memory, and the software application is upgraded according to the online upgrade data to obtain an upgraded software application.
[0010] Optionally, the software application includes a first application and a second application, and if an upgrade instruction for the software application is received, reading the online upgrade data based on the off-chip memory, upgrading the software application according to the online upgrade data, and obtaining an upgraded software application includes:
[0011] When the first application is in a running state, the second application is in a non-running state. If an upgrade instruction for the software application is received, the online upgrade data is read based on the off-chip memory, and the second application is upgraded according to the online upgrade data to obtain an upgraded second application.
[0012] Optionally, the method further comprises:
[0013] If the second application fails to be upgraded, the first application is run.
[0014] Optionally, the method further comprises:
[0015] Clearing the online upgrade data and performing a partition replacement operation so that the first application is in a non-operating state and the upgraded second application is in a running state;
[0016] The online upgrade data is read based on the off-chip memory, and the first application is upgraded according to the online upgrade data to obtain an upgraded first application.
[0017] Optionally, the method further comprises:
[0018] If the first application fails to be upgraded, the upgraded second application is run.
[0019] Optionally, if an upgrade instruction for the software application is received, reading the online upgrade data based on the off-chip memory, and upgrading the software application according to the online upgrade data to obtain an upgraded software application includes:
[0020] If upgrade instructions and update data for the software application are received through the communication interface, the online upgrade data is read based on the off-chip memory, and the software application is upgraded according to the online upgrade data and the update data to obtain an upgraded software application; the update data is used to indicate the data that the upgraded software application should have.
[0021] In a second aspect, an embodiment of the present application provides a chip online upgrade device, the device comprising:
[0022] A connection module, used to establish a connection with a chip on-chip memory through a communication interface, wherein the chip on-chip memory is used to store software applications;
[0023] A first upgrade module, configured to, upon receiving an upgrade instruction for the online upgrade data, perform a programming operation on the online upgrade data through the chip to obtain upgraded online upgrade data;
[0024] The second upgrade module is used to read the online upgrade data based on the off-chip memory when an upgrade instruction for the software application is received, and upgrade the software application according to the online upgrade data to obtain an upgraded software application.
[0025] Optionally, the software application includes a first application and a second application, and the second upgrade module includes:
[0026] The first upgrade unit is used for, when the first application is in a running state and the second application is in a non-running state, if an upgrade instruction for the software application is received, reading the online upgrade data based on the off-chip memory, and upgrading the second application according to the online upgrade data to obtain an upgraded second application.
[0027] Optionally, the device further comprises:
[0028] The first running unit is configured to run the first application if the upgrade of the second application fails.
[0029] Optionally, the device further comprises:
[0030] a replacement unit, configured to clear the online upgrade data and perform a partition replacement operation so that the first application is in a non-operating state and the upgraded second application is in an operating state;
[0031] The second upgrading unit is used to read the online upgrading data based on the off-chip memory, and upgrade the first application according to the online upgrading data to obtain the upgraded first application.
[0032] Optionally, the device further comprises:
[0033] The second running unit is configured to run the upgraded second application if the upgrade of the first application fails.
[0034] Optionally, the second upgrade module includes:
[0035] A third upgrade unit is used to read the online upgrade data based on the off-chip memory when an upgrade instruction and update data for the software application are received through the communication interface, and to upgrade the software application according to the online upgrade data and the update data to obtain an upgraded software application; the update data is used to indicate the data that the upgraded software application should have.
[0036] In a third aspect, an embodiment of the present application provides a chip online upgrade device, the device comprising:
[0037] Memory for storing computer programs;
[0038] The processor is used to execute the computer program so that the device executes the chip online upgrade method described in the first aspect.
[0039] In a fourth aspect, an embodiment of the present application provides a computer storage medium, wherein a computer program is stored on the computer-readable storage medium. When the computer program is executed, the device executing the computer program implements the chip online upgrade method described in the first aspect above.
[0040] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0041] The embodiment of the present application provides a chip online upgrade method, which provides a solution for implementing chip online upgrade using off-chip memory, and the online upgrade data is deployed in the off-chip memory. The method includes: establishing a connection with the chip on-chip memory through a communication interface, and the chip on-chip memory is used to store software applications. If an upgrade instruction for online upgrade data is received, the online upgrade data is programmed through the chip to obtain the upgraded online upgrade data. Since the online upgrade and the software application are stored in the off-chip memory and the on-chip memory respectively, the upgrade of the online upgrade data alone does not affect the normal operation of the software application, thereby improving the security of the chip online upgrade from the perspective of upgrading the online upgrade data. If an upgrade instruction for the software application is received, the online upgrade data is read based on the off-chip memory, and the software application is upgraded according to the online upgrade data to obtain the upgraded software application. Since the online upgrade data is stored separately in the off-chip memory, the bootloader function will not be accidentally triggered during the operation of the software application. When the software application needs to be upgraded, the online upgrade data only needs to be read from the off-chip memory to complete the upgrade of the software application through the online upgrade data, thereby improving the security of the chip online upgrade from the perspective of upgrading the software application. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 A flowchart of a chip online upgrade method provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of the structure of the online upgrade method provided in the embodiment of the present application;
[0045] Figure 3 A schematic diagram of the structure of a chip online upgrade device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0047] At present, the Bootloader is basically stored in the chip's on-chip memory. It is possible that the software application in the chip's on-chip memory is accidentally triggered to use the Bootloader function. If the upgrade fails, the software application in the chip's on-chip memory will not be able to run normally, causing serious impact on the software application. Alternatively, when the Bootloader function needs to be upgraded, if the upgrade fails, the software application may not be able to run normally. Based on the above two situations, the security of the chip online upgrade is poor.
[0048] Therefore, how to improve the security of online chip upgrades has become an urgent problem that needs to be solved.
[0049] Based on this, in order to solve the above problems, in an embodiment of the present application, the method provides a solution for realizing online chip upgrade using off-chip memory, and the online upgrade data is deployed in the off-chip memory. The method includes: establishing a connection with the chip on-chip memory through a communication interface, and the chip on-chip memory is used to store software applications. If an upgrade instruction for online upgrade data is received, the online upgrade data is programmed through the chip to obtain the upgraded online upgrade data. Since the online upgrade and the software application are stored in the off-chip memory and the on-chip memory respectively, the upgrade of the online upgrade data alone does not affect the normal operation of the software application, thereby improving the security of the chip online upgrade from the perspective of upgrading the online upgrade data. If an upgrade instruction for the software application is received, the online upgrade data is read based on the off-chip memory, and the software application is upgraded according to the online upgrade data to obtain the upgraded software application. Since the online upgrade data is stored separately in the off-chip memory, the bootloader function will not be accidentally triggered during the operation of the software application. When the software application needs to be upgraded, the online upgrade data can be completed by reading the online upgrade data from the off-chip memory, thereby improving the security of the chip online upgrade from the perspective of upgrading the software application.
[0050] The specific implementation of the chip online upgrade method and device in the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0051] See also Figure 1 , which is a flow chart of a chip online upgrade method provided in an embodiment of the present application, combined with Figure 1 As shown, it may specifically include:
[0052] S101: Establishing a connection with an on-chip memory of a chip through a communication interface, where the on-chip memory of the chip is used to store software applications.
[0053] Off-chip memory refers to memory located outside the main chip (such as the central processing unit (CPU) or a single-chip microcomputer). The off-chip memory can be connected to the main chip through a specific communication interface, so that the main chip can read the online upgrade data stored in the off-chip memory through the communication interface.
[0054] Online upgrade data boot data is used to implement the Bootloader function. For example, online upgrade data includes app erasure, programming and other operation data. Among them, online upgrade refers to the process of transferring new firmware or software versions to the device through the network or communication interface without disassembling the embedded device and replacing the original version.
[0055] In the embodiment of the present application, the online upgrade data is deployed in the off-chip memory, and the chip on-chip memory is used to store the software application app related code, so it can avoid the situation where the Bootloader function is accidentally triggered during the application process of the app in the chip. Since the chip off-chip memory is used to store online upgrade data, it only affects the Bootloader function and does not affect the normal use of the app. When the online upgrade data needs to be upgraded, the off-chip memory can establish a connection with the chip on-chip memory through the communication interface to upgrade the online upgrade data through the software application used to upgrade the boot data in the chip, thereby realizing a safe and independent upgrade of the boot data.
[0056] For example, the communication interface may be a serial port, a network, a Universal Serial Bus (USB), etc., and the present application does not specifically limit the communication interface.
[0057] S102: If an upgrade instruction for online upgrade data is received, a programming operation is performed on the online upgrade data through the chip to obtain upgraded online upgrade data.
[0058] The upgrade instruction for the online upgrade data is used to indicate an instruction for upgrading and updating the online upgrade data.
[0059] As an example, when an upgrade instruction for online upgrade data is received through the host computer, and the off-chip memory is connected to the chip on-chip memory through the communication interface, the online upgrade data can be upgraded based on the chip. For example, after receiving the upgrade instruction, a new version of online upgrade data can be received, so that the app in the chip for upgrading the online upgrade data can perform programming operations based on the received new version of online upgrade data to update the online upgrade data and obtain the upgraded online upgrade data.
[0060] If the Bootloader function cannot be used normally, the app used to upgrade the online upgrade data in the chip can be used to perform programming operations based on the received new version of the online upgrade data, thereby upgrading the boot data again. If the upgrade is successful, the Bootloader function can be used normally.
[0061] In addition, in the case where the off-chip memory supports physical replacement, the boot data can also be upgraded by physical replacement. In this regard, the present application does not specifically limit the method of upgrading the online upgrade data.
[0062] S103: If an upgrade instruction for the software application is received, online upgrade data is read based on the off-chip memory, and the software application is upgraded according to the online upgrade data to obtain an upgraded software application.
[0063] In a possible implementation, reference may be made to Figure 2 , Figure 2 A structural diagram of the online upgrade method provided in an embodiment of the present application, wherein the software application includes a first application APP_1 and a second application APP_2. That is, in order to ensure that the bootloader does not damage the running software application during the upgrade process, the software application can be divided into two identical applications, namely, the codes of the first application and the second application are consistent and the functions are the same, and one of the applications can be selected as the active space, and correspondingly, the other application is used as the dormant space. When it is necessary to upgrade the software application, you can choose to upgrade the other application to ensure the operational security of the software application. For example, the first application is selected as the active space, that is, when the first application is in a running state, the second application is in a non-running state, and the second application is used as the dormant space. When the first application receives an upgrade instruction for the software application through the communication interface, the online upgrade data can be read from the off-chip memory, so that the second application can be upgraded according to the online upgrade data to obtain the upgraded second application.
[0064] Specifically, if an upgrade instruction and update data for a software application are received through the communication interface, the update data is used to indicate data that the upgraded software application should have, such as the version number of the upgraded software application, etc., and the present application does not specifically limit the update data. The online upgrade data is read based on the off-chip memory to upgrade the software application according to the online upgrade data and the update data to obtain the upgraded software application.
[0065] Since the first application and the second application have the same code and the same functions, when the first application is in a running state, the second application is in a non-running state. When the software application needs to be upgraded, the second application can be upgraded according to the read online upgrade data. When the second application is upgraded successfully, the second application can be run, and accordingly, the first application is in a non-running state. If the upgrade of the second application fails, such as the upgrade is interrupted, the first application is run, thereby protecting the normal operation of the software application and improving the security of the software application.
[0066] As an example, after receiving the update data through the communication interface, and the update data has been completely upgraded to the second application, the online upgrade data can be cleared first, and then the partition replacement operation can be performed, that is, the upgraded second application is in a running state and the first application is in a non-running state. After the partition replacement is successful, the second application is now an active space, the first application is a dormant space, and the code in the second application is an upgraded version of the first application. Accordingly, the online upgrade data can be read from the off-chip memory to upgrade the first application according to the online upgrade data to obtain the upgraded first application. When the first application is successfully upgraded, the first application can be run, and accordingly, the second application is in a non-running state; if the upgrade of the first application fails, such as an upgrade interruption, the second application or the upgraded second application is run, thereby protecting the normal operation of the software application, improving the security of the software application, and improving the security of the online upgrade.
[0067] Furthermore, if an abnormality occurs in the chip's on-chip memory, resulting in an on-chip memory error, the relevant data of the bootloader function will not be affected. In addition, the bootloader function can also be used to upgrade the software application in the chip's on-chip memory to the correct software application.
[0068] Since the first application and the second application have the same code and the same functions, in actual application, only one application needs to be upgraded to meet the code upgrade requirement, that is, to meet the online upgrade requirement.
[0069] It should be noted that the present application does not specifically limit the execution order of S102 and S103.
[0070] The above is a chip online upgrade method provided by an embodiment of the present application. The method provides a solution for implementing chip online upgrade using off-chip memory, and the online upgrade data is deployed in the off-chip memory. The method includes: establishing a connection with the chip on-chip memory through a communication interface, and the chip on-chip memory is used to store software applications. If an upgrade instruction for online upgrade data is received, the online upgrade data is programmed through the chip to obtain the upgraded online upgrade data. Since the online upgrade and the software application are stored in the off-chip memory and the on-chip memory respectively, the upgrade of the online upgrade data alone does not affect the normal operation of the software application, thereby improving the security of the chip online upgrade from the perspective of upgrading the online upgrade data. If an upgrade instruction for the software application is received, the online upgrade data is read based on the off-chip memory, and the software application is upgraded according to the online upgrade data to obtain the upgraded software application. Since the online upgrade data is stored separately in the off-chip memory, the bootloader function will not be accidentally triggered during the operation of the software application. When the software application needs to be upgraded, the online upgrade data can be read from the off-chip memory to complete the upgrade of the software application through the online upgrade data, thereby improving the security of the chip online upgrade from the perspective of upgrading the software application.
[0071] The above are some specific implementations of the chip online upgrade method provided in the embodiment of the present application. Based on this, the present application also provides a corresponding device. The device provided in the embodiment of the present application will be introduced from the perspective of functional modularization.
[0072] See also Figure 3 , which is a schematic diagram of the structure of a chip online upgrade device 300 provided in an embodiment of the present application, and the device 300 may include:
[0073] A connection module 301 is used to establish a connection with a chip internal memory through a communication interface, and the chip internal memory is used to store software applications;
[0074] A first upgrade module 302 is configured to, upon receiving an upgrade instruction for the online upgrade data, perform a programming operation on the online upgrade data through the chip to obtain upgraded online upgrade data;
[0075] The second upgrade module 303 is used to read the online upgrade data based on the off-chip memory when receiving an upgrade instruction for the software application, and upgrade the software application according to the online upgrade data to obtain an upgraded software application.
[0076] Optionally, the software application includes a first application and a second application, and the second upgrade module 303 includes:
[0077] The first upgrade unit is used for, when the first application is in a running state and the second application is in a non-running state, if an upgrade instruction for the software application is received, reading the online upgrade data based on the off-chip memory, and upgrading the second application according to the online upgrade data to obtain an upgraded second application.
[0078] Optionally, the chip online upgrade device 300 further includes:
[0079] The first running unit is configured to run the first application if the upgrade of the second application fails.
[0080] Optionally, the chip online upgrade device 300 further includes:
[0081] a replacement unit, configured to clear the online upgrade data and perform a partition replacement operation so that the first application is in a non-operating state and the upgraded second application is in an operating state;
[0082] The second upgrading unit is used to read the online upgrading data based on the off-chip memory, and upgrade the first application according to the online upgrading data to obtain the upgraded first application.
[0083] Optionally, the chip online upgrade device 300 further includes:
[0084] The second running unit is configured to run the upgraded second application if the upgrade of the first application fails.
[0085] Optionally, the second upgrading module 303 includes:
[0086] A third upgrade unit is used to read the online upgrade data based on the off-chip memory when an upgrade instruction and update data for the software application are received through the communication interface, and to upgrade the software application according to the online upgrade data and the update data to obtain an upgraded software application; the update data is used to indicate the data that the upgraded software application should have.
[0087] The embodiments of the present application also provide corresponding devices and computer storage media for implementing the solutions provided by the embodiments of the present application.
[0088] The device includes a memory and a processor, the memory is used to store a computer program, and the processor is used to execute the computer program, so that the device executes the chip online upgrade method described in any embodiment of the present application.
[0089] The computer storage medium stores a computer program. When the code is executed, the device executing the computer program implements the chip online upgrade method described in any embodiment of the present application.
[0090] The "first" and "second" in the names such as "first" and "second" (if any) mentioned in the embodiments of the present application are only used as name identifiers and do not represent the first or second in order.
[0091] Through the description of the above implementation methods, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a read-only memory (ROM) / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment of the present application or some parts of the embodiments.
[0092] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0093] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A chip online upgrade method, characterized in that: The online upgrade data is deployed in an off-chip memory, and the method includes: Establishing a connection with an on-chip memory of a chip through a communication interface, wherein the on-chip memory of the chip is used to store software applications; If an upgrade instruction for the online upgrade data is received, programming the online upgrade data through the chip to obtain upgraded online upgrade data; If an upgrade instruction for the software application is received, the online upgrade data is read based on the off-chip memory, and the software application is upgraded according to the online upgrade data to obtain an upgraded software application.
2. The method according to claim 1, characterized in that: The software application comprises a first application and a second application, and if an upgrade instruction for the software application is received, the online upgrade data is read based on the off-chip memory, and the software application is upgraded according to the online upgrade data to obtain an upgraded software application, including: When the first application is in a running state, the second application is in a non-running state. If an upgrade instruction for the software application is received, the online upgrade data is read based on the off-chip memory, and the second application is upgraded according to the online upgrade data to obtain an upgraded second application.
3. The method according to claim 2, characterized in that The method further comprises: If the second application fails to be upgraded, the first application is run.
4. The method according to claim 2, characterized in that: The method further comprises: Clearing the online upgrade data and performing a partition replacement operation so that the first application is in a non-operating state and the upgraded second application is in a running state; The online upgrade data is read based on the off-chip memory, and the first application is upgraded according to the online upgrade data to obtain an upgraded first application.
5. The method according to claim 4, characterized in that The method further comprises: If the first application fails to be upgraded, the upgraded second application is run.
6. The method according to claim 1, characterized in that If an upgrade instruction for the software application is received, the online upgrade data is read based on the off-chip memory, and the software application is upgraded according to the online upgrade data to obtain an upgraded software application, including: If upgrade instructions and update data for the software application are received through the communication interface, the online upgrade data is read based on the off-chip memory, and the software application is upgraded according to the online upgrade data and the update data to obtain an upgraded software application; the update data is used to indicate the data that the upgraded software application should have.
7. A chip online upgrade device, characterized in that: The device comprises: A connection module, used to establish a connection with a chip on-chip memory through a communication interface, wherein the chip on-chip memory is used to store software applications; A first upgrade module, configured to, upon receiving an upgrade instruction for the online upgrade data, perform a programming operation on the online upgrade data through the chip to obtain upgraded online upgrade data; The second upgrade module is used to read the online upgrade data based on the off-chip memory when an upgrade instruction for the software application is received, and upgrade the software application according to the online upgrade data to obtain an upgraded software application.
8. The device according to claim 7, characterized in that The software application comprises a first application and a second application, and the second upgrade module comprises: The first upgrade unit is used for, when the first application is in a running state and the second application is in a non-running state, if an upgrade instruction for the software application is received, reading the online upgrade data based on the off-chip memory, and upgrading the second application according to the online upgrade data to obtain an upgraded second application.
9. A chip online upgrade device, characterized in that: The device comprises: Memory for storing computer programs; A processor is used to execute the computer program so that the device performs the chip online upgrade method as claimed in any one of claims 1 to 6.
10. A computer storage medium, characterized in that: The computer storage medium stores a computer program, and when the computer program is executed by a processor, the chip online upgrade method according to any one of claims 1 to 6 is implemented.