Data burning method and device, equipment and storage medium
By negotiating the protocol format with the PC, directly receiving and recording the program to be recorded, the problem of low universality of data recording in the prior art is solved, and the goal of non-professional personnel can also achieve the goal of data recording.
Patent Information
- Application Number
- CN202411203635.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-12-20
AI Technical Summary
In the prior art, data burning requires the use of professional burners and tools, which leads to low universality of data burning, making it difficult for non-professional personnel to upgrade the program.
By negotiating the protocol format with the PC, directly receive and record the programs to be burned, reserve appropriate Flash storage space, and use the file information in the protocol format for data interaction, avoiding dependence on professional tools.
It improves the universality of data burning, allowing non-professional personnel to complete data burning, reducing complexity and difficulty.
Smart Images

Figure CN119166168A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of burning, and in particular to a data burning method, device, equipment and storage medium. Background Art
[0002] In embedded system development and electronic product manufacturing, data burning is an important step. Burning refers to the process of writing specific data or programs into programmable devices through dedicated software and hardware tools.
[0003] At present, a special burner interface is usually used to control the connection with the target MCU (Microcontroller Unit), the burner triggers the reset of the target MUC, and controls the Boot pin of the target MCU to make the MCU enter the burning mode; the burning software is started, and the driver to be burned is written into the target MCU Flash (Flash memory) according to a specific burning protocol, thereby completing the upgrade or burning of the program. However, using the burner to burn data requires the use of a professional burning tool as an auxiliary, so that data can be burned, and the professionalism of the professional burning tool is relatively strong, and professionals are required to use it, therefore, it is inconvenient for non-professionals to upgrade the program, and then the universality of data burning is low.
[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the present application is to provide a data burning method, which aims to solve the technical problem that the use of a burner to burn data requires the use of a professional burning tool as an auxiliary, resulting in low universality of data burning.
[0006] To achieve the above purpose, the present application proposes a data burning method, which is applied to MCU, and the method comprises:
[0007] Receiving file information of a program to be burned sent by a PC, wherein the format of the file information is a protocol format negotiated with the PC;
[0008] Identifying the file size of the program to be burned from the file information based on the protocol format;
[0009] Reserving storage space corresponding to the file size in a preset Flash area;
[0010] Receive the program to be burned in the protocol format sent by the PC, and burn the program to be burned into the storage area.
[0011] In one embodiment, the step of reserving storage space corresponding to the file size in a preset Flash area includes:
[0012] Identify verification reference data from the file information, and cache the file information in a preset Flash area;
[0013] Identify the data to be verified from the file information in the preset Flash area;
[0014] Comparing the data to be verified with the verification reference data to see whether they are the same;
[0015] If it is determined that the data to be verified is the same as the verification reference data, a storage space corresponding to the file size is reserved in the preset Flash area.
[0016] In one embodiment, the step of comparing whether the data to be verified is the same as the verification reference data comprises:
[0017] Comparing the frame number and the inverse code of the frame number in the data to be verified with the frame number and the inverse code of the frame number in the verification reference data to see whether they are the same;
[0018] If it is determined to be the same, comparing the checksum in the data to be verified with the checksum in the verification reference data to see if they are the same;
[0019] If it is determined that they are the same, then it is determined that the data to be verified is the same as the verification reference data.
[0020] In one embodiment, the step of receiving the program to be burned in the protocol format sent by the PC and burning the program to be burned into the storage area includes:
[0021] Receiving valid frame data sent by the PC and constituting the program to be burned, wherein the format of the valid true data is the protocol format;
[0022] After the valid frame data of the current frame is burned, the valid frame data of the next frame of the program to be burned sent by the PC is received and burned, until all the valid frame data in the program to be burned are burned, and it is determined that the program to be burned is burned into the storage interval.
[0023] In one embodiment, the MCU is connected to the PC via a universal communication interface that converts other interfaces through a USB interface, and the step of receiving the file information of the program to be burned sent by the PC also includes:
[0024] After detecting power-on, obtain the response of the preset button;
[0025] The step of receiving the file information of the program to be burned sent by the PC terminal comprises:
[0026] If it is determined that the response situation is that the Boot program continues to run, the file information of the program to be burned sent by the PC is received based on the USB interface.
[0027] In one embodiment, if it is determined that the response condition is that the Boot program continues to run, the step of receiving the file information of the program to be burned sent by the PC end based on the USB interface includes:
[0028] If it is determined that the response is that the Boot program continues to run, a handshake signal is sent to the PC end;
[0029] Upon receiving an upgrade start signal generated by the PC based on the handshake signal;
[0030] Based on the upgrade start signal and the USB interface conversion, other interfaces receive file information of the program to be burned sent by the PC.
[0031] In addition, to achieve the above purpose, the present application also proposes a data burning device, which is applied to MCU, and the data burning device includes:
[0032] An information receiving module, used for receiving file information of a program to be burned sent by a PC, wherein the format of the file information is a protocol format negotiated with the PC;
[0033] An identification module, used for identifying the file size of the program to be burned from the file information based on the protocol format;
[0034] A reservation module, used to reserve storage space corresponding to the file size in a preset Flash area;
[0035] The program receiving module is used to receive the program to be burned in the protocol format sent by the PC end, and burn the program to be burned into the storage area.
[0036] In addition, to achieve the above objectives, the present application also proposes a data burning device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data burning method described above.
[0037] In addition, to achieve the above objectives, the present application also proposes a storage medium, which is a computer-readable storage medium, and stores a computer program on the storage medium. When the computer program is executed by a processor, the steps of the data burning method described above are implemented.
[0038] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the data burning method described above are implemented.
[0039] One or more technical solutions proposed in this application have at least the following technical effects:
[0040] The present application directly interacts with the PC side through a protocol format negotiated with the PC side, so as to avoid the use of a professional burner and a professional burning tool to interact with the PC side. After receiving the file information of the program to be burned sent by the PC side, according to the file size representing the size of the program to be burned in the file information, a storage space corresponding to the file size is opened up in the internal preset Flash area, so as to use the storage space to store the burned program to be burned, so as to ensure that there is enough burning space in the preset Flash area, and the integrity of the burned program to be burned is guaranteed. Since the program to be burned sent by the PC side is in a protocol format, non-professionals only need to select the corresponding format when uploading the program to be burned through the PC side, and do not need to seek professionals to install the burner and the burning tool, and burn under the guidance of professionals, which reduces the complexity and difficulty of data burning, and enables non-professionals to complete the work of data burning, thereby improving the universality of data burning. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0042] In order to more clearly illustrate the embodiments of the present application 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0043] Figure 1 A schematic diagram of a process flow provided for the first embodiment of the data burning method of the present application;
[0044] Figure 2 A schematic diagram of a flow chart provided for the second embodiment of the data burning method of the present application;
[0045] Figure 3 A schematic diagram of the process flow provided for the third embodiment of the data burning method of the present application;
[0046] Figure 4 A principle block diagram of a universal communication interface provided in Embodiment 3 of the present application;
[0047] Figure 5 This is a schematic diagram of the module structure of the data burning device according to an embodiment of the present application;
[0048] Figure 6 Schematic diagram of the device structure of the hardware operating environment involved in the data burning method in the embodiment of the present application.
[0049] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0051] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0052] The main solution of the embodiment of the present application is: the MCU receives the file information of the program to be burned sent by the PC (personal computer), and the format of the file information is the protocol format negotiated with the PC; based on the protocol format, the file size of the program to be burned is identified from the file information; a storage space corresponding to the file size is reserved in a preset Flash area; the program to be burned in the protocol format sent by the PC is received, and the program to be burned is burned to the storage interval.
[0053] In this embodiment, for the convenience of description, the following description is made by taking the identification of the MCU as the execution subject.
[0054] According to the prior art, a dedicated burner interface is usually used to control and connect with the target MCU. The burner triggers the reset of the target MUC and controls the Boot pin of the target MCU to put the MCU into the burning mode. The burning software is started and the driver to be burned is written into the target MCU Flash according to a specific burning protocol, thereby completing the program upgrade or burning. However, using a burner to burn data requires the use of a professional burning tool as an aid to burn the data. The professional burning tool is highly professional and requires the use of professionals. Therefore, it is very inconvenient for non-professionals to upgrade the program, which leads to low universality of data burning.
[0055] The present application provides a solution, which directly interacts with the PC side through a protocol format negotiated with the PC side, so as to avoid the need to use a professional burner and a professional burning tool to interact with the PC side. After receiving the file information of the program to be burned sent by the PC side, according to the file size representing the size of the program to be burned in the file information, a storage space corresponding to the file size is opened up in an internal preset Flash area, so as to use the storage space to store the burned program to be burned, so as to ensure that there is enough burning space in the preset Flash area, and the integrity of the burned program to be burned is guaranteed. Since the program to be burned sent by the PC side is in a protocol format, non-professionals only need to select the corresponding format when uploading the program to be burned through the PC side, and do not need to seek professionals to install the burner and the burning tool, and burn under the guidance of professionals, which reduces the complexity and difficulty of data burning, and enables non-professionals to complete the work of data burning, thereby improving the universality of data burning.
[0056] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, an MCU, etc. The following takes an MCU as an example to illustrate this embodiment and the following embodiments.
[0057] Based on this, the present application embodiment provides a data burning method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the data burning method of the present application.
[0058] In this embodiment, the data burning method includes steps S10 to S40:
[0059] Step S10, receiving file information of the program to be burned sent by the PC, wherein the format of the file information is the protocol format negotiated with the PC;
[0060] It should be noted that the program to be burned can be the program code that needs to be burned into the MCU, for example, the program code of the firmware and software used to control and manage the operation of the single-chip microcomputer and its peripheral devices. The file information can be the information related to the program to be burned, such as the size information of the memory required to be occupied after the program to be burned is packaged. The protocol format can be a format that the MCU and the PC have negotiated and can interact normally, for example, the file information is a format including a frame header, a frame number, a frame number inverse code, a file size, and a checksum.
[0061] In addition, it should be noted that the frame header can be used by the MCU to identify whether the received data is a program to be burned or file information. The frame number can represent the sequence number of the file or data received by the MCU when burning the current program to be burned. The frame number inverse code can be another expression corresponding to the frame number, for example, if the frame number is 0x01, the frame number inverse code can be 0xFE, etc. The checksum can be CheckSum, a method for checking data integrity by calculating the sum of the numerical values of the data.
[0062] It is understandable that, since different MCUs need to use different burners and burning tools when burning programs into the MCU, in order to prevent the PC from directly transmitting the program data of the program to be burned to the MCU and to avoid using the burner and burning tools when burning the program, the protocol format of data transmission, that is, the burning protocol, can be negotiated with the PC, so as to utilize the burning protocol to directly receive the data corresponding information of the program to be burned from the PC.
[0063] It is understandable that since the MCU needs to store the program to be burned in Flash after receiving it, and the storage area in Flash is limited, in order to enable the MCU to completely store the program to be burned after receiving it, and to ensure the transmission between the PC and the MCU and the MCU storing data in Flash, the file information of the program to be burned can be obtained first, so as to reserve storage space from Flash according to the size of the program to be burned recorded in the file information.
[0064] Step S20, identifying the file size of the program to be burned from the file information based on the protocol format;
[0065] It should be noted that the file size may be the size of the memory required after the program to be burned is packaged.
[0066] It is understandable that, since the format of the file information is a protocol format, the file size of the program to be burned in the file information can be identified according to the characters representing the file size in the protocol format, so as to reserve storage space from the Flash according to the identified file size.
[0067] In a specific implementation, the position of the file size in the file information is determined according to the protocol format, or the characters representing the file size in the file information are determined, so as to identify the file size of the program to be burned from the file information, and inform the MCU of the file size to be burned through the file size, so as to reserve sufficient Flash area for storing the program to be burned.
[0068] Step S30, reserving a storage space corresponding to the file size in a preset Flash area;
[0069] It should be noted that the preset Flash area may be a non-volatile memory, which is usually used to store program codes and run directly in the preset Flash area.
[0070] It can be understood that since the program burned in the preset Flash area will run directly in the preset Flash area, when a program is burned to the preset Flash area, it is necessary to erase the unnecessary obsolete programs in the preset Flash area to release storage space, and then reserve storage space for the program to be burned next, so as to ensure that the program to be burned subsequently can be completely stored in the storage interval, wherein the storage space can be an integer multiple of the preset Flash sector, for example, an integer multiple of 512 bytes.
[0071] It can be understood that reserving storage space as an integer multiple of the preset Flash sector can divide the program to be burned into valid frame data of the same size as the preset Flash sector during the subsequent burning process, so that each frame of burned data can correspond to a preset Flash sector for storage, avoiding the preset Flash area to organize the program to be burned, that is, simplifying the process of data burning, thereby reducing the burning time to improve the burning efficiency.
[0072] In a specific implementation, duplicate program files or obsolete programs such as original files of updated programs in the preset Flash area are screened out in the preset Flash area, and these obsolete programs are erased to release space in the preset Flash area. Storage space corresponding to the file size is divided out from the released space to store the programs to be burned subsequently. Since the size of the storage space is an integer multiple of the preset Flash sector, the storage space needs to be slightly larger than the file size.
[0073] Step S40, receiving the program to be burned in the protocol format sent by the PC, and burning the program to be burned into the storage area.
[0074] It is understandable that, since the MCU and the PC determine the protocol format, the protocol format needs to be used when the PC sends the program to be burned, so that the MCU can accurately identify the data sent by the PC.
[0075] It is understandable that, since the protocol format is determined by negotiation between the MCU and the PC, when the program is subsequently upgraded, the latest program can be sent remotely to the MCU through the PC according to the protocol format, so that the MCU remotely receives the latest program and upgrades the corresponding firmware according to the latest program, thereby achieving remote upgrade requirements for products or driver boards that have been shipped to the client.
[0076] Furthermore, step S40 may also include:
[0077] Receiving valid frame data sent by the PC and constituting the program to be burned, wherein the format of the valid true data is the protocol format;
[0078] After the valid frame data of the current frame is burned, the valid frame data of the next frame of the program to be burned sent by the PC is received and burned, until all the valid frame data in the program to be burned are burned, and it is determined that the program to be burned is burned into the storage interval.
[0079] It is understandable that since the data is burned frame by frame during the burning process, in order to simplify the burning process, the size of each frame of data can be divided according to the minimum sector of the Flash area set in the MCU, that is, during burning, the valid frame data of each frame corresponds to a Flash sector, which reduces the management process of the preset Flash area for the burned program to be burned, and improves the burning efficiency.
[0080] In the specific implementation, after receiving the ACK information sent by the MCU indicating that the file information is successfully stored, the PC side prepares to send the first frame of valid frame data, which includes frame header + frame number + frame number inverse code + [valid data size] + CheckSum; the MCU receives this information and buffers it into the storage space reserved in the preset Flash area, calculates the data checksum through the CheckSum formula, and compares it with the checksum transmitted by the PC side; if they are equal, the MCU writes the data in the memory buffer to the Flash address where the app starts, and after writing is completed, reads the written data from the address where the writing starts from this frame, and compares the original written data with the read data to see if they are completely consistent. If they are consistent, the MCU returns an ACK message to the PC side, records the starting address to be written in the next frame (the previously written address + 1), to start the transmission of the next frame of data, and records the total size of the burned data and compares it with the previously recorded file size to determine whether the entire transmission is completed; if they are inconsistent, the MCU returns a NACK message and ends subsequent operations;
[0081] It should be noted that the consistency check of the burned data is completed by the MCU instead of the PC, which can save the time of transmitting the frame data once. When the file to be burned is large and the number of transmissions is large, the improvement of the burning efficiency is more obvious, thereby improving the burning efficiency of the burned data.
[0082] Among them, CheckSum = sum(data0+data1+…data32767)%256.
[0083] When transmitting the valid frame data of the last frame, since the MUC Flash is burned in sectors, if the valid frame data size of the last frame is not an integer multiple of the MCU sector size, the remaining part of the sector will be padded to make it an integer multiple of the sector size before transmission, so as to further simplify the MCU Flash data writing process, reduce the burning time and improve the burning efficiency.
[0084] The present embodiment provides a data burning method, which directly interacts with the PC end through a protocol format negotiated with the PC end, so as to avoid the need to use a professional burner and a professional burning tool to interact with the PC end. After receiving the file information of the program to be burned sent by the PC end, according to the file size representing the size of the program to be burned in the file information, a storage space corresponding to the file size is opened up in the internal preset Flash area, so as to use the storage space to store the burned program to be burned, so as to ensure that the preset Flash area has sufficient burning space, and the integrity of the burned program to be burned is guaranteed. Since the program to be burned sent by the PC end is in a protocol format, non-professionals only need to select the corresponding format when uploading the program to be burned through the PC end, and do not need to seek professionals to install the burner and the burning tool, and burn under the guidance of professionals, which reduces the complexity and difficulty of data burning, and enables non-professionals to complete the work of data burning, thereby improving the universality of data burning.
[0085] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2 Before step S30, the data burning method further includes steps S31 to S34:
[0086] Step S31, identifying verification reference data from the file information, and caching the file information into a preset Flash area;
[0087] It should be noted that the verification reference data may be the frame number, frame number inverse code and checksum of the file information before it is temporarily stored in the preset Flash area, etc., which are used to verify the integrity of the file information and whether the file information is complete after being temporarily stored.
[0088] It should be noted that the verification reference data not only exists in the file information, but also exists in the data frame of the program to be burned transmitted from the PC to the MCU during the burning process.
[0089] It is understandable that since errors or partial loss may occur during the transmission or storage of data, in order to ensure that there are no errors in the file information transmitted by the PC, and that there are no errors in the caching process when temporarily storing the file information in the preset Flash area, it is ensured that the file information finally cached in the preset Flash area is consistent with the file information sent by the PC.
[0090] Step S32, identifying the data to be verified from the file information in the preset Flash area;
[0091] It should be noted that the data to be verified may be the frame number, the inverse code of the frame number, and the checksum in the file information after the file information is stored in the preset Flash area, and other data used to verify the integrity of the file information.
[0092] It can be understood that in order to ensure that no errors occur in the file information after it is transmitted and stored, and to avoid comparing all valid data before and after the file information is transmitted and cached, the data to be verified can be identified from the file information temporarily stored in the preset Flash area for comparison with the verification reference data to verify the integrity and correctness of the file information.
[0093] Step S33, comparing the data to be verified with the verification reference data to see if they are the same;
[0094] It is understandable that since errors in the transmission of file information may cause data in the file information to be lost or misplaced, after the file information passes through the transmission cache, it can be verified by comparing the data to be verified with the verification reference data. When the data to be verified is the same as the verification reference data, it can be determined that no errors have occurred in the file information during the transmission and caching process.
[0095] Step S34: If it is determined that the data to be verified is the same as the verification reference data, a storage space corresponding to the file size is reserved in the preset Flash area.
[0096] It can be understood that since the data to be verified is the same as the verification reference data, it indicates that there is no error in the transmission and caching process of the file information. Therefore, it can be explained that the MCU has obtained the correct file size of the program to be burned from the file information, and then uses the file size to reserve a storage space of a corresponding size in the preset Flash area to ensure that the program to be burned can be completely burned to the storage space.
[0097] It is understandable that the text information of the program to be burned will be temporarily stored in the preset Flash area before burning the program to be burned. It can also be determined in advance whether the data can be burned using the negotiated burning protocol to ensure that the subsequent burning of the program to be burned can proceed smoothly.
[0098] Furthermore, step S33 may also include:
[0099] Comparing the frame number and the inverse code of the frame number in the data to be verified with the frame number and the inverse code of the frame number in the verification reference data to see whether they are the same;
[0100] If it is determined to be the same, comparing the checksum in the data to be verified with the checksum in the verification reference data to see if they are the same;
[0101] If it is determined that they are the same, then it is determined that the data to be verified is the same as the verification reference data.
[0102] It can be understood that, since the frame number and the inverse of the frame number correspond to each other, when an error occurs in the transmission of file information or valid frame data, the frame number and the inverse of the frame number may be confused. For example, if data loss or confusion occurs, the frame number and the inverse of the frame number will not correspond. Therefore, after receiving the file information or valid frame data, by comparing the frame number with the inverse of the account number, it can be determined that there is no error in the file information or the program to be burned during the transmission process, that is, it is guaranteed that the file information or the program to be burned received by the MCU is the same as that on the PC. In order to ensure the integrity and accuracy of the data after burning, a checksum is used for verification to ensure that the program to be burned or the file information after burning is the program to be burned or the file information sent by the PC, thereby ensuring the accuracy of burning.
[0103] Based on the first and second embodiments of the present application, in the third embodiment of the present application, the same or similar contents as those of the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 3 Before step S10, the data burning method further includes steps S1 to S2:
[0104] Step S1, after detecting power-on, obtaining the response of the preset button;
[0105] Step S2: If it is determined that the response is that the Boot program continues to run, the file information of the program to be burned sent by the PC is received based on the USB interface.
[0106] It should be noted that the MCU is connected to the PC via a universal communication interface that converts other interfaces from a USB interface. Therefore, when the PC sends file information or a program to be burned, it is transmitted via the universal communication interface.
[0107] Among them, reference Figure 4 The principle of the universal communication interface is to convert the other interfaces through the USB interface to ensure that no matter what kind of interface the MCU is, it can be connected by the PC through the USB interface.
[0108] Among them, I2C / USB / UART / SPI are universal communication interfaces. For the USB interface, an external host (such as a PC) can establish a connection with the MCU through this interface; for the other interfaces mentioned above, a conversion device (such as USB to I2C, USB to UART, USB to SPI) is required to establish a connection between the PC and the MCU.
[0109] The button is used to distinguish whether the currently running program is App or Boot.
[0110] The target MCU is the main controller to be burned, which contains Flash memory for storing the written program.
[0111] It is understandable that after power-on is detected, the Boot program will be started first to prepare each firmware to start the APP program, and check whether each APP program has completed preparation. When the APP program is ready to start, the APP program will be started under the guidance of the Boot program. However, the boot time of the Boot program is short. When a firmware upgrade is required, the program to be burned needs to be burned into the preset Flash area of the MCU while the Boot program is running. In order to enable the user to clearly know which program is running, a button can be provided for the user to operate, so that the user can clearly know which program his operation corresponds to, avoiding the burning of data when the wrong program is running, thereby improving the efficiency of burning. For example, press and hold the button for 3 seconds, and after the Boot program completes the detection of each APP program, continue to run the Boot program, otherwise, enter the APP program.
[0112] Furthermore, step S2 further includes:
[0113] If it is determined that the response is that the Boot program continues to run, a handshake signal is sent to the PC end;
[0114] Upon receiving an upgrade start signal generated by the PC based on the handshake signal;
[0115] Based on the upgrade start signal and the USB interface conversion, other interfaces receive file information of the program to be burned sent by the PC.
[0116] It is understandable that since the most common data transmission interface on the PC side is the USB interface, and since different MCU models require different interfaces for burning data, in order to enable the PC side to directly transmit data with the MCU, the USB interface is used to convert other interfaces to receive data sent by the PC side.
[0117] It is understandable that the handshake signal is sent by the MCU in order to solve the situation where the MCU is communicating normally with the application but the PC is forced to start the upgrade process, causing communication conflicts and, in severe cases, device damage.
[0118] In the specific implementation, if the interface that the MCU needs to use is the 12C interface, a handshake signal is sent to the PC through the 12C interface. After the handshake signal is converted to other interfaces through the USB interface, it is received by the PC through the USB interface. When the PC receives the handshake signal, it indicates that the MCU is ready for the upgrade and sends file information and the program to be burned to the MCU for data burning. After the data burning is completed, the MCU controls the program to jump from the Boot program to the APP program for execution to complete the firmware upgrade.
[0119] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the data burning method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0120] This application also provides a data burning device, which is applied to MCU, please refer to Figure 5 , the data burning device comprises:
[0121] The information receiving module 10 is used to receive the file information of the program to be burned sent by the PC, and the format of the file information is the protocol format negotiated with the PC;
[0122] An identification module 20, used for identifying the file size of the program to be burned from the file information based on the protocol format;
[0123] A reservation module 30, used to reserve storage space corresponding to the file size in a preset Flash area;
[0124] The program receiving module 40 is used to receive the program to be burned in the protocol format sent by the PC, and burn the program to be burned into the storage area.
[0125] Optionally, the reservation module 30 is also used to identify verification reference data from the file information and cache the file information to a preset Flash area; identify the data to be verified from the file information in the preset Flash area; compare whether the data to be verified is the same as the verification reference data; if it is determined that the data to be verified is the same as the verification reference data, then reserve storage space corresponding to the file size in the preset Flash area.
[0126] Optionally, the reserved module 30 is also used to compare whether the frame number and the inverse code of the frame number in the data to be verified are the same as the frame number and the inverse code of the frame number in the verification reference data; if it is determined that they are the same, then compare whether the checksum in the data to be verified is the same as the checksum in the verification reference data; if it is determined that they are the same, then determine that the data to be verified is the same as the verification reference data.
[0127] Optionally, the program receiving module 40 is also used to receive valid frame data constituting the program to be burned sent by the PC, and the format of the valid true data is the protocol format; after the valid frame data of the current frame is burned, the valid frame data of the next frame of the program to be burned sent by the PC is received and burned, until all the valid frame data in the program to be burned are burned, and it is determined that the program to be burned is burned to the storage interval.
[0128] Optionally, the MCU is connected to the PC via a universal communication interface that converts other interfaces through a USB interface;
[0129] The information receiving module 10 is also used to detect the response of the preset button after power-on; if it is determined that the response is that the Boot program continues to run, the file information of the program to be burned sent by the PC is received based on the USB interface.
[0130] Optionally, the information receiving module 10 is also used to send a handshake signal to the PC end if it is determined that the response situation is that the Boot program continues to run; upon receiving the upgrade start signal generated by the PC end based on the handshake signal; based on the upgrade start signal and the USB interface, convert other interfaces to receive the file information of the program to be burned sent by the PC end.
[0131] The data burning device provided by the present application adopts the data burning method in the above embodiment, which can solve the technical problem of low universality of data burning. Compared with the prior art, the beneficial effects of the data burning device provided by the present application are the same as the beneficial effects of the data burning method provided by the above embodiment, and other technical features in the data burning device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0132] The present application provides a data burning device, which includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the data burning method in the above-mentioned embodiment 1.
[0133] Reference below Figure 6, which shows a schematic diagram of the structure of a data burning device suitable for implementing the embodiment of the present application. The data burning device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The data burning device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0134] like Figure 6 As shown, the data burning device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the data burning device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the data burning device to communicate with other devices wirelessly or by wire to exchange data. Although the data burning device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0135] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0136] The data burning device provided by the present application adopts the data burning method in the above embodiment, which can solve the technical problem of low universality of data burning. Compared with the prior art, the beneficial effects of the data burning device provided by the present application are the same as the beneficial effects of the data burning method provided by the above embodiment, and other technical features in the data burning device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0137] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0138] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0139] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the data burning method in the above-mentioned embodiment.
[0140] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0141] The computer-readable storage medium may be included in the data burning device; or may exist independently without being assembled into the data burning device.
[0142] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the data burning device, the data burning device: receives file information of the program to be burned sent by the PC, wherein the format of the file information is a protocol format negotiated with the PC; identifies the file size of the program to be burned from the file information based on the protocol format; reserves a storage space corresponding to the file size in a preset Flash area; receives the program to be burned in the protocol format sent by the PC, and burns the program to be burned to the storage interval.
[0143] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0144] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0145] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0146] The readable storage medium provided by the present application is a computer-readable storage medium, and the computer-readable storage medium stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned data burning method, which can solve the technical problem of low universality of data burning. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the data burning method provided by the above-mentioned embodiment, and will not be repeated here.
[0147] The present application also provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the steps of the data burning method as described above are implemented.
[0148] The computer program product provided by the present application can solve the technical problem of low universality of data burning. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the data burning method provided by the above embodiment, which will not be repeated here.
[0149] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A data burning method, characterized in that: Applied to MCU, the method includes: Receiving file information of a program to be burned sent by a PC, wherein the format of the file information is a protocol format negotiated with the PC; Identifying the file size of the program to be burned from the file information based on the protocol format; Reserving storage space corresponding to the file size in a preset Flash area; Receive the program to be burned in the protocol format sent by the PC, and burn the program to be burned into the storage area.
2. The method according to claim 1, characterized in that The step of reserving storage space corresponding to the file size in the preset Flash area includes: Identify verification reference data from the file information, and cache the file information in a preset Flash area; Identify the data to be verified from the file information in the preset Flash area; Comparing the data to be verified with the verification reference data to see whether they are the same; If it is determined that the data to be verified is the same as the verification reference data, a storage space corresponding to the file size is reserved in the preset Flash area.
3. The method according to claim 2, characterized in that The step of comparing whether the data to be verified is the same as the verification reference data comprises: Comparing the frame number and the inverse code of the frame number in the data to be verified with the frame number and the inverse code of the frame number in the verification reference data to see whether they are the same; If it is determined to be the same, comparing the checksum in the data to be verified with the checksum in the verification reference data to see if they are the same; If it is determined that they are the same, then it is determined that the data to be verified is the same as the verification reference data.
4. The method according to claim 1, characterized in that The step of receiving the program to be burned in the protocol format sent by the PC and burning the program to be burned into the storage area includes: Receiving valid frame data sent by the PC and constituting the program to be burned, wherein the format of the valid true data is the protocol format; After the valid frame data of the current frame is burned, the valid frame data of the next frame of the program to be burned sent by the PC is received and burned, until all the valid frame data in the program to be burned are burned, and it is determined that the program to be burned is burned into the storage interval.
5. The method according to any one of claims 1 to 4, characterized in that The MCU is connected to the PC via a universal communication interface converted from a USB interface to another interface, and the step of receiving file information of the program to be burned sent by the PC also includes: After detecting power-on, obtain the response of the preset button; The step of receiving the file information of the program to be burned sent by the PC terminal comprises: If it is determined that the response situation is that the Boot program continues to run, the file information of the program to be burned sent by the PC is received based on the USB interface.
6. The method according to claim 5, characterized in that If it is determined that the response condition is that the Boot program continues to run, the step of receiving the file information of the program to be burned sent by the PC end based on the USB interface includes: If it is determined that the response is that the Boot program continues to run, a handshake signal is sent to the PC end; Upon receiving an upgrade start signal generated by the PC based on the handshake signal; Based on the upgrade start signal and the USB interface conversion, other interfaces receive file information of the program to be burned sent by the PC.
7. A data burning device, characterized in that: Applied to MCU, the device comprises: An information receiving module, used for receiving file information of a program to be burned sent by a PC, wherein the format of the file information is a protocol format negotiated with the PC; An identification module, used for identifying the file size of the program to be burned from the file information based on the protocol format; A reservation module, used to reserve storage space corresponding to the file size in a preset Flash area; The program receiving module is used to receive the program to be burned in the protocol format sent by the PC end, and burn the program to be burned into the storage area.
8. A data burning device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data burning method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data burning method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the data burning method according to any one of claims 1 to 6 are implemented.
