TFTP-based DSP application dynamic updating method with rollback operation

By adopting TFTP-based dynamic update method and rollback technology in the DSP system, the problem of unboxing operations and update failures in the process of updating existing DSP systems is solved, and more efficient and reliable application updates are achieved.

CN119883336APending Publication Date: 2025-04-25WUHAN SHIP COMM RES INST (NO 722 RES INST OF CHINA STATE SHIPBUILDING CORP)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411837052.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

Existing DSP systems require on-site unboxing operations when the application is updated, and cannot be rolled back when the update fails, resulting in system failure and untraceable, increasing equipment maintenance costs and failure rates.

Method used

The dynamic update method of DSP application based on TFTP is adopted, and dynamic loading and update are realized by writing the "BootLoad" program and the "FLASH dynamic update program", and the identification is recorded in the EEPROM to select the update storage location, which supports rollback operation.

Benefits of technology

This avoids complex unboxing mechanical operations when upgrading equipment applications, improves work efficiency, reduces the risk of equipment damage, and ensures that the system can return to the working state before the update if the update fails.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883336A_ABST
    Figure CN119883336A_ABST
Patent Text Reader

Abstract

The invention provides a TFTP-based DSP application dynamic updating method with a rollback operation. The method comprises the steps that a BootLoad program is written, a system is initialized, and analysis and loading of an application program are completed; writing a "FLASH dynamic update program": obtaining program data to be updated and performing FLASH update; loading and starting of a FLASH dynamic updating program are completed in the application program; by solidifying codes of a BootLoad program and a FLASH dynamic updating program, early-stage preparation work is completed, and a dynamic loading stage is entered; and after the dynamic loading stage is completed, obtaining the data of the program to be loaded, entering an application updating stage, and programming the obtained data of the program to be loaded into the FLASH. The special update failure rollback technology ensures that the DSP system does not crash when the update fails due to sudden reasons such as power failure or bad block storage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of embedded technology, and in particular relates to a DSP application dynamic update method with a rollback operation based on TFTP. Background Art

[0002] DSP processor is the main control chip commonly used in digital signal processing. Its unique multiplication and addition logic unit and pipeline technology can efficiently implement digital signal processing algorithms. The C66x series DSP chips produced by TI have the characteristics of high main frequency, strong computing power and rich interface resources, and are widely used in the industry.

[0003] In the DSP hardware system, program code solidification and embedded self-startup are key technologies. The mainstream design scheme in the industry uses the FLASH startup method. Directly connect the off-chip FLASH through the DSP's local bus or low-speed serial interface (such as SPI, I2C, etc.), and configure the DSP in FLASH startup mode. The application code of the embedded system device will be solidified into the FLASH. When the system is powered on, the DSP will directly address the FLASH and run the application. However, when the product is upgraded and the application in the FLASH needs to be updated, the maintenance personnel have to unpack the equipment on site, connect the emulator through the board card, and update the application in the FLASH. At the same time, during the update process, once an update image error occurs or the system fails and the power is lost, resulting in a failure of the update, the previous image will also be lost, causing the system to be paralyzed and untraceable. Such an application code update will inevitably lead to high equipment maintenance costs, long cycles and high failure rates.

[0004] Therefore, how to provide a DSP application dynamic update method with a rollback operation based on TFTP has become a technical problem that needs to be solved urgently in the art. Summary of the invention

[0005] The purpose of the present invention is to provide a DSP application dynamic update method with rollback operation based on TFTP.

[0006] According to the present invention, a DSP application dynamic update method with rollback operation based on TFTP is provided, comprising:

[0007] Step S1, write the "BootLoad" program of DSP: initialize the DSP system and complete the analysis and loading of the application program;

[0008] Step S2, write "FLASH dynamic update program": obtain the program data to be updated and perform FLASH update;

[0009] Step S3, complete the loading and starting of the "FLASH dynamic update program" in the application;

[0010] Step S4, complete the preliminary preparation work by solidifying the "BootLoad" program and the "FLASH dynamic update program" code; when the preliminary preparation work is completed, enter the "dynamic loading" stage; after the "dynamic loading" stage is completed, obtain the program data to be loaded, enter the "application update" stage, and burn the obtained program data to be loaded into FLASH.

[0011] Optionally, in step S1, the system for initializing the DSP includes: a core clock of the DSP, an off-chip DDR3, and a debugging serial port.

[0012] Optionally, in step S1, parsing and loading the application program includes:

[0013] By determining the parity of the identifier recorded in the EEPROM, it is selected whether to parse and load the application code in the PING buffer or the PONG buffer;

[0014] The code is moved from FLASH to memory by parsing the source address, destination address and length of each segment of data.

[0015] Optionally, in step S2, obtaining the program data to be updated includes:

[0016] The data of the program to be updated is mainly obtained through the network port; before the program runs, a TFTP server task is started on the PC side, and the program data to be updated is placed in the directory open to the server, waiting for the TFTP client to connect; at the beginning of the program running, the code will initialize the DSP network port, start the standard TCP / IP protocol stack, establish a TFTP client thread, connect to the TFTP server on the PC side, and then obtain the program data to be updated and the length of the program data to be updated, and store them in DDR3.

[0017] Optionally, in step S2, performing FLASH update includes:

[0018] In FLASH, the application storage space is planned as two blocks, named PING storage space and PONG storage space, which are used to store different application programs. The specific storage location of the application program needs to be determined by the identifier in the EEPROM. The principle of the determination uses the parity judgment method: before updating FLASH, read the identifier. If it is an even number, write the code data in the PING storage space; if it is an odd number, write the code data in the PONG space; then read back the written code data and perform a CRC check. When the CRC check passes, it means that the application update is successful, and the identifier in the EEPROM needs to be increased by 1. Otherwise, the update fails and the PC needs to be notified through the debug serial port.

[0019] Optionally, in step S2, it also includes:

[0020] To ensure that the system does not lose power, after the update is completed, the DSP PC pointer is jumped to the FLASH base address to run the "BootLoad" program to restart the DSP and load the updated application.

[0021] Optionally, in step S2, it also includes:

[0022] If the update fails, the DSP PC pointer will also jump to the FLASH base address. Since the identifier in the EEPROM is not updated, it still corresponds to the FLASH application storage space before the update. Therefore, the original application code is rolled back to the DSP memory and restored to the working state before the update.

[0023] Optionally, in step S3, in order to meet the real-time nature of application updates, it is necessary to establish a TCP server thread in the application to wait for the update command sent by the PC; and the PC side establishes a TCP client through some general network software and sends a specified TCP data packet to inform the DSP to start updating the application.

[0024] Optionally, in step S3, the loading start includes:

[0025] Once DSP receives the command, it closes all ports and releases all resources; then, it reads the code data of the "FLASH dynamic update program" from FLASH according to the predefined address and starts parsing; according to the format of loaded data, it obtains the program entry address, the memory storage address and the segment length of each segment, and then completes the data movement from FLASH to the memory based on the program entry address, the memory storage address and the segment length; when all the code movement is completed, the PC pointer is operated to jump to the parsed program entry address.

[0026] Optionally, in step S4, the "dynamic loading" stage includes:

[0027] After the DSP is powered on, the DSP will start the "BootLoad" program, select the application in the PING storage space or the application in the PONG storage space to load and start; at this time, the DSP has reached the normal working state before the dynamic application update: the DSP has been powered on and the application has been running; in all applications, a TCP server task should be established to wait for the dynamic update request from the PC. Once the request is received, the DSP will read and parse the "FLASH dynamic update program" code, and then move the code data from FLASH to the memory according to the parsed segment address and segment length, and finally start the "FLASH dynamic update program" code by controlling the PC pointer; once the "FLASH dynamic update program" code is running, the DSP will start a TFTP client task to connect to the TFTP server on the PC side to obtain the data to be updated.

[0028] The beneficial effects brought by the present invention are as follows:

[0029] It can be seen from the above scheme that the embodiment of the present invention provides a DSP application dynamic update method with rollback operation based on TFTP, which has the following beneficial effects: it is proposed to avoid complicated and tedious unpacking mechanical operations when upgrading device applications, improve work efficiency, and reduce the risk of equipment damage caused by mechanical operations; at the same time, its unique update failure rollback technology ensures that when the update fails due to sudden reasons such as power failure or storage bad blocks, the DSP will not crash, but return to the working state before the update and perform the update operation again. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 A schematic diagram of a DSP application dynamic update method with a rollback operation based on TFTP is provided according to an embodiment. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all 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.

[0032] This embodiment uses the network port as the data interaction interface, uses the TFTP protocol to load application data, and uses a dynamic update rollback method to avoid system crashes caused by update failures. Specifically:

[0033] First, we focus on the convenience of DSP system equipment application upgrade. The designed system selects TI's KeyStone series DSP - TMS320C6672. The DSP has a standard network interface and can use the standard TCP / IP network protocol stack under the embedded operating system. This embodiment uses the TFTP protocol in the protocol stack to achieve data interaction between the device and the PC. Unlike in the past, Ethernet communication can be used to use the general network interface RJ45 for data transmission, and there is no need to mechanically open the chassis and use the board-connected simulator to update the code. This greatly reduces the time and difficulty of equipment upgrades.

[0034] Secondly, pay attention to the efficiency of DSP system equipment application upgrade. The network data transmission bandwidth of TFTP protocol is much larger than the transmission bandwidth of traditional asynchronous serial and IEEE1149.1 JTAG port. Through the TFTP client and server, the application code files to be updated stored on the PC can be quickly transferred to the DSP memory through TFTP protocol; at the same time, the system controls the program running entry by operating the PC pointer of DSP according to the command received from the PC, so as to update the program code without power failure, avoid the re-power-on initialization of other devices due to the update of DSP system application, and greatly improve the efficiency of system update.

[0035] Again, pay attention to the reliability of DSP system equipment application upgrades. When updating FLASH data, an application update rollback operation is designed. In FLASH, a pair of ping-pong caches are designed to select the cache location where the FLASH update data is stored by recording the identifier in the EEPROM. The identifier in the EEPROM ensures that the data written to FLASH each time does not repeat the previous location, thereby ensuring that after the application update is completed, the application before the update is still stored in the FLASH. If the update data verification fails, the program in the DSP's RAM can be easily rolled back to the state before the update, thereby ensuring the normal operation of the system. In this way, the consistency of each application update data can be ensured, and the application update can be guaranteed to be stable and reliable.

[0036] According to the present invention, the DSP system hardware minimum system required by this embodiment. The system includes DDR3 for program running, FLASH for code solidification, and EEPROM for boot information recording; as well as an Ethernet interface and a debug serial port that need to be connected to a PC. At the same time, the DSP boot mode is configured to be FLASH boot through hardware control. After the hardware is ready, Figure 1 As shown, a DSP application dynamic update method with a rollback operation based on TFTP is provided, comprising:

[0037] Step S1, write the "BootLoad" program of DSP: initialize the DSP system and complete the analysis and loading of the application program;

[0038] Step S2, write "FLASH dynamic update program": obtain the program data to be updated and perform FLASH update;

[0039] Step S3, complete the loading and starting of the "FLASH dynamic update program" in the application;

[0040] Step S4, complete the preliminary preparation work by solidifying the "BootLoad" program and the "FLASH dynamic update program" code; when the preliminary preparation work is completed, enter the "dynamic loading" stage; after the "dynamic loading" stage is completed, obtain the program data to be loaded, enter the "application update" stage, and burn the obtained program data to be loaded into FLASH.

[0041] In some embodiments, after the DSP is powered on, according to the DSP hardware startup configuration, the on-chip BOOTROM will control the DSP program pointer (PC pointer) to start running from the base address of FLASH, and a section of code designed at the beginning of BootLoad will move the main part of the BootLoad code to the DSP's memory for execution.

[0042] In some embodiments, in step S1, the system for initializing the DSP includes: a core clock of the DSP, an off-chip DDR3, and a debugging serial port.

[0043] The parsing and loading of the application includes:

[0044] In some embodiments, by determining the parity of the identifier recorded in the EEPROM, it is selected whether to parse and load the application code in the PING buffer or the PONG buffer;

[0045] The code is moved from FLASH to memory by parsing the source address, destination address and length of each segment of data.

[0046] In some embodiments, in step S2, obtaining the program data to be updated includes:

[0047] The data of the program to be updated is mainly obtained through the network port; before the program runs, a TFTP server task is started on the PC side, and the program data to be updated is placed in the directory open to the server, waiting for the TFTP client to connect; at the beginning of the program running, the code will initialize the DSP network port, start the standard TCP / IP protocol stack, establish a TFTP client thread, connect to the TFTP server on the PC side, and then obtain the program data to be updated and the length of the program data to be updated, and store them in DDR3.

[0048] In some embodiments, in step S2, performing FLASH update includes:

[0049] In FLASH, the application storage space is planned as two blocks, named PING storage space and PONG storage space, which are used to store different application programs. The specific storage location of the application program needs to be determined by the identifier in the EEPROM. The principle of the determination uses the parity judgment method: before updating FLASH, read the identifier. If it is an even number, write the code data in the PING storage space; if it is an odd number, write the code data in the PONG space; then read back the written code data and perform a CRC check. When the CRC check passes, it means that the application update is successful, and the identifier in the EEPROM needs to be increased by 1. Otherwise, the update fails and the PC needs to be notified through the debug serial port.

[0050] To ensure that the system does not lose power, after the update is completed, the DSP PC pointer is jumped to the FLASH base address to run the "BootLoad" program to restart the DSP and load the updated application.

[0051] If the update fails, the DSP PC pointer will also jump to the FLASH base address. Since the identifier in the EEPROM is not updated, it still corresponds to the FLASH application storage space before the update. Therefore, the original application code is rolled back to the DSP memory and restored to the working state before the update.

[0052] In some embodiments, in order to meet the real-time nature of application updates, a TCP server thread needs to be established in the application to wait for the update command sent by the PC; the PC side establishes a TCP client through some general network software and sends a specified TCP data packet to inform the DSP to start updating the application.

[0053] The loading start includes:

[0054] Once DSP receives the command, it closes all ports and releases all resources; then, it reads the code data of the "FLASH dynamic update program" from FLASH according to the predefined address and starts parsing; according to the format of loaded data, it obtains the program entry address, the memory storage address and the segment length of each segment, and then completes the data movement from FLASH to the memory based on the program entry address, the memory storage address and the segment length; when all the code movement is completed, the PC pointer is operated to jump to the parsed program entry address.

[0055] In some embodiments, in step S4, the "dynamic loading" stage includes:

[0056] After the DSP is powered on, the DSP will start the "BootLoad" program, select the application in the PING storage space or the application in the PONG storage space to load and start; at this time, the DSP has reached the normal working state before the dynamic application update: the DSP has been powered on and the application has been running; in all applications, a TCP server task should be established to wait for the dynamic update request from the PC. Once the request is received, the DSP will read and parse the "FLASH dynamic update program" code, and then move the code data from FLASH to the memory according to the parsed segment address and segment length, and finally start the "FLASH dynamic update program" code by controlling the PC pointer; once the "FLASH dynamic update program" code is running, the DSP will start a TFTP client task to connect to the TFTP server on the PC side to obtain the data to be updated.

[0057] The "application update" phase mainly involves burning the acquired data to be loaded into FLASH. In order to meet the requirement of rolling back the original application code when the update fails, the invention plans a backup application storage space in FLASH, that is, sets up a PING cache and a PONG cache, and uses the identifier recorded in the EEPROM to ensure that the cache space burned into the FLASH this time is different from the cache space burned last time. In this way, when the current update fails, since the identifier in the EEPROM is not updated, the previous application program can be loaded to realize the application rollback function.

[0058] In some embodiments, storage space allocation and address setting. According to the above description, the storage space involved in the dynamic update process includes FLASH, EEPROM and memory, and the memory is divided into on-chip storage (L2) and off-chip storage (DDR3). In order to ensure the normal operation of the update process, the invention allocates and plans the storage space. In FLASH, the base address starts to store BootLoad, and this program will be loaded into the DSP on-chip storage space L2 after the device is powered on; and the "FLASH dynamic update program" will start loading at the base address of DDR3; and the application will be loaded in DDR3 immediately after the "FLASH dynamic update program" space. The purpose of this arrangement is to prevent the program segments from overwriting each other during the dynamic loading process, thereby causing loading failure. In EEPROM, 8 bytes are used to store the identification mark of the application update cache space selection, and then the starting addresses of the PING storage space and the PONG storage space in FLASH are stored, namely 0x70200000 and 0x70C00000.

[0059] In summary, this embodiment proposes a method that can avoid complicated and tedious unpacking mechanical operations when upgrading device applications, improve work efficiency, and reduce the risk of equipment damage caused by mechanical operations; at the same time, its unique update failure rollback technology ensures that when the update fails due to sudden reasons such as power failure or storage bad blocks, the DSP will not crash the system, but return to the working state before the update and perform the update operation again.

[0060] The above are preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.

Claims

1. A DSP application dynamic update method with rollback operation based on TFTP, characterized in that: include: Step S1, write the "BootLoad" program of DSP: initialize the DSP system and complete the analysis and loading of the application program; Step S2, write "FLASH dynamic update program": obtain the program data to be updated and perform FLASH update; Step S3, complete the loading and starting of the "FLASH dynamic update program" in the application; Step S4, complete the preliminary preparation work by solidifying the "BootLoad" program and the "FLASH dynamic update program" code; when the preliminary preparation work is completed, enter the "dynamic loading" stage; after the "dynamic loading" stage is completed, obtain the program data to be loaded, enter the "application update" stage, and burn the obtained program data to be loaded into FLASH.

2. The DSP application dynamic update method with rollback operation based on TFTP according to claim 1 is characterized in that: In the step S1, the system for initializing the DSP includes: the core clock of the DSP, the off-chip DDR3 and the debugging serial port.

3. The DSP application dynamic update method with rollback operation based on TFTP according to claim 1 is characterized in that: In step S1, the parsing and loading of the application program includes: By determining the parity of the identifier recorded in the EEPROM, it is selected whether to parse and load the application code in the PING buffer or the PONG buffer; The code is moved from FLASH to memory by parsing the source address, destination address and length of each segment of data.

4. The DSP application dynamic update method with rollback operation based on TFTP according to claim 1 is characterized in that: In step S2, obtaining the program data to be updated includes: The data of the program to be updated is obtained through the network port; before the program runs, a TFTP server task is started on the PC side, and the program data to be updated is placed in the directory open to the server, waiting for the TFTP client to connect; at the beginning of the program running, the code will initialize the DSP network port, start the standard TCP / IP protocol stack, establish a TFTP client thread, connect to the TFTP server on the PC side, and then obtain the program data to be updated and the length of the program data to be updated, and store them in DDR3.

5. The DSP application dynamic update method with rollback operation based on TFTP according to claim 1 is characterized in that: In step S2, the FLASH update includes: In FLASH, the application storage space is planned into two blocks, named PING storage space and PONG storage space, which are used to store different application programs; the storage location of the application program needs to be determined through the identifier in the EEPROM; the principle of the determination uses the parity judgment method: before updating FLASH, read the identifier, if it is an even number, write the code data in the PING storage space; if it is an odd number, write the code data in the PONG space; then read back the written code data and perform CRC verification; when the CRC verification passes, it means that the application update is successful, and the identifier in the EEPROM needs to be increased by 1; otherwise, the update fails, and the PC needs to be notified through the debugging serial port.

6. The DSP application dynamic update method with rollback operation based on TFTP according to claim 5 is characterized in that: In the step S2, it also includes: After the update is completed, the "BootLoad" program is run by jumping the DSP's PC pointer to the FLASH base address to restart the DSP and load the updated application.

7. The DSP application dynamic update method with rollback operation based on TFTP according to claim 6 is characterized in that: In the step S2, it also includes: If the update fails, the DSP PC pointer will also jump to the FLASH base address. Since the identifier in the EEPROM is not updated, it still corresponds to the FLASH application storage space before the update. Therefore, the original application code is rolled back to the DSP memory and restored to the working state before the update.

8. The DSP application dynamic update method with rollback operation based on TFTP according to claim 1 is characterized in that: In step S3, in order to meet the real-time nature of application updates, a TCP server thread needs to be established in the application to wait for the update command sent by the PC; and the PC side establishes a TCP client through some general network software and sends a specified TCP data packet to inform the DSP to start updating the application.

9. The DSP application dynamic update method with rollback operation based on TFTP according to claim 8, characterized in that: In step S3, the loading start includes: Once DSP receives the command, it closes all ports and releases all resources; then, it reads the code data of the "FLASH dynamic update program" from FLASH according to the predefined address and starts parsing; according to the format of loaded data, it obtains the program entry address, the memory storage address and the segment length of each segment, and then completes the data migration from FLASH to the memory based on the program entry address, the memory storage address and the segment length; when all the code migration is completed, the PC pointer is operated to jump to the parsed program entry address.

10. The DSP application dynamic update method with rollback operation based on TFTP according to claim 1, characterized in that: In step S4, the "dynamic loading" stage includes: After the DSP is powered on, the DSP will start the "BootLoad" program, select the application in the PING storage space or the application in the PONG storage space to load and start; at this time, the DSP has reached the normal working state before the dynamic application update: the DSP has been powered on and the application has been running; in all applications, FLASH establishes a TCP server task to wait for the dynamic update request from the PC. Once the request is received, the DSP will read and parse the "FLASH dynamic update program" code, and then move the code data from FLASH to the memory according to the parsed segment address and segment length, and finally start the "FLASH dynamic update program" code by controlling the PC pointer; once the "FLASH dynamic update program" code is running, the DSP will start a TFTP client task to connect to the TFTP server on the PC side to obtain the data to be updated.