Data processing method and system based on embedded chip

By setting partitions in the embedded chip and using the boot loading processor to perform partition jumps, the problem of easy damage during the online chip upgrade process is solved, and efficient and secure chip firmware and software updates are achieved.

CN119127248APending Publication Date: 2024-12-13SHENZHEN SUPLET
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411113552.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

Embedded chips are susceptible to external environment during the online upgrade process, resulting in damage. The existing technology requires physical replacement of the chip for update, which is inefficient and unsafe.

Method used

By setting the first and second partitions in the embedded chip, using the boot loading processor to write the new program code to the second partition without replacing the chip, and performing partition jumps to achieve online upgrades and ensure stability Sex and safety.

Benefits of technology

It realizes efficient updates of chip firmware or software without removing or physically replacing the chip, improving application reliability and security, and avoiding the risk of chip damage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127248A_ABST
    Figure CN119127248A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method and system based on an embedded chip, the data processing system comprises a first partition processor, a boot loader processor, a chip processor, a first partition, a second partition and a boot loader partition, and the first partition processor receives a program upgrading instruction; if it is determined that the program code of the to-be-upgraded application in the current first partition and the program code of the to-be-upgraded application in the program upgrading instruction are in an execution state, writing a new program code of the to-be-upgraded application carried in the program upgrading instruction into a second partition, and sending writing completion information to the chip processor; and when the bootstrap loading processor receives write-in completion information sent by the chip processor, partition skipping is carried out based on the program code in the first partition and the new program code in the second partition so as to execute the new program code in the second partition. According to the invention, updating and upgrading are carried out under the condition that the chip is not removed or physically replaced, so that the condition that the embedded chip is damaged can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a data processing method and system based on an embedded chip. Background Art

[0002] For online upgrades of embedded chips, the firmware or software in the embedded chip is often updated and upgraded by removing or physically replacing the chip and then writing new program code. Since the embedded chip needs to be moved and is susceptible to external environmental influences, the embedded chip may be damaged. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a data processing method and system based on an embedded chip to solve the problem of damage to the embedded chip.

[0004] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0005] A first aspect of an embodiment of the present invention shows a data processing method based on an embedded chip, which is applied to a data processing system based on an embedded chip, wherein the data processing system includes a first partition processor, a boot loader processor, a chip processor, a first partition, a second partition, and a boot loader partition, and the method includes:

[0006] The first partition processor receives the program upgrade instruction, and if it is determined that the program code of the application to be upgraded in the program upgrade instruction is currently in the first partition and is in an execution state, writes the new program code of the application to be upgraded carried in the program upgrade instruction into the second partition, and sends the writing completion information to the chip processor;

[0007] When the boot loader processor receives the writing completion information sent by the chip processor, it performs partition jump based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition.

[0008] Optionally, the first partition processor determines that the program code of the application to be upgraded in the program upgrade instruction in the current first partition is in an execution state, including:

[0009] Traversing all running applications in the first partition to determine whether there is an application with the same identifier as the application to be upgraded in the program upgrade instruction;

[0010] If so, it is determined that the program code of the application to be upgraded in the first partition and the program upgrade instruction is currently in an execution state.

[0011] Optionally, the boot loader processor performs partition jump based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition, including:

[0012] The bootloader processor stops the execution of the program code of the application to be upgraded in the program upgrade instruction;

[0013] The first boot program is booted within a first time to execute the new program code of the second partition.

[0014] Optionally, after booting the first boot program to execute the new program code of the second partition within the first time, the method further includes:

[0015] The bootloader processor determines whether there is an abnormality in the execution of the new program code within the first time period;

[0016] If so, switching to execute the program code of the application to be upgraded in the first partition;

[0017] If it does not exist, continue to execute the new program code in the second partition;

[0018] The program code of the application to be upgraded in the first partition is deleted after a first time period.

[0019] Optionally, also include:

[0020] After receiving the program upgrade instruction, the first partition processor verifies the new program code of the application to be upgraded carried in the received program upgrade instruction to obtain a calibration result;

[0021] Indicating whether the data calibration is passed based on the calibration result;

[0022] If so, write the new program code carried in the program upgrade instruction into the second partition, and send the writing completion information and the calibration result to the chip processor;

[0023] When the boot loader processor receives the writing completion information and the calibration result sent by the chip processor, it controls the execution of the first boot program in the boot loader partition to perform a second calculation of the data check value on the new program code written in the second partition to obtain a second check value; and determines whether the verification is passed based on the first check value and the second check value in the calibration result;

[0024] If yes, a step of performing a partition jump based on the program code in the first partition and the new program code in the second partition is performed to execute the new program code in the second partition.

[0025] Optionally, verifying the new program code of the application to be upgraded carried in the received program upgrade instruction to obtain a calibration result includes:

[0026] Determining whether the new program code of the application to be upgraded carried in the received program upgrade instruction is complete;

[0027] If so, generate information indicating that the data calibration has passed;

[0028] If not, a message of data calibration failure is generated;

[0029] Performing a first calculation of a data check value based on the new program code to obtain a first check value;

[0030] The information on the data calibration passing or the data calibration failing and the first check value are used to generate a calibration result.

[0031] Optionally, the boot loader partition further includes a second boot program, and the method further includes:

[0032] When the boot loader processor receives a program upgrade instruction, the boot loader processor switches the first boot program to a second boot program;

[0033] Upgrading the first boot program based on the program upgrade instruction;

[0034] When it is determined that the upgraded first boot program passes verification, switch to the first boot program.

[0035] A second aspect of an embodiment of the present invention shows a data processing system based on an embedded chip, comprising a first partition processor, a boot loader processor, a chip processor, a first partition, a second partition and a boot loader partition;

[0036] The first partition processor is configured to receive a program upgrade instruction, and if it is determined that the program code of the application to be upgraded in the program upgrade instruction is currently in the first partition and is in an execution state, write the new program code of the application to be upgraded carried in the program upgrade instruction into the second partition, and send a writing completion message to the chip processor;

[0037] The boot loader processor is used to perform partition jump based on the program code in the first partition and the new program code in the second partition when receiving the writing completion information sent by the chip processor, so as to execute the new program code in the second partition.

[0038] Optionally, determining a first partition processor in the current first partition that is in an execution state of the program code of the application to be upgraded in the program upgrade instruction is specifically used to:

[0039] Traversing all running applications in the first partition to determine whether there is an application with the same identifier as the application to be upgraded in the program upgrade instruction;

[0040] If so, it is determined that the program code of the application to be upgraded in the first partition and the program upgrade instruction is currently in an execution state.

[0041] Optionally, partition jump is performed based on the program code in the first partition and the new program code in the second partition to execute the boot loader processor of the new program code in the second partition, specifically for:

[0042] Stopping the execution of the program code of the application to be upgraded in the program upgrade instruction;

[0043] The first boot program is booted within a first time to execute the new program code of the second partition.

[0044] Based on the above-mentioned embodiment of the present invention, a data processing method and system based on an embedded chip are provided. The data processing system includes a first partition processor, a boot loader processor, a chip processor, a first partition, a second partition and a boot loader partition. The method includes: the first partition processor receives a program upgrade instruction, if it is determined that the program code of the application to be upgraded in the program upgrade instruction in the current first partition is in an execution state, the new program code of the application to be upgraded carried in the program upgrade instruction is written into the second partition, and the writing completion information is sent to the chip processor; when the boot loader processor receives the writing completion information sent by the chip processor, the partition jump is performed based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition. When the application of the embedded chip of the present invention is upgraded online, without removing or physically replacing the chip, the first partition processor receives a program upgrade instruction. If it is determined that the program code of the application to be upgraded in the current first partition and the program code of the program upgrade instruction is in an execution state, the new program code carried in the program upgrade instruction is written into the second partition, and the writing completion information is sent to the chip processor; when the boot loader processor receives the writing completion information sent by the chip processor, the partition jump is performed based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition; the firmware or software on the chip, that is, the application is updated and upgraded by writing through an external device, which not only ensures the efficiency of the online upgrade, but also improves the reliability and security of the application. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0046] Figure 1 A schematic diagram of the architecture of a data processing system based on an embedded chip according to an embodiment of the present invention;

[0047] Figure 2 A schematic diagram of the architecture of the embedded chip memory partition according to an embodiment of the present invention;

[0048] Figure 3 A schematic diagram of application upgrade data interaction in an embedded chip shown in an embodiment of the present invention;

[0049] Figure 4 A schematic diagram of the architecture of partition upgrade of the boot loader in an embedded chip according to an embodiment of the present invention;

[0050] Figure 5 A schematic flow chart of a data processing method based on an embedded chip according to an embodiment of the present invention;

[0051] Figure 6 A schematic flow chart of another data processing method based on an embedded chip according to an embodiment of the present invention;

[0052] Figure 7 The present invention is a flowchart of another method for processing data based on an embedded chip according to an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0055] It should be noted that the descriptions of "first", "second", etc. in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0056] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0057] See also Figure 1 , is a schematic diagram of the structure of an embedded chip shown in an embodiment of the present invention.

[0058] The embedded chip includes a boot loader partition 10, a first application partition 20, namely, APP partition one, and a second application partition 30, namely, APP partition two, a chip processor 40, a boot loader processor 101 arranged in the boot loader partition 10, a first partition processor 201 arranged in the first application partition 20, and a second partition processor 301 arranged in the second application partition 30;

[0059] Specifically, determine the memory of the embedded chip, generally referring to the total amount of flash memory, namely FLASH; divide the memory of the embedded chip into storage partitions according to the memory required by each project, so as to divide the memory of the embedded chip into three independent memory partitions, specifically including a boot loader partition 10, a first application partition 20, namely APP partition one, and a second application partition 30, namely APP partition two, such as Figure 2 As shown; the boot loader partition includes boot loader 1, ie, the first boot loader, and boot loader 2, ie, the second boot loader.

[0060] A boot loader processor 101 is set in the boot loader partition 10 , a first partition processor 201 is set in the first application partition 20 , and a second partition processor 301 is set in the second application partition 30 .

[0061] The chip processor 40 is respectively connected to the boot loader processor 101 , the first partition processor 201 and the second partition processor 301 , and the boot loader processor 101 is also respectively connected to the first partition processor 201 and the second partition processor 301 .

[0062] The memory of the first application partition 20 and the second application partition 30 are equal and larger than the memory of the boot loader partition 10, that is, the memory of the first application partition and the second application partition are larger and the memory sizes should be the same.

[0063] Both the first application partition 20 and the second application partition 30 store items, ie, functions required by the application program, such as communication function, logic control function, protection function, and the like.

[0064] Boot loader partition 10 is a boot area, which contains two independent boot programs. It is used to determine which execution partition to execute next after the chip, that is, the application is successfully upgraded online. Figure 3 As shown, the first application partition 20, namely APP partition one, and the second application partition 30, namely APP partition two, are used for upgrading new program codes, namely data updating, and the Boot loader partition 10 performs program booting of executing program codes with the APP partition one and the APP partition two respectively.

[0065] When an exception occurs in the default boot program or the boot partition is in an online upgrade state, the system will automatically switch to and execute the contents of another backup boot program to ensure system stability and continuity.

[0066] The first partition processor 201 receives the program upgrade instruction, and if it is determined that the program code of the application to be upgraded in the program upgrade instruction is currently in the first partition 20 and is in the execution state, writes the new program code of the application to be upgraded carried in the program upgrade instruction into the second partition 30, and sends the writing completion information to the chip processor 40;

[0067] Optionally, the external device is connected to the embedded chip via a network or other connection methods, and the external device generates a program upgrade instruction from the program code corresponding to the application to be upgraded and transmits it to the chip processor 40 via the network or other connection methods.

[0068] The chip processor 40 receives the program upgrade instruction, determines the storage location of the application to be upgraded based on the program upgrade instruction, and if it is determined that the program code of the application is stored in the first partition 20, forwards the program upgrade instruction to the first partition processor 201 so that the first partition processor 201 receives it.

[0069] Similarly, if it is determined that the program code of the application is stored in the second partition 30, the program upgrade instruction is forwarded to the second partition processor 301 so that the second partition processor 301 receives it.

[0070] It should be noted that the processing process of the second partition processor 301 for the program upgrade instruction is the same as the processing process of the first partition processor 201 for the program upgrade instruction, and they can refer to each other.

[0071] It should be noted that when upgrading or updating an application to be upgraded in a certain partition, the partition is the first partition 20 , and the other partition storing the firmware or software of the embedded chip, ie, the application, is the second partition 30 .

[0072] When the boot loader processor 101 receives the write completion information sent by the chip processor 40 , it performs partition jump based on the program code in the first partition 10 and the new program code in the second partition 20 to execute the new program code in the second partition 20 .

[0073] In an embodiment of the present invention, when the application of the embedded chip is upgraded online, the embedded chip is not easily affected by the external environment without removing or physically replacing the chip; the first partition processor receives the program upgrade instruction, and if it is determined that the program code of the application to be upgraded in the current first partition and the program upgrade instruction is in the execution state, the new program code carried in the program upgrade instruction is written to the second partition, and the writing completion information is sent to the chip processor; not only can it avoid the situation where the embedded chip is damaged, but also ensure the stability and continuity of the embedded chip. When the boot loader processor receives the writing completion information sent by the chip processor, it performs a partition jump based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition; the firmware or software on the chip, that is, the application is updated and upgraded by writing through an external device, which not only ensures the efficiency of online upgrades, but also improves the reliability and security of the application.

[0074] Optionally, based on the system shown in the above embodiment of the present invention, determining the first partition processing 201 in which the program code of the application to be upgraded in the program upgrade instruction is in the execution state in the current first partition is specifically used for:

[0075] Traverse all running applications in the first partition 20 to determine whether there is an application with the same identifier as the application to be upgraded in the program upgrade instruction; if so, determine that the program code in the current first partition 20 and the application to be upgraded in the program upgrade instruction are in an execution state.

[0076] Specifically, all running applications in the first partition 20 and the identifier of each application are obtained; the identifier of the application to be upgraded in the program upgrade instruction is obtained; it is determined whether there is an application with the same identifier as the application to be upgraded in the program upgrade instruction among all running applications, and if so, it is determined that the program code of the application to be upgraded in the program upgrade instruction in the current first partition 20 is in an execution state; if not, it is determined that the program code of the application to be upgraded in the program upgrade instruction in the current first partition 20 is in a non-execution state.

[0077] Optionally, based on the system shown in the above embodiment of the present invention, partition jumping is performed based on the program code in the first partition 20 and the new program code in the second partition 30 to execute the boot loader processor 101 of the new program code in the second partition 30, specifically for:

[0078] The boot loader processor 101 stops the running of the program code of the application to be upgraded in the program upgrade instruction; and guides the first boot program to execute the new program code of the second partition 30 within the first time.

[0079] Specifically, the boot loader processor 101 switches the execution of the old program code and the new program code, specifically first stops the running of the program code of the application to be upgraded in the program upgrade instruction; guides the first boot program to obtain the identification value of the application to be upgraded in the first partition 20, and the identification value of the application to be upgraded in the second partition 30, compares the identification value of the application to be upgraded in the first partition 20 and the identification value of the application to be upgraded in the second partition 30, if the identification value of the application to be upgraded in the second partition 30 is greater than the identification value of the application to be upgraded in the first partition 20, guides the first boot program to execute the new program code of the second partition 30 within a preset first time, otherwise, guides the first boot program to execute the new program code of the first partition 20 within the preset first time.

[0080] It should be noted that the identification value is composed of the version number of the application to be upgraded. Generally speaking, the newer the version, the larger the corresponding identification value, and the identification value is carried in the program code.

[0081] The first time is set in advance by the technician based on experience or experiments, and is generally 3 milliseconds. The first time is shorter to make the switching process more seamless.

[0082] Optionally, based on the system shown in the above embodiment of the present invention, after the first boot program is booted to execute the new program code of the second partition 30 within the first time, the boot loader processor 101 is further used to:

[0083] Determine whether there is any abnormality in the operation of the new program code within the first time period; if so, switch to executing the program code of the application to be upgraded in the first partition 20; if not, continue to execute the new program code in the second partition 30; delete the program code of the application to be upgraded in the first partition 20 after the first time period.

[0084] Specifically, the abnormality detection device is used to determine whether there are program errors or bugs that affect the normal operation of the new program code, such as execution failure, data failure, etc., during the operation of the new program code. If there are, the program code of the application to be upgraded in the first partition 20 is switched to be executed. If not, the new program code in the second partition 30 is continued to be executed; it is determined that the new program code in the second partition 30 can be executed normally at this time, and the first boot program is guided to execute the new program code in the second partition 30; then, after the first time period, that is, after the new program code runs stably, the program code of the application to be upgraded in the first partition 20 is deleted.

[0085] It should be noted that the first time period is a time interval from code writing to normal code operation, which is set in advance by the technician based on actual conditions.

[0086] In order to ensure the high security of the upgrade process, the present invention retains a rollback mechanism so that if any exception is encountered during the execution of the new program code, the previous execution partition, i.e., the first partition, can be quickly switched back to continue executing the previous program code.

[0087] Optionally, based on the system shown in the embodiment of the present invention, the first partition processor 201 is further used to verify the new program code of the application to be upgraded carried in the received program upgrade instruction after receiving the program upgrade instruction to obtain a calibration result; indicate whether the data calibration is passed based on the calibration result; if so, write the new program code carried in the program upgrade instruction into the second partition 30, and send the writing completion information and the calibration result to the chip processor;

[0088] Correspondingly, the boot loader processor is also used to control the execution of the first boot program in the boot loader partition when receiving the information sent by the chip processor indicating the completion of writing and the calibration result, so as to perform a second calculation of the data verification value on the new program code written in the second partition to obtain a second verification value; determine whether the verification is passed based on the first verification value and the second verification value in the calibration result; if so, perform a partition jump based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition.

[0089] Optionally, based on the system shown in the above embodiment of the present invention, the first partition processor verifies the new program code of the application to be upgraded carried in the received program upgrade instruction to obtain the calibration result, specifically for:

[0090] Determine whether the new program code of the application to be upgraded carried in the received program upgrade instruction is complete; if so, generate information that the data calibration passed; if not, generate information that the data calibration failed; perform a first calculation of the data verification value based on the new program code to obtain a first verification value; generate a calibration result with the information that the data calibration passed or the information that the data calibration failed, and the first verification value.

[0091] Specifically, when the first partition processor receives the new program code through a communication interface with the chip processor (such as a network, a serial port, etc.), it detects whether the header code and the tail code of the new program code exist. If so, it indicates that the new program code is complete, and generates information that the data calibration has passed; if not, generates information that the data calibration has failed; then, the new code program is initialized first, and then the new code program is processed, that is, shifting, XORing, and checking the high bit are performed, and the steps are repeated until all the new code programs are processed to obtain a first check value; the information that the data calibration has passed or the information that the data calibration has failed, as well as the first check value, generates a calibration result.

[0092] Optionally, based on the system shown in the above embodiment of the present invention, the boot loader partition also includes a second boot program;

[0093] The boot loader processor is further used to switch the first boot program to the second boot program when receiving a program upgrade instruction; upgrade the first boot program based on the program upgrade instruction; and switch to the first boot program when it is determined that the upgraded first boot program passes the verification.

[0094] Specifically, the boot loader processor switches between the first boot program and the second boot program, that is, boot program 1 and boot program 2 are started for standby use, such as Figure 4 As shown. The first boot program is upgraded or updated based on the new program code in the program upgrade instruction to obtain a new first boot program. The upgraded first boot program is tested to determine whether the upgraded first boot program can run smoothly. If so, it means that the verification is passed. Since the code of the second boot program is the same as that of the old first boot program, the execution of the first boot program is switched at this time.

[0095] In the embodiment of the present invention, the first boot program and the second boot program of the boot partition are started to be upgraded online; to ensure that the system can run continuously and stably, the boot partition will temporarily switch to and execute the backup boot program. When the new boot program is verified to be correct and ready, the boot partition will automatically switch to and execute the new boot program.

[0096] See also Figure 5 , is a flow chart of a data processing method according to an embodiment of the present invention, the method comprising:

[0097] Step S501: The first partition processor receives a program upgrade instruction.

[0098] Optionally, the external device is connected to the embedded chip via a network or other connection methods, and the external device generates a program upgrade instruction from the program code corresponding to the application to be upgraded and transmits it to the chip processor via the network or other connection methods.

[0099] The chip processor receives a program upgrade instruction, determines the storage location of the application to be upgraded based on the program upgrade instruction, and if it is determined that the program code of the application is stored in the first partition, forwards the program upgrade instruction to the first partition processor so that the first partition processor receives it.

[0100] Similarly, if it is determined that the program code of the application is stored in the second partition, the program upgrade instruction is forwarded to the second partition processor so that the second partition processor receives it.

[0101] It should be noted that the processing process of the second partition processor on the program upgrade instruction is the same as the processing process of the first partition processor on the program upgrade instruction, and they can refer to each other.

[0102] Step S502: The first partition processor determines whether the program code of the application to be upgraded in the program upgrade instruction in the current first partition is in an execution state. If it is determined that the program code of the application to be upgraded in the program upgrade instruction in the current first partition is in an execution state, step S503 is executed; if not, step S505 is executed.

[0103] It should be noted that the specific implementation of step S502 includes the following steps:

[0104] Step S11: traverse all running applications in the first partition to determine whether there is an application with the same identifier as the application to be upgraded in the program upgrade instruction. If so, execute step S12; if not, execute step S13.

[0105] In the specific implementation of step S11, all running applications in the first partition and the identifier of each application are obtained; the identifier of the application to be upgraded in the program upgrade instruction is obtained; it is determined whether there is an application with the same identifier as the application to be upgraded in the program upgrade instruction among all running applications, if so, execute step S12; if not, execute step S13.

[0106] It should be noted that the identifier can be the application name and application version number.

[0107] Step S12: Determine whether the program code of the application to be upgraded in the program upgrade instruction in the current first partition is in an execution state.

[0108] Step S13: Determine that the program code of the application to be upgraded in the program upgrade instruction in the current first partition is in an unexecuted state, and execute step S505.

[0109] Step S503: the first partition processor writes the new program code of the application to be upgraded in the program upgrade instruction into the second partition, and sends the writing completion information to the chip processor;

[0110] In the process of implementing step S503, the first partition processor writes the new program code of the application to be upgraded into the second partition in the execution order of the new program code, and when it is determined that the end code of the new program code has been written into the second partition, it is determined that the writing of the new program code is completed; at this time, the writing completion information is generated and sent to the chip processor.

[0111] In an embodiment of the present invention, there is no need to back up the program code in the first partition, and the new program code is directly written into another partition so that before the subsequent boot loading processor verification is passed, the current execution partition, that is, the program code of the application to be upgraded in the first partition, will continue to be executed to ensure the stability and continuity of the system.

[0112] Step S504: when the boot loader processor receives the writing completion information sent by the chip processor, it performs partition jump based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition.

[0113] Optionally, when the chip processor receives the writing completion information, it forwards the writing completion information to the boot loading processor to control the boot loading processor to perform execution switching.

[0114] It should be noted that the process of performing partition jump based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition includes the following steps:

[0115] Step S21: the boot loader processor stops the execution of the program code of the application to be upgraded in the program upgrade instruction;

[0116] Step S22: booting the first boot program to execute the new program code of the second partition within the first time.

[0117] In the process of implementing step S21 and step S22, the boot loader processor switches the execution of the old program code and the new program code, specifically first stops the running of the program code of the application to be upgraded in the program upgrade instruction; guides the first boot program to obtain the identification value of the application to be upgraded in the first partition, and the identification value of the application to be upgraded in the second partition, compares the identification value of the application to be upgraded in the first partition with the identification value of the application to be upgraded in the second partition, if the identification value of the application to be upgraded in the second partition is greater than the identification value of the application to be upgraded in the first partition, guides the first boot program to execute the new program code of the second partition within a preset first time, otherwise, guides the first boot program to execute the new program code of the first partition within the preset first time.

[0118] It should be noted that the identification value is composed of the version number of the application to be upgraded. Generally speaking, the newer the version, the larger the corresponding identification value, and the identification value is carried in the program code.

[0119] It should be noted that the first time is set in advance by the technician based on experience or experiments, and is generally 3 milliseconds. The first time is shorter to make the switching process more seamless.

[0120] Step S505: the first partition processor directly writes the program code of the application to be upgraded in the program upgrade instruction into the first partition.

[0121] In the specific process of implementing step S505, the first partition processor writes the new program code carried in the program upgrade instruction into the first partition to replace the old program code corresponding to the new program code in the first partition.

[0122] Optionally, after executing step S22, the method further includes:

[0123] Step S31: the boot loader processor determines whether there is any abnormality in the operation of the new program code within the first time period; if so, step S32 is executed; if not, steps S33 and S34 are executed.

[0124] In the process of implementing step S31, an exception detection device is used to determine whether there are program errors or bugs in the running process of the new program code that affect its normal operation, such as execution failure, data failure, etc. If so, step S32 is executed; if not, steps S33 and S34 are executed.

[0125] It should be noted that the first time period is a time interval from code writing to normal code operation, which is set in advance by the technician based on actual conditions.

[0126] Step S32: switching to execute the program code of the application to be upgraded in the first partition.

[0127] It should be noted that the specific implementation process of step S32 is the same as the specific implementation process of step S21 and step S22, and they can refer to each other.

[0128] Step S33: continue to execute the new program code in the second partition;

[0129] Step S34: deleting the program code of the application to be upgraded in the first partition after the first time period.

[0130] In the process of implementing steps S33 and S34, it is determined that the new program code in the second partition can be executed normally at this time, and the first boot program is guided to execute the new program code in the second partition; then, after the first time period, that is, after the new program code runs stably, the program code of the application to be upgraded in the first partition is deleted.

[0131] In an embodiment of the present invention, when the application of the embedded chip is upgraded online, without removing or physically replacing the chip, the first partition processor receives a program upgrade instruction. If it is determined that the program code of the application to be upgraded in the current first partition and the program upgrade instruction is in the execution state, the new program code carried in the program upgrade instruction is written into the second partition, and the writing completion information is sent to the chip processor; not only can the embedded chip be prevented from being damaged, but also the stability and continuity of the embedded chip are ensured. When the boot loader processor receives the writing completion information sent by the chip processor, it performs a partition jump based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition; the firmware or software on the chip, that is, the application is updated and upgraded by writing through an external device, which not only ensures the efficiency of online upgrades, but also improves the reliability and security of the application.

[0132] See also Figure 6 , is a flow chart of a data processing method according to an embodiment of the present invention, the method comprising:

[0133] Step S601: The first partition processor receives an application upgrade instruction.

[0134] Step S602: The first partition processor determines whether the program code of the application to be upgraded in the program upgrade instruction in the current first partition is in an execution state. If it is determined that the program code of the application to be upgraded in the program upgrade instruction in the current first partition is in an execution state, step S603 is executed; if not, step S609 is executed.

[0135] It should be noted that the specific implementation process of step S601 to step S602 is the same as the specific implementation process of the above-mentioned specific implementation step S501 and step S502, and they can refer to each other.

[0136] Step S603: the first partition processor performs data calibration on the new program code of the application to be upgraded carried in the received program upgrade instruction to obtain a calibration result.

[0137] The specific process of implementing step S603 includes the following steps.

[0138] Step S41: Determine whether the new program code of the application to be upgraded carried in the received program upgrade instruction is complete, if so, execute step S42, if not, execute step S43.

[0139] In the specific implementation of step S603, when the first partition processor receives the new program code through a communication interface with the chip processor (such as a network, a serial port, etc.), it detects whether the header code and the tail code of the new program code exist. If so, it means that the new program code is complete, and step S42 is executed. If not, step S43 is executed.

[0140] It should be noted that the header code and the tail code are standard codes pre-set by technicians to detect the integrity of the code.

[0141] Step S42: Generate information indicating that data calibration has passed;

[0142] Step S43: Generate information indicating data calibration failure;

[0143] Step S44: performing a first calculation of a data check value based on the new program code to obtain a first check value.

[0144] In the specific implementation of step S44, the new code program is first initialized, and then processed, that is, shifted, XORed, and high bits are checked, and the steps are repeated until all new code programs are processed to obtain a first check value.

[0145] Step S45: Generate a calibration result using the information of data calibration passing or data calibration failing and the first check value.

[0146] It should be noted that the calibration result includes whether the data calibration passes or fails, and the first verification value.

[0147] Step S604: the first partition processor indicates whether the data calibration is passed based on the calibration result. If so, step S605 is executed. If not, information indicating data reception failure is output and fed back to the external device through the chip processor.

[0148] In the process of implementing step S604, it is determined whether there is information that the data calibration has passed in the calibration result. If so, it means that the calibration result indicates that the data calibration has passed, and step S605 is executed. If not, it means that the calibration result indicates that the data calibration has not passed, then the information that the data reception has failed is output and fed back to the external device through the chip processor.

[0149] Step S605: the first partition processor writes the new program code of the application to be upgraded carried in the program upgrade instruction into the second partition, and sends the writing completion information and the calibration result to the chip processor.

[0150] Optionally, when the write completion information is sent to the chip processor, the calibration result is also sent to the chip processor so that the chip processor forwards it to the boot loader processor.

[0151] It should be noted that the specific implementation process of the specific implementation step S605 is the same as the specific implementation process of the above-mentioned specific implementation step S503, and they can refer to each other.

[0152] In an embodiment of the present invention, during the upgrade process, there is no need to back up the code program data, and these data are safely written into another new APP partition. The current execution partition, that is, the first partition plays the role of receiving the write and will not save the upgrade program code.

[0153] Step S606: When the boot loader processor receives the writing completion information and the calibration result sent by the chip processor, it executes the first boot program in the boot loader partition to perform a second calculation on the check value of the written new program code data to obtain a second check value;

[0154] It should be noted that the process of obtaining the second verification value is the same as the process of obtaining the first verification value, and they can refer to each other.

[0155] The present invention verifies whether the written data is consistent with the received data by guiding the loading processor.

[0156] Optionally, in different usage scenarios, the data verification method may vary, including but not limited to CRC verification.

[0157] Step S607: The boot loader processor determines whether verification is successful based on the first check value and the second check value in the calibration result. If so, step S608 is executed. If not, information indicating data reception failure is output and fed back to the external device through the chip processor.

[0158] In the specific implementation of step S607, the first verification value and the second verification value are compared to see if they are consistent. If they are consistent, it means that the verification is passed and step S608 is executed. If not, the information of data reception failure is output and fed back to the external device through the chip processor.

[0159] Step S608: the boot loader processor performs partition jump based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition.

[0160] Step S609: the first partition processor directly writes the program code of the application to be upgraded in the program upgrade instruction into the first partition.

[0161] It should be noted that the specific implementation process of step S608 and step S609 is the same as the specific implementation process of step S504 and step S505 mentioned above, and they can refer to each other.

[0162] In order to better understand the method shown in the above embodiment of the present invention, an example is given below for illustration.

[0163] If the chip is currently executing program code A of APP partition 1; when it is necessary to receive new program code a through a communication interface (such as a network, serial port, etc.) to upgrade the application; the processor in APP partition 1 will receive the new program code a, and after the data is verified to be correct, write the received new program code a into APP partition 2, and wait until the new program code a is completely written; the chip processor starts the first boot of the boot partition to perform data calibration on all written data.

[0164] APP partition 1 will perform data verification on the received data, obtain a verification value of 1, and send it to the boot loader processor.

[0165] After the bootloader processor is upgraded, the program of the boot partition will perform data verification on the new program code a of the updated APP partition 2 to obtain a verification value 2. Based on the comparison between the verification value 1 and the verification value 2, if the verification values ​​are consistent, the verification is completed.

[0166] Optionally, the first boot program still executes program code A before executing the program code of APP partition 2.

[0167] In the embodiment of the present invention, during the upgrade process, if there is no need for data backup, the data will be directly written into the APP partition that needs to be updated, and the current execution partition plays more of a role of receiving writes. If there is no special need, the upgrade data will not be saved.

[0168] In an embodiment of the present invention, when an application of an embedded chip is upgraded online, without removing or physically replacing the chip, the first partition processor receives a program upgrade instruction. If it is determined that the program code of the application to be upgraded in the current first partition and the program upgrade instruction is in an execution state, the new program code is verified to obtain a calibration result; if the calibration result indicates that the verification is passed, the new program code carried in the program upgrade instruction is written into the second partition, and the information of the completion of writing and the calibration result are sent to the chip processor; not only can the embedded chip be prevented from being damaged, but also the stability and continuity of the embedded chip are guaranteed; when the boot loader processor receives the information of the completion of writing and the calibration result sent by the chip processor, it compares the first check value of the calibration result and the calculated second check value to see if they are consistent. If they are consistent, a partition jump is performed based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition; the firmware or software on the chip, that is, the application is updated and upgraded by writing by an external device, which not only ensures the efficiency of the online upgrade, but also improves the reliability and security of the application.

[0169] See also Figure 7 , is a flow chart of a data processing method according to an embodiment of the present invention, the method comprising:

[0170] Step S701: When the boot loader processor receives a program upgrade instruction, the first boot program is switched to a second boot program;

[0171] In the specific process of implementing step S701, the boot loader processor switches between the first boot program and the second boot program.

[0172] Step S702: upgrading the first boot program based on the program upgrade instruction;

[0173] In the specific process of implementing step S702, the boot loader processor upgrades or updates the first boot program based on the new program code in the program upgrade instruction to obtain a new first boot program.

[0174] Step S703: Verify the upgraded first boot program. If the verification passes, execute step S704. If the verification fails, the upgrade failure information is fed back to the external device through the chip processor.

[0175] In the process of implementing step S703, the boot loader processor tests the upgraded first boot program to determine whether the upgraded first boot program can run smoothly. If so, it means that the verification is passed, and step S704 is executed. If the verification fails, the upgrade failure information is fed back to the external device through the chip processor.

[0176] Step S704: Switch to the first boot program.

[0177] In the specific implementation of step S704, since the second boot program has the same code as the old first boot program, after the verification in step S703 is passed, the boot loader processor switches to the execution of the first boot program.

[0178] Optionally, after executing step S704, the program upgrade instruction upgrades the second boot program so that the first boot program and the second boot program can run normally.

[0179] In the embodiment of the present invention, the first boot program and the second boot program of the boot partition are started to be upgraded online; to ensure that the system can run continuously and stably, the boot partition will temporarily switch to and execute the backup boot program. When the new boot program is verified to be correct and ready, the boot partition will automatically switch to and execute the new boot program.

[0180] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may 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 creative work.

[0181] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0182] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data processing method based on an embedded chip, characterized in that: Applied to a data processing system based on an embedded chip, the data processing system includes a first partition processor, a boot loader processor, a chip processor, a first partition, a second partition and a boot loader partition, the method includes: The first partition processor receives the program upgrade instruction, and if it is determined that the program code of the application to be upgraded in the program upgrade instruction is currently in the first partition and is in an execution state, writes the new program code of the application to be upgraded carried in the program upgrade instruction into the second partition, and sends the writing completion information to the chip processor; When the boot loader processor receives the writing completion information sent by the chip processor, it performs partition jump based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition.

2. The method according to claim 1, characterized in that The first partition processor determines that the program code of the application to be upgraded in the program upgrade instruction in the current first partition is in an execution state, including: Traversing all running applications in the first partition to determine whether there is an application with the same identifier as the application to be upgraded in the program upgrade instruction; If so, it is determined that the program code of the application to be upgraded in the first partition and the program upgrade instruction is currently in an execution state.

3. The method according to claim 1, characterized in that The boot loader processor performs partition jump based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition, including: The bootloader processor stops the execution of the program code of the application to be upgraded in the program upgrade instruction; The first boot program is booted within a first time to execute the new program code of the second partition.

4. The method according to claim 3, characterized in that After the first boot program is booted to execute the new program code of the second partition within the first time, the method further includes: The bootloader processor determines whether there is an abnormality in the execution of the new program code within the first time period; If so, switching to execute the program code of the application to be upgraded in the first partition; If it does not exist, continue to execute the new program code in the second partition; The program code of the application to be upgraded in the first partition is deleted after a first time period.

5. The method according to claim 1, characterized in that Also includes: After receiving the program upgrade instruction, the first partition processor verifies the new program code of the application to be upgraded carried in the received program upgrade instruction to obtain a calibration result; Indicating whether the data calibration is passed based on the calibration result; If so, write the new program code carried in the program upgrade instruction into the second partition, and send the writing completion information and the calibration result to the chip processor; When the boot loader processor receives the writing completion information and the calibration result sent by the chip processor, it controls the execution of the first boot program in the boot loader partition to perform a second calculation of the data check value on the new program code written in the second partition to obtain a second check value; Determining whether verification is passed based on the first verification value and the second verification value in the calibration result; If yes, a step of performing a partition jump based on the program code in the first partition and the new program code in the second partition is performed to execute the new program code in the second partition.

6. The method according to claim 5, characterized in that Verifying the new program code of the application to be upgraded carried in the received program upgrade instruction to obtain a calibration result includes: Determining whether the new program code of the application to be upgraded carried in the received program upgrade instruction is complete; If so, generate information indicating that the data calibration has passed; If not, a message of data calibration failure is generated; Performing a first calculation of a data check value based on the new program code to obtain a first check value; The information on the data calibration passing or the data calibration failing and the first check value are used to generate a calibration result.

7. The method according to claim 1, characterized in that The boot loader partition also includes a second boot program, and the method further includes: When the boot loader processor receives a program upgrade instruction, the boot loader processor switches the first boot program to a second boot program; Upgrading the first boot program based on the program upgrade instruction; When it is determined that the upgraded first boot program passes verification, switch to the first boot program.

8. A data processing system based on an embedded chip, characterized in that: including a first partition processor, a boot loader processor, a chip processor, a first partition, a second partition and a boot loader partition; The first partition processor is configured to receive a program upgrade instruction, and if it is determined that the program code of the application to be upgraded in the program upgrade instruction is currently in the first partition and is in an execution state, write the new program code of the application to be upgraded carried in the program upgrade instruction into the second partition, and send a writing completion message to the chip processor; The boot loader processor is used to perform partition jump based on the program code in the first partition and the new program code in the second partition when receiving the writing completion information sent by the chip processor, so as to execute the new program code in the second partition.

9. The system according to claim 8, characterized in that Determining a first partition processor in the current first partition that is in an execution state of the program code of the application to be upgraded in the program upgrade instruction is specifically used to: Traversing all running applications in the first partition to determine whether there is an application with the same identifier as the application to be upgraded in the program upgrade instruction; If so, it is determined that the program code of the application to be upgraded in the first partition and the program upgrade instruction is currently in an execution state.

10. The system according to claim 8, characterized in that The boot loader processor that performs partition jump based on the program code in the first partition and the new program code in the second partition to execute the new program code in the second partition is specifically used for: Stopping the execution of the program code of the application to be upgraded in the program upgrade instruction; The first boot program is booted within a first time to execute the new program code of the second partition.