A program updating method and system for multi-core chip
By introducing a monitor chip and a watchdog mechanism into the multi-core chip to manage and monitor the program update process, it solves the problem of crashes during the multi-core chip update process and achieves safer and more reliable program updates.
Patent Information
- Application Number
- CN202011464362.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-14
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2040-12-14
AI Technical Summary
During the program update process of multi-core chips, crashes are prone to occur, and it is difficult for developers to accurately determine which step is stuck, and there is a lack of safe and reliable monitoring and update devices and methods.
A multi-core chip program update method is adopted. Through communication between the monitor chip and the multi-core chip, the watchdog mechanism and digital IO module are used to gradually manage and monitor the program update process of the multi-core chip, including notifying the monitor chip to enter the update process. stage, turn on the watchdog, and perform kernel program update and reset operations to ensure the integrity and security of the update process.
It effectively reduces the crash caused by multi-core chip program updates, improves the reliability and monitorability of the update process, and ensures the safety and accuracy of program updates.
Smart Images

Figure CN112394964B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of embedded systems and relates to a program updating method and system for a multi-core chip. Background Art
[0002] In order to comply with safety regulations, the power supply industry, especially the inverter industry, usually uses a dual-chip structure, one of which is used as the main control chip, which has high performance and high price; the other secondary chip has weak performance and low price, and is mainly used for redundant detection. The current main control chip has been developed in the direction of applying multi-core chips, and there are few safe and reliable monitoring and updating devices and methods for program update and maintenance. In the process of program update of multi-core chips, multiple cores need to be rewritten. This rewriting process is prone to errors, and the program may not run correctly. "Freeze" phenomenon may occur, and developers often cannot accurately know which step of the program update is stuck. Summary of the invention
[0003] In order to solve the above technical problems, an object of the present invention is to provide a method and system for updating programs of a multi-core chip, which effectively reduces the phenomenon of freezing caused by program updates of the multi-core chip itself.
[0004] In order to achieve the above object, a technical solution adopted by the present invention is:
[0005] A method for updating a program of a multi-core chip includes updating the multi-core chip, wherein the updating of the multi-core chip includes the following steps:
[0006] A. The multi-core chip notifies the monitor chip to enter the program update phase;
[0007] B. the multi-core chip starts the watchdog after receiving the first monitoring signal returned by the monitor chip;
[0008] C. updating the programs of the multiple cores of the multi-core chip in sequence; and
[0009] D. After the multi-core chip receives the second monitoring signal returned by the monitor chip after determining that the update process is completed, the watchdog performs a reset operation.
[0010] In a preferred embodiment, in step A, the output pin IO_out of the multi-core chip continuously sends n cycles to the input pin Det_in of the monitor chip based on t1 low level and t2 high level to notify the monitor chip to enter the program update phase, where t1 represents the duration of the low level, t2 represents the duration of the high level, and n is greater than 1.
[0011] In a preferred embodiment, in step B, the output pin Det_out of the monitor chip changes from a low level to a high level, and the multi-core chip has an input pin IO_in connected to the output pin Det_out. When the multi-core chip detects that the signal of the input pin IO_in is a high level, the watchdog is turned on.
[0012] In a preferred embodiment, in step C, the multi-core chip updates the program of a certain core. After the update is completed, the output pin IO_out of the multi-core chip outputs the program update completion information flag of the core to the input pin Det_in of the monitor chip to update the program of the next core.
[0013] Furthermore, the monitor chip determines the stage of the current program update according to the signal received from the output pin IO_out of the multi-core chip.
[0014] In a preferred embodiment, in step D, the output pin IO_out of the multi-core chip outputs a program update end flag, the monitor chip detects the program update end flag and monitors that the output pin IO_out of the multi-core chip continues to be at a low level for more than t3 time, then it is determined that the program update is completed.
[0015] In a preferred and specific embodiment, the updating of the multi-core chip is specifically implemented as follows:
[0016] S1, entering the first boot program of the first kernel of the multi-core chip, driving the output pins IO_out1, IO_out2 and IO_out3 of the multi-core chip to continuously send n cycles according to t1 low level and t2 high level, and notifying the monitor chip to enter the program update phase;
[0017] S2, the output pin Det_out1 of the monitor chip changes from a low level to a high level, and the multi-core chip starts the internal watchdog according to monitoring that the signal of the input pin IO_in1 connected to the output pin Det_out1 is a high level;
[0018] S3, the first kernel enters the second boot program from the first boot program to perform program update;
[0019] S4, controlling the output pins IO_out1, IO_out2 and IO_out3 to collect data according to the set start data collection conditions and end conditions, and the monitor chip determines the stage of the current program update according to the data received from the output pin IO_out3;
[0020] S5, transferring the program update data to the program area of the first kernel;
[0021] S6, if the program update data transmission of the first core is completed, the output pin IO_out3 outputs the program update completion information flag of the first core; then the program data transmission process of the next core is entered;
[0022] S7, jumping to the first boot program of the next core of the multi-core chip to transfer program data;
[0023] S8, controlling the output pins IO_out1, IO_out2 and IO_out3 to collect data according to the set start data collection conditions and end conditions, and the monitor chip determines the stage of the current program update according to the data received from the output pin IO_out3;
[0024] S9, if the program update data transmission of the core is completed, the output pin IO_out3 outputs the program update completion information flag of the core;
[0025] S10, repeating steps S7 to S9 until the program update of all cores is completed;
[0026] S11, after the output pin IO_out3 outputs the end mark, the output pins IO_out1, IO_out2 and IO_out3 are simultaneously set to low;
[0027] S12, the monitor chip detects the program update end mark, and monitors that the output pins IO_out1, IO_out2 and IO_out3 are continuously at a low level for more than t3 time, then it is determined that the program update process is completed; the monitor chip sets the output of its output pin Det_out1 to a low level, and the multi-core chip will be reset by the internal watchdog.
[0028] In a preferred embodiment, if it is detected during the program update process that the execution time of a certain step is abnormal, or the data of the output pin of the multi-core chip is disordered, or the program update file is abnormal, the monitor chip resets the multi-core chip.
[0029] In a preferred embodiment, the program updating method further comprises the following steps:
[0030] The external data interface of the multi-core chip receives the program update file and transfers the program update file to the corresponding area of the external expansion memory;
[0031] The multi-core chip obtains data status information of the external expansion memory;
[0032] If the data status information is obtained to indicate that the program in the external expansion memory has not been burned, the multi-core chip is updated.
[0033] The present invention also adopts the following technical solution:
[0034] A program update system for a multi-core chip, equipped with the program update method as described above, the program update system comprising: a multi-core chip, a monitor chip and an external expansion memory for storing program update files;
[0035] The multi-core chip comprises:
[0036] Control interaction bus;
[0037] n cores, each of which is electrically connected to the control interaction bus;
[0038] An external data interface, which is used to obtain program update files from the outside, and the external data interface is electrically connected to the control interaction bus;
[0039] A communication interface, which is used to exchange information with the external expansion memory;
[0040] a digital IO module, which is used to exchange information with the monitor chip, the digital IO module is electrically connected to the control interaction bus, and the digital IO module has an output pin IO_out for sending information to the monitor chip and an input pin IO_in for receiving information from the monitor chip; and
[0041] A watchdog electrically connected to the control interaction bus;
[0042] The monitor chip has an input pin Det_in electrically connected to the output pin IO_out and an output pin Det_out electrically connected to the input pin IO_in.
[0043] The present invention adopts the above solution, which has the following advantages compared with the prior art:
[0044] The program update method and system of the present invention manages the program update process of the multi-core chip by the monitor chip, effectively reducing the phenomenon of "freezing" caused by the program update of the multi-core chip itself. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0046] Figure 1 A schematic diagram of the structure of a program update system according to an embodiment of the present invention;
[0047] Figure 2 This is a schematic diagram of the storage information arrangement of the external Flash;
[0048] Figure 3 This is a schematic diagram of the IO level output by the multi-core chip at the initial stage of program update;
[0049] Figure 4 This is a schematic diagram of the data transfer waveform of the output pins of a multi-core chip.
[0050] 1. Multi-core chip; 11. Control interaction bus; 12. Kernel; 13. External data interface; 14. Communication interface; 15. Digital IO module; 16. Watchdog; 2. Monitor chip; 3. External expansion Flash; 4. External data transmission component. DETAILED DESCRIPTION
[0051] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0052] This embodiment provides a program update system for a multi-core chip and a program update method installed in the system. Figure 1 As shown, the program update system includes a multi-core chip 1, a monitor chip 2, an external memory and an external data transmission component 4. The external memory is a non-volatile memory, specifically an external Flash 3, and the monitor chip 2 is a single chip microcomputer or a microcontroller.
[0053] The multi-core chip 1 is a microcontroller (MCU chip) or a digital processor (DSP chip), which specifically includes: a control interaction bus 11, n cores 12 (n≥2), an external data interface 13, a communication interface 14, a digital IO module 15 and a watchdog 16. The control interaction bus 11 is electrically connected to each core 12 and the external data interface 13, the communication interface 14, the digital IO module 15 and the watchdog 16 to realize information interaction.
[0054] The external data interface 13 and the external data transmission component 4 communicate with each other to obtain the program update file received by the external data transmission component 4. The external data transmission component 4 is used to connect the external data, which is a wired transmission module or a wireless transmission module (Wifi module or GPS module). Specifically, the external data interface 13 is an Ethernet interface, an RS422 interface or an RS485 interface.
[0055] The communication interface 14 is specifically a SPI interface (Serial Peripheral Interface), which has a MISO port, a MOSI port, a CLK port, and a Slave_Set port. The external expansion Flash 3 also includes an SPI interface, which also has a MISO port, a MOSI port, a CLK port, and a Slave_Set port, and is electrically connected to the corresponding ports of the SPI interface of the multi-core chip 1. The external expansion Flash 3 prevents the internal storage program of the multi-core chip 1 from being damaged and not being able to run normally. It is a non-volatile storage medium, and data will not be lost when the power is off.
[0056] The digital IO module 15 is used to exchange information with the monitor chip 2. The digital IO module 15 has an output pin IO_out for sending information to the monitor chip 2 and an input pin IO_in1 for receiving information from the monitor chip 2. Specifically, there are three output pins IO_out, namely IO_out1, IO_out2 and IO_out3. The monitor chip 2 has an input pin Det_in electrically connected to the output pin IO_out and an output pin Det_out1 electrically connected to the input pin IO_in. Correspondingly, there are three input pins Det_in, namely Det_in1, Det_in2 and Det_in3, the output pin IO_out1 is electrically connected to the input pin Det_in1, the output pin IO_out2 is electrically connected to the input pin Det_in2, and the output pin IO_out3 is electrically connected to the input pin Det_in3.
[0057] Reference Figure 2 As shown, the partitions of the externally expanded Flash 3 mainly include the Flash global management information area, the core 1 storage area, the core 2 storage area, the core n storage area, and the n core storage areas (for example, if there are 3 cores, each core has a corresponding program storage area). The content of the Flash global management information area includes the Flash partition structure information, the current Flash data version information and status information, the reserved data segment, and the CRC check code of the data area. Taking core 1 as an example, the core 1 storage area includes the core 1 storage information mark, the core 1 program temporary storage area 1, and the core 1 program temporary storage area 2. Each partition contains a data check code.
[0058] In this embodiment, the multi-core chip 1 receives the program data file transmitted from the outside through the external data interface 13, and stores the program data file in the external Flash through the SPI interface. The monitor chip 2 is responsible for monitoring and guiding the program update process.
[0059] The specific process of the program updating method of this embodiment is as follows.
[0060] 1. The external data interface 13 of the multi-core chip 1 exchanges data with the external data transmission component 4, receives the program file, and transmits the program data to the corresponding area of the external expansion Flash 3 through the SPI interface according to the definition of the Flash global management information. The kernel 12n program temporary storage area 2 is used as a new program data storage area. After the program file is updated, the data in the temporary storage area 2 is copied to the temporary storage area 1 for backup.
[0061] 2. The multi-core chip 1 interacts with the external Flash 3 to obtain the partition structure information, Flash data version information and status information of the current Flash.
[0062] 3. If the status information obtained indicates that the program in the current Flash area has not been burned, the program is updated.
[0063] 4. Kernel 12 program update process:
[0064] 1) Enter the boot program 1-1 of the first core of the multi-core chip 1, drive IO_out1 / 2 / 3 to send 3 cycles of 1s low level and 1s high level continuously, and notify the monitor chip 2 to enter the program update phase, such as Figure 3 shown.
[0065] 2) The output pin Det_out1 of the monitor chip 2 changes from low level to high level. The multi-core chip 1 turns on the internal watchdog 16 (ie, the watchdog feeding operation is turned on when IO_in1 is high level) based on the detected IO_in1 signal being high level.
[0066] 3) The boot program 1-1 in the first kernel enters the boot program 1-2 to update the program.
[0067] 4) Control IO_out1 / 2 / 3 to collect data according to the set start data collection conditions and end conditions, such as Figure 4 The current program update stage is determined based on the data received from IO_out3.
[0068] 5) The data in the kernel 1 program temporary storage area 2 in the Flash is transferred to the kernel 1 program area.
[0069] 6) If the first core program data transfer is completed, IO_out3 outputs the program update completion information flag of the first core; then the program data transfer process of the second core is entered.
[0070] 7) The program jumps to the boot program 2-1 of the second core of the multi-core chip 1 to transfer program data.
[0071] 8) Control IO_out1 / 2 / 3 to collect data according to the set start data collection conditions and end conditions. Determine the stage of the current program update based on the data received from IO_out3.
[0072] 9) If the program data transfer of the second core is completed, IO_out3 outputs the program update completion information flag of the second core; then the program data transfer process of the next core is entered.
[0073] 10) Repeat steps 7) to 9) to update the programs of other cores.
[0074] 11) If all updates are completed, the data in the program temporary storage area 2 of the external Flash is copied to the temporary storage area 1. After IO_out3 outputs the end mark, the outputs of IO_out1 / 2 / 3 are set to low at the same time.
[0075] 12) Monitor chip 2 detects the program update end flag, and monitors that the output of IO_out1 / 2 / 3 is continuously low for more than 3 seconds, then the program update process is determined to be completed. Monitor chip 2 sets the output of Det_out1 pin to a low level, and the multi-core chip 1 will be reset by the internal watchdog 16 and restart.
[0076] Among them, Figure 4 As shown, the output of the output pin IO_out1 is a symmetrical square wave, and the matching frequency can be set according to the requirements of different multi-core chips 1 and monitor chips 2; in this embodiment, a 1ms period is set. Data collection starts: the output pin IO_out1 outputs a normal square wave, and IO_out2 changes from low to high (the low level event exceeds 1s). During data collection: the output pin IO_out2 maintains a high level; when IO_out1 is at a high level, the level of IO_out3 is read and the data is recorded.
[0077] The data structure used in the communication information is shown in Table 1, with 0xA5 as the frame header, the mark data length is 2 bytes, and the frame tail is a special check code 0x5A.
[0078] Table 1
[0079]
[0080] The symbol data and their meanings are shown in Table 2.
[0081] Table 2
[0082]
[0083]
[0084] Data collection ends: IO_out2 is at a low level, and the data transmission ends.
[0085] If it is detected during the program update process that the execution time of a certain step is abnormal, or the IO_out1 / 2 / 3 data is disordered, or the new program file in the external Flash is abnormal, the monitor chip 2 resets the multi-core chip 1.
[0086] If the new program file in the external Flash is abnormal, the program will be reset by the program data in the kernel program temporary storage area 1 that has not been overwritten.
[0087] The above-mentioned program update system and method manages the program update process of the multi-core chip 1 by the monitor chip 2, effectively reducing the phenomenon of "freezing" caused by the program update of the multi-core chip 1 itself, which is more practical; the non-volatile characteristics of the external expansion Flash 3 are used to support the backup and upgrade of the chip program; if the program data is wrong, a correct version can be restored; there is no need for complex communication ports and communication protocols, and the monitoring function is performed by the existing dual-chip structure sub-chip as the monitor chip 2, which reduces the cost.
[0088] The above embodiment is only for illustrating the technical concept and features of the present invention, and is a preferred embodiment. Its purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and it cannot be used to limit the protection scope of the present invention. Any equivalent transformation or modification made according to the spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. A program update method for a multi-core chip, It is characterized in that The method includes updating the multi-core chip, wherein the updating of the multi-core chip includes the following steps: A. The multi-core chip notifies the monitor chip to enter the program update phase; B. the multi-core chip starts the watchdog after receiving the first monitoring signal returned by the monitor chip; C. updating programs of multiple cores of the multi-core chip in sequence; and D. After the multi-core chip receives the second monitoring signal returned by the monitor chip after determining that the update process is completed, the watchdog performs a reset operation; The updating of the multi-core chip is specifically implemented as follows: S1, entering the first boot program of the first kernel of the multi-core chip, driving the output pins IO_out1, IO_out2 and IO_out3 of the multi-core chip to continuously send n cycles according to t1 low level and t2 high level, and notifying the monitor chip to enter the program update phase; S2, the output pin Det_out1 of the monitor chip changes from a low level to a high level, and the multi-core chip starts the internal watchdog according to monitoring that the signal of the input pin IO_in1 connected to the output pin Det_out1 is a high level; S3, the first kernel enters the second boot program from the first boot program to perform program update; S4, controlling the output pins IO_out1, IO_out2 and IO_out3 to collect data according to the set start data collection conditions and end conditions, and the monitor chip determines the stage of the current program update according to the data received from the output pin IO_out3; S5, transferring the program update data to the program area of the first kernel; S6, if the program update data transmission of the first core is completed, the output pin IO_out3 outputs the program update completion information flag of the first core; Then enter the program data transfer process of the next kernel; S7, jumping to the first boot program of the next core of the multi-core chip to transfer program data; S8, controlling the output pins IO_out1, IO_out2 and IO_out3 to collect data according to the set start data collection conditions and end conditions, and the monitor chip determines the stage of the current program update according to the data received from the output pin IO_out3; S9, if the program update data transmission of the core is completed, the output pin IO_out3 outputs the program update completion information flag of the core; S10, repeating steps S7 to S9 until the program update of all cores is completed; S11, after the output pin IO_out3 outputs the end mark, the output pins IO_out1, IO_out2 and IO_out3 are simultaneously set to low; S12, the monitor chip detects the program update end mark, and monitors that the output pins IO_out1, IO_out2 and IO_out3 are continuously at a low level for more than t3 time, then it is determined that the program update process is completed; the monitor chip sets the output of its output pin Det_out1 to a low level, and the multi-core chip will be reset by the internal watchdog.
2. The program updating method according to claim 1, It is characterized in that If it is detected during the program update process that the execution time of a certain step is abnormal, or the data of the output pin of the multi-core chip is disordered, or the program update file is abnormal, the monitor chip resets the multi-core chip.
3. The program updating method according to claim 1, It is characterized in that The program updating method further comprises the following steps: The external data interface of the multi-core chip receives the program update file and transfers the program update file to the corresponding area of the external expansion memory; The multi-core chip obtains data status information of the external expansion memory; If the data status information is obtained to indicate that the program in the external expansion memory has not been burned, the multi-core chip is updated.
4. A program update system for a multi-core chip, It is characterized in that Equipped with the program updating method according to any one of claims 1 to 3, the program updating system comprises: a multi-core chip, a monitor chip and an external expansion memory for storing program update files; The multi-core chip comprises: Control interaction bus; A plurality of cores, each of the cores being electrically connected to the control interaction bus; An external data interface, which is used to obtain program update files from the outside, and the external data interface is electrically connected to the control interaction bus; A communication interface, which is used to exchange information with the external expansion memory; a digital IO module, which is used to exchange information with the monitor chip, the digital IO module is electrically connected to the control interaction bus, and the digital IO module has an output pin IO_out for sending information to the monitor chip and an input pin IO_in for receiving information from the monitor chip; and A watchdog electrically connected to the control interaction bus; The monitor chip has an input pin Det_in electrically connected to the output pin IO_out and an output pin Det_out electrically connected to the input pin IO_in.
