System operation method and device of electronic chip, electronic chip and storage medium
By obtaining the verification value after powering on the electronic chip system, we decide whether to enter the user program or the Bootloader program, the problem of inefficient system operation caused by waiting for the host computer instructions in the prior art is solved, and more efficient system operation is achieved.
Patent Information
- Application Number
- CN202111045003.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-07
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2041-09-07
AI Technical Summary
After the electronic chip system is powered on, the existing technology needs to wait for the user instructions of the host computer and the artificially selected reaction time, resulting in inefficient system operation.
After powering on the electronic chip system, the stored first and second verification values are obtained. If the two are consistent, they will enter the user program. If they are inconsistent, they will jump to the Bootloader program for user program updates.
It avoids waiting for user instructions and artificially selected reaction time after the system is powered on, and improves the system operation efficiency of electronic chips.
Smart Images

Figure CN113778485B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic chips, and in particular to a system operation method, device, electronic chip and storage medium of an electronic chip. Background Art
[0002] With the rapid development of electronic chip technology, the application of electronic chips is becoming more and more extensive. In products and equipment equipped with electronic chips, the user program has been solidified in the Flash (Flash memory) memory through the JTAG (Joint Test Action Group) interface when the product equipment leaves the factory, and is packaged in the casing with the control board; however, with the continuous updating of product equipment functions and the continuous changes in user needs, it is necessary to iteratively upgrade the user program of the product equipment. Considering that there is generally no JTAG interface on the outside of the casing of the product equipment, in order to update the user program, the casing of the product equipment must be opened, and the program can be updated only by connecting the emulator to the JTAG port on the main control board. If so, on the one hand, there will be a risk of leakage of the internal circuit structure and the risk of introducing external conductive media due to the destruction of the sealing of the casing; on the other hand, when the number of product equipment is relatively large, not only the maintenance volume is large, but also the maintainability is poor.
[0003] In order to solve the limitations of the above-mentioned user program update, the method of updating the user program online through the serial port is currently generally adopted; the conventional method is to write two programs in the electronic chip: the underlying Bootloader program and the user program, and the Bootloader program is solidified in a Flash in the electronic chip and is not erased. The main process of this method is: when the system is powered on, it enters the Bootloader program, waits to receive the user instruction sent by the host computer, and determines whether to directly enter the user program or perform the user program update operation according to the user instruction; that is, the current technical solution is to manually choose to enter the user program update process or directly enter the user program process after the electronic chip system is powered on. Each time, it is necessary to wait for the user instruction of the host computer and the manually selected reaction time to realize entering the Bootloader program or the user program, resulting in low system operation efficiency of the electronic chip.
[0004] How to improve the system operation efficiency of electronic chips is a technical problem that technical personnel in this field currently need to solve. Summary of the invention
[0005] Based on this, it is necessary to provide an electronic chip system operation method, device, computer equipment and storage medium that can improve the system operation efficiency of the electronic chip in response to the above technical problems.
[0006] A system operation method of an electronic chip, the method comprising:
[0007] After the electronic chip system is powered on, the first verification value and the second verification value stored are obtained; wherein the first verification value is a verification value calculated by the host computer for verifying the user program and sent to the electronic chip, and the second verification value is a verification value calculated by the electronic chip for verifying the user program that was successfully updated last time;
[0008] If the first check value and the second check value are consistent, the user program is entered; if they are inconsistent, the program is jumped to the Bootloader program, and the Bootloader program is used to update the user program of the first CPU.
[0009] In one embodiment, the process of jumping to the Bootloader program and using the Bootloader program to update the user program of the first CPU includes:
[0010] After jumping to the Bootloader program, wait to receive the operation command of the host computer;
[0011] After receiving the operation instruction, according to the operation command, the Bootloader program is used to perform the operation of upgrading the user program or restoring the backup program on the first CPU.
[0012] In one embodiment, the process of performing a user program upgrade operation on the first CPU using the Bootloader program according to the operation command includes:
[0013] According to the operation command, using the Bootloader program to call a first Flash API function to erase a first Flash sector of the first CPU;
[0014] Receiving a first program file of a user program to be updated sent by the host computer, and storing the first program file in the first Flash sector;
[0015] The first program file is used to perform software initialization operations on the first CPU to implement user program upgrade.
[0016] In one embodiment, the process of using the Bootloader program to perform the operation of restoring the backup program on the first CPU according to the operation command includes:
[0017] According to the operation command, using the Bootloader program to obtain a pre-stored backup program file;
[0018] The backup program file is used to perform software initialization operation on the first CPU to restore the backup program.
[0019] In one embodiment, when the electronic chip is a dual-core electronic chip and the second CPU needs to be updated with a user program, the method further includes:
[0020] Obtaining, through the first CPU, a second program file of the user program to be updated of the second CPU from the host computer and storing the file in the shared RAM;
[0021] Calling the second Flash API function of the second CPU by the first CPU to erase the second Flash sector of the second CPU;
[0022] The second program file in the shared RAM is written into the second Flash sector by the first CPU, and the second program file is used to perform software initialization operation on the second CPU to implement user program update.
[0023] In one embodiment, after storing the second program file in the shared RAM, the method further includes:
[0024] Identification information for identifying that a user program update is required for the second CPU is set.
[0025] In one embodiment, after entering the user program, the method further includes:
[0026] receiving an update instruction sent by the host computer; wherein the update instruction is an instruction input by a user for instructing the first CPU to update a user program;
[0027] Jump to the Bootloader program according to the update instruction.
[0028] A system operation device for an electronic chip, the device comprising:
[0029] An acquisition module is used to acquire the stored first verification value and second verification value after the electronic chip system is powered on; wherein the first verification value is a verification value calculated by the host computer for the user program and sent to the electronic chip, and the second verification value is a verification value calculated by the electronic chip for the user program successfully updated last time;
[0030] A first execution module, configured to enter the user program when the first check value and the second check value are consistent;
[0031] The second execution module is used to jump to the Bootloader program when the first check value and the second check value are inconsistent, and use the Bootloader program to update the user program of the first CPU.
[0032] An electronic chip, comprising a first CPU and a second CPU that are communicatively connected, and further comprising the system operation device of the electronic chip as claimed in claim 8.
[0033] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0034] After the electronic chip system is powered on, the first verification value and the second verification value stored are obtained; wherein the first verification value is a verification value calculated by the host computer for verifying the user program and sent to the electronic chip, and the second verification value is a verification value calculated by the electronic chip for verifying the user program that was successfully updated last time;
[0035] If the first check value and the second check value are consistent, the user program is entered; if they are inconsistent, the program is jumped to the Bootloader program, and the Bootloader program is used to update the user program of the first CPU.
[0036] The system operation method, device, electronic chip and storage medium of the above-mentioned electronic chip obtain the stored first verification value and second verification value after the electronic chip system is powered on; wherein the first verification value is the verification value calculated by the host computer for verifying the user program and sent to the electronic chip, and the second verification value is the verification value obtained by the electronic chip for verifying the user program that was successfully updated last time; then, according to whether the preset first verification value and the second verification value are consistent, it is decided whether to enter the Bootloader program or the user program. If the two verification values are consistent, it means that the last user program upgrade was successful, so the user program can be directly entered; if the verification values are inconsistent, it means that the last user program upgrade failed, so it can directly jump to the Bootloader program to perform the user program update operation. Therefore, this method avoids waiting for user instructions from the host computer and the response time of manual selection after the system is powered on, thereby improving the system operation efficiency of the electronic chip. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 An application environment diagram of a system operation method of an electronic chip in one embodiment;
[0038] Figure 2 A schematic flow chart of a method for operating a system of an electronic chip in one embodiment;
[0039] Figure 3 A flowchart of another system operation method of an electronic chip in one embodiment;
[0040] Figure 4 A flowchart of another system operation method of an electronic chip in one embodiment;
[0041] Figure 5 A flowchart of another system operation method of an electronic chip in one embodiment;
[0042] Figure 6 It is a structural block diagram of a system operation device of an electronic chip in one embodiment. DETAILED DESCRIPTION
[0043] 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.
[0044] The system operation method of the electronic chip provided in this application can be applied to Figure 1 In the application environment shown. The host computer 102 communicates with the electronic chip 104 through a network. The host computer 102 may be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices. The electronic chip 104 may be a DSP (Digital Signal Process) chip or other chips provided with an underlying Bootloader program and a user program. The specific type of the electronic chip is not limited in this embodiment.
[0045] In one embodiment, Figure 2 As shown, a system operation method of an electronic chip is provided, and the method is applied to Figure 1 The electronic chip in the example is used to illustrate, including the following steps:
[0046] Step 202, after the electronic chip system is powered on, obtain the stored first verification value and second verification value; wherein the first verification value is the verification value calculated by the host computer for the user program and sent to the electronic chip, and the second verification value is the verification value calculated by the electronic chip for the user program that was successfully updated last time.
[0047] Specifically, powering on the electronic chip system means that the electronic chip is connected to the power supply and the electronic chip is in a powered-on state. The first check value is a check value obtained by the host computer through checking and calculating the program file of the user program. After calculating the check value, the host computer sends the check value to the electronic chip at the same time when sending the program file of the user program to the electronic chip. The electronic chip receives the program file and the first check value sent by the host computer. The second check value is a check value obtained by the electronic chip through checking and calculating the user program that was successfully updated last time. Specifically, after the user program is updated, the electronic chip calculates the corresponding check value according to the successfully updated user program, that is, obtains the second check value; the electronic chip stores the first check value and the second check value in the first preset storage area; when the electronic chip is powered on next time, the first check value sent by the host computer and the second check value obtained by checking and calculating the user program that was successfully updated last time are obtained from the first preset storage area.
[0048] It is understandable that, in actual operation, the first check value and the second check value are stored in the first preset storage area in the electronic chip, generally in the storage area of the non-volatile memory of the electronic chip, to ensure that the first check value and the second check value stored will not be lost after power failure. More specifically, the first check value and the second check value may be stored in different addresses of the same preset storage area, or in different preset storage areas, which is not limited in this embodiment.
[0049] It should also be noted that, generally speaking, after the electronic chip system is powered on, a power-on self-test can be performed, that is, the CPU (Central Processing Unit), memory, floppy disk subsystem, serial and parallel interfaces and other hardware devices are tested to ensure the operating reliability of the electronic chip.
[0050] Step 204: If the first check value and the second check value are consistent, then enter the user program; if they are inconsistent, then jump to the Bootloader program and use the Bootloader program to update the user program of the first CPU.
[0051] Specifically, after obtaining the first check value and the second check value, the first check value and the second check value are compared to determine whether they are consistent; if they are consistent, it means that the last upgrade operation was successful, so the first check value of the user program sent by the host computer is the same as the second check value calculated by the electronic chip itself, so the user program can be directly entered; if they are inconsistent, it means that the last system upgrade operation failed, that is, in the last upgrade operation, after the host computer sent the program file and the first check value of the user program to the electronic chip, due to the failure of the system upgrade operation of the electronic chip, the second check value of the user program that was successfully updated last time in the electronic chip and the first check value of the program file of the user program sent by the host computer are inconsistent, so jump to the Bootloader program, and use the Bootloader program to update the user program of the first CPU. Specifically, after jumping to the Bootloader program, the operation of updating the user program of the first CPU is performed by executing the Bootloader program, thereby realizing the update of the user program of the first CPU.
[0052] It should be noted that the first CPU refers to the CPU in the electronic chip. When there are multiple CPUs in the electronic chip, such as when the electronic chip is a dual-core DSP, the first CPU refers to any CPU in the DSP chip and is not limited to a certain CPU.
[0053] In the system operation method of the above-mentioned electronic chip, after the electronic chip system is powered on, the stored first verification value and the second verification value are obtained; wherein, the first verification value is the verification value calculated by the host computer for verifying the user program and sent to the electronic chip, and the second verification value is the verification value obtained by the electronic chip for verifying the user program that was successfully updated last time; then, according to whether the preset first verification value and the second verification value are consistent, it is decided whether to enter the Bootloader program or the user program. If the two verification values are consistent, it means that the last user program upgrade was successful, so the user program can be entered directly; if the verification values are inconsistent, it means that the last user program upgrade failed, so it can directly jump to the Bootloader program to perform the user program update operation. Therefore, this method avoids waiting for user instructions from the host computer and the response time of manual selection after the system is powered on, and improves the system operation efficiency of the electronic chip.
[0054] like Figure 3 A flowchart of another system operation method of an electronic chip provided by an embodiment of the present invention. Based on the above embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically, in this embodiment, the process of jumping to the Bootloader program and using the Bootloader program to update the user program of the first CPU includes:
[0055] After jumping to the Bootloader program, wait to receive the operation command from the host computer;
[0056] After receiving the operation instruction, according to the operation command, the Bootloader program is used to perform the operation of upgrading the user program or restoring the backup program on the first CPU.
[0057] Specifically, the operation instruction refers to an instruction indicating what type of user program update operation is performed on the first CPU, and the user program update includes the operation of upgrading the user program or restoring the backup program. In this embodiment, upgrading the user program refers to replacing the lower version of the user program currently running in the first CPU with a higher version of the user program; restoring the backup program refers to replacing the user program currently running in the first CPU with a pre-backed-up user program.
[0058] After the electronic chip system is powered on and reset (RESET), the Flash sector address (Boot to Flash) is addressed, the first check value and the second check value are read and jump to the program entry; it is determined whether the first check value and the second check value are consistent. If they are consistent, the user program is directly entered; if they are inconsistent, it jumps to the Bootloader program; the operation instruction sent by the host computer is received, and according to the operation instruction, the Bootloader program determines whether to perform an upgrade operation on the first CPU or to restore the backup program operation.
[0059] In a specific implementation, according to the operation command, the process of using the Bootloader program to perform the user program upgrade operation on the first CPU includes:
[0060] According to the operation command, the first Flash API function is called by the Bootloader program to erase the first Flash sector of the first CPU;
[0061] Receiving a first program file of a user program to be updated sent by a host computer, and storing the first program file in a first Flash sector;
[0062] The first program file is used to perform software initialization operation on the first CPU to implement user program upgrade.
[0063] Specifically, the Bootloader program of the first CPU calls the first Flash API function of the first CPU, and uses the first Flash API function to erase the first Flash sector of the first CPU, and erases the Flash sector that originally stores the program files of the lower version of the user program, so as to make room for the subsequent storage of program files for user program upgrades, so as to write the first program file for the user program to be updated. After receiving the first program file of the user program to be updated sent by the host computer, the first program file is stored in the first Flash sector; then the Bootloader program of the first CPU uses the first program file to perform software initialization operations on the first CPU, so as to install the user program corresponding to the first program file in the first CPU.
[0064] In a specific implementation, according to the operation command, the process of using the Bootloader program to perform the operation of restoring the backup program on the first CPU includes:
[0065] According to the operation command, the Bootloader program is used to obtain the pre-stored backup program file;
[0066] The backup program file is used to perform a software initialization operation on the first CPU to implement a backup program recovery operation.
[0067] Specifically, in this embodiment, it is further considered that when a power outage or human error occurs during the upgrade process, resulting in an interruption of the upgrade, the conventional method is to re-acquire the program file of the user program with a higher version from the host computer, and use the program file to upgrade the user program. However, in some actual operations, it is necessary to restore the user program. Therefore, in this embodiment, the Bootloader program of the first CPU obtains the pre-stored backup program file from the second preset storage area; wherein the second preset storage area is a pre-designated Flash sector, and the backup program file is stored in the Flash sector and will not be erased; when it is necessary to restore the backup program operation of the first CPU, the pre-stored backup program file is obtained from the second preset storage area, and then the second program file is used by the Bootloader program to perform a software initialization operation on the first CPU, so as to install the user program corresponding to the second program file in the first CPU and restore the backup program.
[0068] That is to say, in this embodiment, a function is added to back up the program files of the user program in a certain Flash sector without being erased. Therefore, this embodiment can not only re-upgrade, but also restore the original user program, realizing double-layer protection for the system, thereby improving the security and reliability of the system.
[0069] like Figure 4A flowchart of another system operation method of an electronic chip provided by an embodiment of the present invention. Based on the above embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically, in this embodiment, when the electronic chip is a dual-core electronic chip and the user program needs to be updated for the second CPU, the method further includes:
[0070] Obtaining the second program file of the user program to be updated of the second CPU from the host computer through the first CPU and storing it in the shared RAM;
[0071] Calling the second Flash API function of the second CPU by the first CPU to erase the second Flash sector of the second CPU;
[0072] The first CPU writes the second program file in the shared RAM into the second Flash sector, and uses the second program file to perform software initialization operation on the second CPU to implement user program update.
[0073] It should be noted that when the electronic chip is a dual-core electronic chip, that is, there are two CPUs in the electronic chip, if the user program needs to be updated for the two CPUs respectively, the current technical solution is to switch the serial port connection between the electronic chip and the two CPUs. If the user program needs to be updated for the second CPU, the electronic chip disconnects the serial port connection with the first CPU and establishes a serial port connection with the second CPU, so that the electronic chip and the second CPU can communicate data and implement the user program update for the second CPU. However, this method in the traditional technical solution requires frequent switching of serial port connections, which may cause the problem of transmission data loss.
[0074] In this embodiment, the first CPU sends the received operation instruction or program file to the second CPU2 through IPC (Interprocessor Communication); when the user program of the second CPU needs to be updated, the first CPU obtains the second program file of the user program to be updated of the second CPU from the host computer, and stores the second program file in the shared RAM; the shared RAM refers to the storage space that can be read and written by both the first CPU and the second CPU; then the first CPU calls the Bootloader program of the second CPU, uses the Bootloader program to call the second Flash API function, and erases the second Flash sector of the second CPU; the Bootloader program of the second CPU uses the second program file to perform software initialization operations on the second CPU, thereby realizing the user program update of the second CPU.
[0075] It can be seen that the method of this embodiment can avoid frequent switching of serial ports and different CPUs, thereby reducing the risk of data loss.
[0076] As a preferred implementation, after storing the second program file in the shared RAM, the method further includes:
[0077] Identification information for identifying that a user program update is required for the second CPU is set.
[0078] In this embodiment, after the second program file is written into the shared RAM, identification information is further set, and the identification information is used to identify that the user program of the second CPU needs to be updated. After the first CPU detects the identification information, it starts to execute the operation of updating the user program of the second CPU.
[0079] More specifically, the identification information IPC Flag is set to identify whether the user program of the second CPU needs to be updated; for example, when IPC Flag = 0, it indicates that the user program of the second CPU does not need to be updated; when IPC Flag = 1, it indicates that the user program of the second CPU needs to be updated; in addition, the identification information IPC Flag used to identify whether the user program of the second CPU needs to be updated can also be set. When the identification information IPC Flag exists, it indicates that the user program of the second CPU needs to be updated; when the identification information IPC Flag is not detected, it indicates that the user program of the second CPU does not need to be updated. For example, in a specific embodiment, when the second CPU detects that IPC Flag = 1, it jumps to _c_int00 of the Bootloader of the second CPU to start execution. When the second CPU receives the second program file in the shared RAM, the IPC Flag is cleared.
[0080] It can be seen that, in this embodiment, identification information is further set so that the second CPU can determine whether the user program update operation needs to be performed according to the identification information, thereby making the process of updating the user program on the second CPU more convenient.
[0081] On the basis of the above embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically, in this embodiment, after entering the user program, the method further includes:
[0082] Receiving an update instruction sent by the host computer; wherein the update instruction is an instruction input by the user for instructing the first CPU and / or the second CPU to update the user program;
[0083] Jump to the Bootloader program according to the update instructions.
[0084] In this embodiment, after entering the user program and in the process of running the user program, the user inputs an update instruction through the host computer, and the update instruction is used to instruct the first CPU or the second CPU to update the user program; the host computer sends the update instruction input by the user to the electronic chip, and after receiving the update instruction, the electronic chip controls the system according to the update instruction, jumps from the user program to the Bootloader program, and the Bootloader program waits to receive the first program file or the second program file of the user program to be updated sent by the host computer, and then uses the first program file or the second program file to implement the user program update for the first CPU or the second CPU.
[0085] In this embodiment, after entering the user program, the program jumps to the Bootloader program according to the update instruction sent by the host computer to update the user program, so that the time for updating the user program is more flexible.
[0086] In order to facilitate those skilled in the art to more clearly understand the technical solution of the present application, and to enable those skilled in the art to better understand the technical solution in the present application, the technical solution in the embodiment of the present application is described in detail below in combination with actual application scenarios. Figure 5 As shown, the specific steps are as follows:
[0087] After the electronic chip system is powered on and reset, the startup program of the electronic chip starts to boot from Flash. After the system is reset, after the serial port, GPIO (General-purpose input / output) and other related peripherals are configured, the start code in CodeStart Branch is executed. This code is used to boot the current startup electronic chip; by addressing the Flash sector address, the first check value PC_CheckValue and the second check value Boot_CheckValue are read, and the program jump is determined by judging whether the two are consistent; if they are consistent, the system will jump to the user program entry to run; if they are inconsistent, it means that an error occurred in the last upgrade, and the system will jump to the Bootloader program entry to wait for the operation instruction sent by the host computer.
[0088] After receiving the operation instruction of the host computer, it is determined whether the operation instruction is an upgrade instruction or an instruction to restore the backup program. If it is an instruction to restore the backup program, it jumps to the restoration of the backup program; if it is an upgrade instruction, it is necessary to further determine whether to upgrade the first CPU or the second CPU; when upgrading the first CPU, it jumps to the Bootloader program of the first CPU, enters the _c_int00 entry of the Bootloader program of the first CPU to start execution, and resets the first CPU; the Bootloader program of the first CPU calls the first Flash API function of the first CPU to erase the first Flash sector of the first CPU; then, according to the communication protocol and the data stream format, the first program file of the user program to be updated of the first CPU sent by the host computer and the first check value PC_CheckValue1 obtained by the host computer through the serial port are received; on the other hand, after the first CPU uses the first program file to upgrade the user program, it performs a check calculation according to the first program file to obtain a second check value Boot_CheckValue1; then the first program file and the two check values are programmed into the corresponding sector addresses.
[0089] Correspondingly, when upgrading the second CPU, the Bootloader program of the first CPU will jump to the data temporary storage function of the first CPU, execute the second program file of the user program to be updated of the second CPU sent by the host computer and its corresponding second check value PC_CheckValue2 into the shared RAM, and set the identification information IPC Flag = 1; when the second CPU system detects the identification information IPC Flag, it jumps to _c_int00 of the Bootloader program of the second CPU to start execution; after the reset is completed, the Bootloader program of the second CPU calls the second Flash API function of the second CPU to execute the Flash sector erase operation of the second CPU, the Bootloader program of the second CPU writes the data in the shared RAM into the corresponding Flash, and finally performs software initialization operation through the Bootloader program of the second CPU to realize the user program upgrade of the second CPU.
[0090] It can be seen that in this embodiment, corresponding programs can be executed according to actual needs to meet the diverse actual needs of the system operation of the electronic chip.
[0091] It should be understood that, although the steps in each flow chart involved in the above-described embodiment are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a portion of the steps in each flow chart involved in the above-described embodiment may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0092] In one embodiment, Figure 6 As shown, a system operation device of an electronic chip is provided, including: an acquisition module 602, a first execution module 604 and a second execution module 606, wherein:
[0093] The acquisition module 602 is used to acquire the stored first verification value and second verification value after the electronic chip system is powered on; wherein the first verification value is the verification value calculated by the host computer for the user program and sent to the electronic chip, and the second verification value is the verification value calculated by the electronic chip for the user program that was successfully updated last time;
[0094] A first execution module 604, configured to enter a user program when the first check value and the second check value are consistent;
[0095] The second execution module 606 is used to jump to the Bootloader program when the first check value is inconsistent with the second check value, and use the Bootloader program to update the user program of the first CPU.
[0096] An electronic chip system operation device provided by an embodiment of the present invention has the same beneficial effects as the above-mentioned electronic chip system operation method.
[0097] As a preferred embodiment, the second execution module includes:
[0098] The jump submodule is used to wait for the operation command from the host computer after jumping to the Bootloader program;
[0099] The receiving submodule is used to, after receiving the operation instruction, use the Bootloader program to perform the operation of upgrading the user program or restoring the backup program on the first CPU according to the operation command.
[0100] As a preferred embodiment, the receiving submodule includes:
[0101] An erasing unit, configured to call a first Flash API function using a Bootloader program according to an operation command to erase a first Flash sector of the first CPU;
[0102] A receiving unit, used for receiving a first program file of a user program to be updated sent by a host computer, and storing the first program file in a first Flash sector;
[0103] The upgrading unit is used to perform software initialization operation on the first CPU by using the first program file to realize user program upgrading.
[0104] As a preferred embodiment, the receiving submodule includes:
[0105] An acquisition unit, used to acquire a pre-stored backup program file using a Bootloader program according to an operation command;
[0106] The backup recovery unit is used to perform software initialization operation on the first CPU using the backup program file to realize the backup program recovery.
[0107] As a preferred embodiment, when the electronic chip is a dual-core electronic chip, the device further includes:
[0108] A storage module, used for acquiring a second program file of a user program to be updated of a second CPU from a host computer through the first CPU and storing the file in a shared RAM;
[0109] An erasing module, used for erasing a second Flash sector of the second CPU by calling a second Flash API function of the second CPU through the first CPU;
[0110] The writing module is used to write the second program file in the shared RAM into the second Flash sector through the first CPU, and use the second program file to perform software initialization operation on the second CPU to implement user program update.
[0111] As a preferred embodiment, the device further includes:
[0112] The setting module is used to set identification information for identifying that a user program update is required for the second CPU.
[0113] As a preferred embodiment, the device further includes:
[0114] A receiving module, used for receiving an update instruction sent by a host computer; wherein the update instruction is an instruction input by a user for instructing the first CPU to update a user program;
[0115] The jump module is used to jump to the Bootloader program according to the update instruction.
[0116] For the specific definition of the system operation device of the electronic chip, please refer to the definition of the system operation method of the electronic chip above, which will not be repeated here. Each module in the system operation device of the above electronic chip can be implemented in whole or in part by software, hardware and a combination thereof. The above 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.
[0117] In one embodiment, an electronic chip is provided. The electronic chip includes a first CPU and a second CPU that are communicatively connected. The electronic chip also includes a system operation device as described above for the electronic chip.
[0118] An electronic chip provided by an embodiment of the present invention has the same beneficial effects as the system operation method of the electronic chip described above.
[0119] 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:
[0120] After the electronic chip system is powered on, the first check value and the second check value stored are obtained; wherein the first check value is a check value calculated by the host computer for checking the user program and sent to the electronic chip, and the second check value is a check value calculated by the electronic chip for checking the user program that was successfully updated last time;
[0121] If the first check value and the second check value are consistent, the user program is entered; if they are inconsistent, the program jumps to the Bootloader program and uses the Bootloader program to update the user program of the first CPU.
[0122] A computer-readable storage medium provided by an embodiment of the present invention has the same beneficial effects as the system operation method of the electronic chip described above.
[0123] Those of ordinary skill 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 at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0124] 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.
[0125] 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 system operation method of an electronic chip, characterized in that: The method comprises: After the electronic chip system is powered on, the Flash sector address is addressed, the first check value and the second check value are read, and the program entry is jumped; wherein the first check value is a check value calculated by the host computer for checking the user program and sent to the electronic chip, and the second check value is a check value calculated by the electronic chip for checking the user program that was successfully updated last time after the user program was updated last time; If the first check value and the second check value are consistent, it is determined that the last user program upgrade was successful and the user program is entered; if they are inconsistent, it is determined that the last user program upgrade failed and the program is jumped to the Bootloader program. After jumping to the Bootloader program, the program waits to receive an operation command from the host computer; After receiving the operation command, according to the operation command, using the Bootloader program to perform the operation of upgrading the user program or restoring the backup program on the first CPU; According to the operation command, the operation of restoring the backup program on the first CPU using the Bootloader program includes: according to the operation command, obtaining a pre-stored backup program file using the Bootloader program; performing a software initialization operation on the first CPU using the backup program file to restore the backup program; According to the operation command, the operation of performing a user program upgrade on the first CPU using the Bootloader program includes: according to the operation command, the first Flash API function is called by the Bootloader program to erase the first Flash sector of the first CPU; receiving a first program file of the user program to be updated sent by the host computer, and storing the first program file in the first Flash sector; performing a software initialization operation on the first CPU using the first program file to implement a user program upgrade; When the electronic chip is a dual-core electronic chip and the user program of the second CPU needs to be updated, the first CPU obtains the second program file of the user program to be updated of the second CPU from the host computer and stores it in the shared RAM; the first CPU calls the second Flash API function of the second CPU to erase the second Flash sector of the second CPU; the first CPU writes the second program file in the shared RAM into the second Flash sector, and uses the second program file to perform software initialization operations on the second CPU to implement user program update.
2. The method according to claim 1, characterized in that After storing the second program file in the shared RAM, the method further includes: Identification information for identifying that a user program update is required for the second CPU is set.
3. The method according to claim 1, characterized in that After entering the user program, the method further includes: receiving an update instruction sent by the host computer; wherein the update instruction is an instruction input by a user for instructing the first CPU and / or the second CPU to update a user program; Jump to the Bootloader program according to the update instruction.
4. A system operation device of an electronic chip, characterized in that: The device comprises: The acquisition module is used to address the Flash sector address, read the first check value and the second check value and jump to the program entry after the electronic chip system is powered on; wherein the first check value is a check value calculated by the host computer for checking the user program and sent to the electronic chip, and the second check value is a check value calculated by the electronic chip for checking the user program that was successfully updated last time after the user program was updated last time; A first execution module, configured to determine that the last user program upgrade is successful and enter the user program when the first check value and the second check value are consistent; A second execution module is used for determining that the last user program upgrade failed when the first check value and the second check value are inconsistent, jumping to the Bootloader program, and after jumping to the Bootloader program, waiting to receive an operation command from a host computer; after receiving the operation command, using the Bootloader program to perform an operation of upgrading the user program or restoring the backup program on the first CPU according to the operation command; According to the operation command, the operation of restoring the backup program on the first CPU using the Bootloader program includes: according to the operation command, obtaining a pre-stored backup program file using the Bootloader program; performing a software initialization operation on the first CPU using the backup program file to restore the backup program; According to the operation command, the operation of performing a user program upgrade on the first CPU using the Bootloader program includes: according to the operation command, the first Flash API function is called by the Bootloader program to erase the first Flash sector of the first CPU; receiving a first program file of the user program to be updated sent by the host computer, and storing the first program file in the first Flash sector; performing a software initialization operation on the first CPU using the first program file to implement a user program upgrade; When the electronic chip is a dual-core electronic chip, the device further comprises: A storage module, used for acquiring a second program file of a user program to be updated of a second CPU from the host computer through the first CPU and storing the file in a shared RAM; An erasing module, used for calling a second Flash API function of the second CPU by the first CPU to erase a second Flash sector of the second CPU; A writing module is used to write the second program file in the shared RAM into the second Flash sector through the first CPU, and use the second program file to perform software initialization operation on the second CPU to realize user program update.
5. An electronic chip, comprising a first CPU and a second CPU connected in communication, characterized in that: The electronic chip also includes a system operation device of the electronic chip as claimed in claim 4.
6. 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 3 are implemented.
Citation Information
Patent Citations
A method and a system for verifying data consistency of a program Flash
CN109189405A
Chip program upgrading method and device and storage medium
CN111309364A
Application program operation control method and device, single-chip microcomputer and storage medium
CN112162772A
Firmware upgrading method and system for double-CPU system
CN113254053A