A DSP software online upgrade system based on dual FLASH program space
By using the online upgrade system with dual FLASH program space in the DSP processor, and using Bootloader to switch between dual FLASH spaces, the problems of low efficiency and high risk of upgrading existing DSP software are solved, and efficient and reliable software upgrades and fallbacks are achieved.
Patent Information
- Application Number
- CN202111397291.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-23
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2041-11-23
AI Technical Summary
The existing DSP software upgrade method is inefficient and has high risk. Traditional JTAG interface writing requires the product to be disassembled, and if there are errors in the online upgrade method or software problems, it is difficult to reverse.
The DSP software online upgrade system based on dual FLASH program space is adopted, and the dual FLASH space is switched through the Bootloader program, and the writing area is selected to achieve safe upgrade and fallback of the software.
It improves the upgrade efficiency and reliability of DSP software, does not need to disassemble the product and expose the circuit board, and if there is a problem during the writing process, the Bootloader can fall back to the previous version of the software to ensure product communication capabilities.
Smart Images

Figure CN114115956B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a DSP software online upgrade system based on dual FLASH program space. Background Art
[0002] As a high-speed signal processing device, DSP is widely used. With the intensification of market competition, the speed of product replacement has accelerated, and user needs have changed frequently. Developers need to complete product iterations as soon as possible to keep up with market changes. Therefore, the frequency of DSP software upgrades is becoming more and more frequent. The traditional method for DSP software upgrade is to connect the emulator through the JTAG interface on the circuit board, and load the application to be updated into the DSP through the CCS software to complete the program upgrade. The disadvantage of this method is that the product needs to be opened to expose the JTAG interface, and the DSP software needs to be upgraded one by one, which is inefficient. The general method of online software upgrade is to send the software data packet to be updated to the DSP application through the host computer, and the application will perform the burning. However, if there is an error in the burning process, or the software to be updated is a problematic version, it is necessary to return to the traditional burning method of connecting the emulator to the JTAG interface, which is a high-risk method. Summary of the invention
[0003] In view of this, the present application provides a DSP software online upgrade system based on dual FLASH program space, which solves the problems in the prior art and improves the reliability of DSP software.
[0004] The present application provides a DSP software online upgrade system based on dual FLASH program space, which adopts the following technical solutions:
[0005] A DSP software online upgrade system based on dual FLASH program space, comprising a DSP processor, a FLASH memory and a host computer, wherein the DSP processor communicates with the host computer, the DSP processor is externally connected to the FLASH, and the FLASH comprises a FLASH start area, a PING / PONG flag area, a software status flag area, an application cache PING area and an application cache PONG area;
[0006] The FLASH start area stores the Bootloader image;
[0007] The PING / PONG flag area is used to indicate the application start address;
[0008] The software status flag area is used to store software status information;
[0009] The application cache PING area and the application cache PONG area store applications;
[0010] The DSP processor runs the Bootloader program and the application program;
[0011] The host computer stores the software to be upgraded;
[0012] Among them, the host computer sends the software data packet to be upgraded to the application of the DSP processor and issues a burning instruction. After the application of the DSP processor receives the software data packet to be upgraded and the software upgrade instruction sent by the host computer, it selects the area to be burned according to the software status recorded in the FLASH, completes the burning and upgrades the software status in the FLASH.
[0013] Optionally, the DSP processor communicates with the host computer via a serial port or Ethernet, and the DSP processor is externally connected to the FLASH via an SPI or EMIFA bus.
[0014] Optionally, the operation of the system includes the following steps:
[0015] After the DSP processor is powered on, the Bootloader program starts first, initializes PLL, DDR, EMIFA and SPI, obtains the status of the application software stored in FLASH, and selects the application to be started. The status of the application includes NULL, FLASE and TRUE;
[0016] After the application is started, the serial port / Ethernet and peripherals are initialized to establish a communication link with the host computer;
[0017] After the host computer is started, the upgrade software control program is started, and the user selects the software data package to be upgraded and the DSP processor, and after establishing a communication link with the DSP processor, the software data package to be upgraded is sent to the DSP processor;
[0018] The application receives the software data packet to be upgraded sent by the host computer and feeds back to the host computer whether the received software data packet to be upgraded is complete;
[0019] When the host computer receives the complete instruction of the software data packet to be upgraded from the DSP processor, it sends the software burning instruction to the DSP processor;
[0020] After receiving the software burning instruction, the application program of the DSP processor selects the burning area according to the application software status stored in the FLASH, completes the burning and upgrades the application software status;
[0021] The host computer receives the burning status instruction sent by the DSP processor, displays the burning result and prompts the user to shut down and restart.
[0022] Optionally, the step in which the application receives the software to be upgraded sent by the host computer and feeds back to the host computer whether the data packet of the received application is complete includes: if the data packet of the software to be upgraded is complete, sending a data packet complete instruction to the host computer; if the data packet of the application is incomplete, sending a retransmission instruction to the host computer.
[0023] Optionally, the Bootloader software performs the following steps:
[0024] S11, complete PLL, DDR, EMIFA and SPI initialization;
[0025] S12, read the area where the application is located from the FLASH, and read the status of the application in the FLASH;
[0026] S13, if the application is stored in the application cache PING area and its status is TRUE, then move the application in the application cache PING area to the DSP memory and start the program, otherwise move the application in the application cache PONG area to the DSP memory and start the program. If the application is stored in the application cache PONG area and its status is TRUE, then move the application in the application cache PONG area to the DSP memory and start the program, otherwise move the application in the application cache PING area to the DSP memory and start the program.
[0027] Optionally, the application performs the following steps:
[0028] S21, read the area where the application is located from the FLASH, and read the status of the application in the FLASH;
[0029] S22, if the application status is NULL, write the application status space in FLASH to FALSE;
[0030] S23, complete TIMER, UART, and Internet initialization;
[0031] S24, enter the while(1) loop and continue to receive data and instructions sent by the host computer;
[0032] S25, after determining that the program runs successfully, the application status in FLASH is written as TRUE.
[0033] Optionally, in S25, the method for determining whether the program is running successfully is that the timer times the program to run for more than 1 minute.
[0034] Optionally, the application performs the following steps when upgrading the DSP software:
[0035] S26, if the upgrade software data packet sent by the host computer is received, the software data packet to be upgraded is cached in the DDR; S26 is continuously executed until the cache of the software data packet to be upgraded is completed, and then the process jumps to S27;
[0036] S27, after completely receiving the software data packet to be upgraded, setting a complete flag of the software data packet to be upgraded;
[0037] S28, if the software upgrade instruction sent by the host computer is received, if the complete flag of the software data packet to be upgraded is set, the upgrade software is started and the process goes to S29, otherwise the data packet reception failure is fed back to the host computer and a retransmission request is made; jump to S26 and the software data packet to be upgraded is received again;
[0038] S29, if the area where the program is located is PING: if the application status is TRUE, then write the data of the software to be upgraded to the FLASH in the PONG area; otherwise, write the data of the software to be upgraded to the FLASH in the PING area, if the area where the program is located is PONG: if the application status is TRUE, then write the data of the software to be upgraded to the FLASH in the PING area; otherwise, write the data of the software to be upgraded to the FLASH in the PONG area;
[0039] S210, read the data of the application to be upgraded in FLASH, and compare it with the cached application data one by one. If it passes, execute S211, otherwise send a programming failure instruction to the host computer and jump to S214;
[0040] S211, upgrading the area where the program is located in the FLASH according to the actual burning area;
[0041] S212, write the application state space in FLASH to NULL;
[0042] S213, sending a successful burning instruction to the upper computer;
[0043] S214, exit the application.
[0044] Optionally, in S27, the step of completely receiving the upgrade software data packet includes verifying the received software data packet to be upgraded. If the verification passes, the complete flag of the software data packet to be upgraded is set, and a complete instruction of the software data packet to be upgraded is fed back to the host computer. Otherwise, the reception failure of the software data packet to be upgraded is fed back to the host computer, and a retransmission request is requested. S26 is repeated until the upgrade software data packet is verified successfully.
[0045] Optionally, the upgrade software control program running on the host computer needs to perform the following steps:
[0046] S31, after the software upgrade control program is started, the user selects the software to be upgraded;
[0047] S32, establishing a communication link with the application;
[0048] S33, sending a software data packet to be upgraded to the application;
[0049] S34, receiving a complete instruction of the software data package to be upgraded, and then sending an instruction to upgrade the software;
[0050] S35, receiving a retransmission instruction sent by the application, and then repeating S33;
[0051] S36, receiving the burning status instruction sent by the application, displaying the burning result and prompting the user to shut down and restart.
[0052] To summarize, the present application includes the following beneficial technical effects: compared with the traditional JTAG interface burning, the advantage is high efficiency, no need to disassemble the product to expose the circuit board, and avoid secondary damage; compared with the general online upgrade method, the advantage is good reliability. If the burned software version cannot run normally, or there is an abnormal situation such as power failure during the burning process, the bootloader can roll back to the previous version of the software to ensure that the product can maintain communication and has high reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0054] Figure 1 The composition and connection relationship of the system in this application;
[0055] Figure 2 The storage space in FLASH of this application is divided;
[0056] Figure 3 This is the flowchart of the Bootloader software for this application;
[0057] Figure 4 This is a flowchart related to software upgrades in this application;
[0058] Figure 5 This is the flow chart of the upper computer software upgrade control program for this application. DETAILED DESCRIPTION
[0059] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0060] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that, in the absence of conflict, the following embodiments and the features in the embodiments can be combined with each other. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.
[0061] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein can be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present application, it should be understood by those skilled in the art that an aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects described herein can be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein can be used to implement this device and / or practice this method.
[0062] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application. The drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0063] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0064] The embodiment of the present application provides a system for online upgrading of DSP software based on dual FLASH program space.
[0065] like Figure 1 and Figure 2As shown, a system for online upgrading of DSP software based on dual FLASH program space includes a DSP processor, a FLASH memory and a host computer. The DSP processor communicates with the host computer. The DSP processor is externally connected to FLASH, and is characterized in that the FLASH includes a FLASH start area, a PING / PONG flag area, a software status flag area, an application cache PING area and an application cache PONG area.
[0066] The FLASH start area stores the Bootloader image.
[0067] The PING / PONG mark area is used to indicate the starting address of the application program.
[0068] The software status flag area is used to store software status information.
[0069] The application cache PING area and the application cache PONG area store application
[0070] The DSP processor runs the Bootloader program and the application program.
[0071] The host computer stores the software to be upgraded.
[0072] Among them, the host computer sends the software data packet to be upgraded to the application of the DSP processor and issues a burning instruction. After the application of the DSP processor receives the software data packet to be upgraded and the software upgrade instruction sent by the host computer, it selects the area to be burned according to the software status recorded in the FLASH, completes the burning and upgrades the software status in the FLASH.
[0073] The DSP processor communicates with the host computer via a serial port or Ethernet, and the DSP processor is externally connected to the FLASH via an SPI or EMIFA bus. SPI is short for Serial Peripheral Interface; EMIFA is short for External Memory Interface.
[0074] The operation of the system includes the following steps:
[0075] After the DSP processor is powered on, the Bootloader program starts first, initializes PLL, DDR, EMIFA and SPI, obtains the status of the application software stored in FLASH, and selects the application to be started. The status of the application includes NULL (empty), FALSE (failure) and TRUE (success).
[0076] After the application is started, the serial port / Ethernet and peripherals are initialized to establish a communication link with the host computer.
[0077] After the host computer is started, the upgrade software control program is started. The user selects the software data package to be upgraded and the DSP processor. After establishing a communication link with the DSP processor, the software data package to be upgraded is sent to the DSP processor.
[0078] The application receives the software data packet to be upgraded sent by the host computer and feeds back to the host computer whether the received software data packet to be upgraded is complete.
[0079] When the host computer receives the complete instruction of the software data packet to be upgraded from the DSP processor, it sends a software burning instruction to the DSP processor.
[0080] After receiving the software burning instruction, the application program of the DSP processor selects the burning area according to the application software status stored in the FLASH, completes the burning and upgrades the application software status.
[0081] The host computer receives the burning status instruction sent by the DSP processor, displays the burning result and prompts the user to shut down and restart.
[0082] The step of the application receiving the software to be upgraded sent by the host computer and feeding back to the host computer whether the data packet of the application is complete includes: if the data packet of the software to be upgraded is complete, sending a data packet complete instruction to the host computer; if the data packet of the application is incomplete, sending a retransmission instruction to the host computer.
[0083] like Figure 3 As shown, the Bootloader software performs the following steps:
[0084] S11, complete the initialization of PLL, DDR, EMIFA and SPI. PLL is the abbreviation of Phase Locked Loop.
[0085] S12, reading the area where the application is located from the FLASH, and reading the status of the application in the FLASH.
[0086] S13, if the application is stored in the application cache PING area and its status is TRUE, then move the application in the application cache PING area to the DSP memory and start the program, otherwise move the application in the application cache PONG area to the DSP memory and start the program. If the application is stored in the application cache PONG area and its status is TRUE, then move the application in the application cache PONG area to the DSP memory and start the program, otherwise move the application in the application cache PING area to the DSP memory and start the program.
[0087] like Figure 4 As shown, the application performs the following steps:
[0088] S21, reading the area where the application is located from the FLASH, and reading the status of the application in the FLASH.
[0089] S22, if the application status is NULL, write the application status space in FLASH to FALSE.
[0090] S23, complete the initialization of TIMER, UART, and Internet. UART stands for Universal Asynchronous Receiver / Transmitter.
[0091] S24, enter the while(1) loop and continue to receive data and instructions sent by the host computer.
[0092] S25, after judging that the program runs successfully, the application status in FLASH is written as TRUE. The method for judging that the program runs successfully is that the timer counts the program running for more than 1 minute.
[0093] When upgrading the DSP software the application performs the following steps:
[0094] S26, if the upgrade software data packet sent by the host computer is received, the software data packet to be upgraded is cached in the DDR; S26 is continuously executed until the cache of the software data packet to be upgraded is completed, and then the process jumps to S27.
[0095] S27, after completely receiving the software data packet to be upgraded, the complete flag of the software data packet to be upgraded is set. The step of completely receiving the software data packet to be upgraded includes verifying the received software data packet to be upgraded, if the verification is passed, the complete flag of the software data packet to be upgraded is set, and a complete instruction of the software data packet to be upgraded is fed back to the host computer, otherwise, the software data packet to be upgraded is received unsuccessfully, and a retransmission request is requested, and S26 is repeated until the verification of the software data packet to be upgraded is successful.
[0096] S28, if the software upgrade instruction sent by the host computer is received, if the complete flag of the software data packet to be upgraded is set, the upgrade software is started and enters S29, otherwise the data packet reception failure is fed back to the host computer and a retransmission is requested; jump to S26 and receive the software data packet to be upgraded again.
[0097] S29, if the area where the program is located is PING: if the application status is TRUE, the data of the software to be upgraded is written to the FLASH in the PONG area; otherwise, the data of the software to be upgraded is written to the FLASH in the PING area, if the area where the program is located is PONG: if the application status is TRUE, the data of the software to be upgraded is written to the FALSH in the PING area; otherwise, the data of the software to be upgraded is written to the PONG area.
[0098] S210, read the data of the application to be upgraded in FLASH, and compare it with the cached application data one by one. If it passes, execute S211, otherwise send a burning failure instruction to the host computer and jump to S214.
[0099] S211, upgrading the area where the program is located in the FLASH according to the actual burning area.
[0100] S212, write the application state space in FLASH to NULL.
[0101] S213, sending a successful burning instruction to the host computer.
[0102] S214, exit the application.
[0103] like Figure 5 As shown, the upgrade software control program running on the host computer needs to perform the following steps:
[0104] S31, after the software upgrade control program is started, the user selects the software to be upgraded.
[0105] S32, establishing a communication link with the application.
[0106] S33, sending a software data packet to be upgraded to the application.
[0107] S34, receiving a complete instruction of the software data package to be upgraded, and then sending an instruction to upgrade the software.
[0108] S35, receiving a retransmission instruction sent by the application, and repeating S33.
[0109] S36, receiving the burning status instruction sent by the application, displaying the burning result and prompting the user to shut down and restart.
[0110] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A DSP software online upgrade system based on dual FLASH program space, comprising a DSP processor, a FLASH memory and a host computer, wherein the DSP processor communicates with the host computer and the DSP processor is externally connected to the FLASH, characterized in that: The FLASH includes a FLASH start area, a PING / PONG flag area, a software status flag area, an application cache PING area and an application cache PONG area; The FLASH start area stores the Bootloader image; The PING / PONG flag area is used to indicate the application startup start address; The software status flag area is used to store software status information; The application cache PING area and the application cache PONG area store applications; The DSP processor runs the Bootloader program and the application program; The host computer stores the software to be upgraded; The host computer sends the software data packet to be upgraded to the application of the DSP processor and issues a burning instruction. After receiving the software data packet to be upgraded and the software upgrade instruction sent by the host computer, the application of the DSP processor selects the burning area according to the software status recorded in the FLASH, completes the burning and upgrades the software status in the FLASH; The application performs the following steps: S21, read the area where the application is located from the FLASH, and read the status of the application in the FLASH; S22, if the application status is NULL, write the application status space in FLASH to FALSE; S23, complete TIMER, UART, and Internet initialization; S24, enter the while(1) loop and continue to receive data and instructions sent by the host computer; S25, after judging that the program runs successfully, the application status in FLASH is written as TRUE; When upgrading the DSP software the application performs the following steps: S26, if the upgrade software data packet sent by the host computer is received, the software data packet to be upgraded is cached in the DDR; S26 is continuously executed until the cache of the software data packet to be upgraded is completed, and then the process jumps to S27; S27, after completely receiving the software data packet to be upgraded, setting a complete flag of the software data packet to be upgraded; S28, if the software upgrade instruction sent by the host computer is received, if the complete flag of the software data packet to be upgraded is set, the upgrade software is started and the process goes to S29, otherwise the data packet reception failure is fed back to the host computer and a retransmission request is made; jump to S26 and the software data packet to be upgraded is received again; S29, if the area where the program is located is PING: if the application status is TRUE, then write the data of the software to be upgraded to the FLASH in the PONG area; otherwise, write the data of the software to be upgraded to the FLASH in the PING area, if the area where the program is located is PONG: if the application status is TRUE, then write the data of the software to be upgraded to the FLASH in the PING area; otherwise, write the data of the software to be upgraded to the FLASH in the PONG area; S210, read the data of the application to be upgraded in FLASH, and compare it with the cached application data one by one. If it passes, execute S211, otherwise send a programming failure instruction to the host computer and jump to S214; S211, upgrading the area where the program is located in the FLASH according to the actual burning area; S212, write the application state space in FLASH to NULL; S213, sending a successful burning instruction to the upper computer; S214, exit the application.
2. The system for online upgrading of DSP software based on dual FLASH program space according to claim 1 is characterized in that: The DSP processor communicates with the host computer via a serial port or Ethernet, and the DSP processor is externally connected to the FLASH via an SPI or EMIFA bus.
3. The system for online upgrading of DSP software based on dual FLASH program space according to claim 2 is characterized in that: The operation of the system includes the following steps: After the DSP processor is powered on, the Bootloader program starts first, initializes PLL, DDR, EMIFA and SPI, obtains the status of the application software stored in FLASH, and selects the application to be started. The status of the application includes NULL, FLASE and TRUE; After the application is started, the serial port / Ethernet and peripherals are initialized to establish a communication link with the host computer; After the host computer is started, the upgrade software control program is started, and the user selects the software data package to be upgraded and the DSP processor, and after establishing a communication link with the DSP processor, the software data package to be upgraded is sent to the DSP processor; The application receives the software data packet to be upgraded sent by the host computer and feeds back to the host computer whether the received software data packet to be upgraded is complete; When the host computer receives the complete instruction of the software data packet to be upgraded from the DSP processor, it sends the software burning instruction to the DSP processor; After receiving the software burning instruction, the application program of the DSP processor selects the burning area according to the application software status stored in the FLASH, completes the burning and upgrades the application software status; The host computer receives the burning status instruction sent by the DSP processor, displays the burning result and prompts the user to shut down and restart.
4. The system for online upgrading of DSP software based on dual FLASH program space according to claim 3 is characterized in that: The step of the application receiving the software to be upgraded sent by the host computer and feeding back to the host computer whether the data packet of the received application is complete includes: if the data packet of the software to be upgraded is complete, sending a data packet complete instruction to the host computer; if the data packet of the application is incomplete, sending a retransmission instruction to the host computer.
5. The system for online upgrading of DSP software based on dual FLASH program space according to claim 4 is characterized in that: The bootloader software performs the following steps: S11, complete PLL, DDR, EMIFA and SPI initialization; S12, read the area where the application is located from the FLASH, and read the status of the application in the FLASH; S13, if the application is stored in the application cache PING area and its status is TRUE, then move the application in the application cache PING area to the DSP memory and start the program, otherwise move the application in the application cache PONG area to the DSP memory and start the program. If the application is stored in the application cache PONG area and its status is TRUE, then move the application in the application cache PONG area to the DSP memory and start the program, otherwise move the application in the application cache PING area to the DSP memory and start the program.
6. The system for online upgrading of DSP software based on dual FLASH program space according to claim 4, characterized in that: In S25, the method for judging whether the program is running successfully is that the timer counts the program running for more than 1 minute.
7. According to the system for online upgrading of DSP software based on dual FLASH program space of claim 4, in said S27, the step of completely receiving the upgrading software data packet comprises verifying the received software data packet to be upgraded, if the verification passes, setting the complete flag of the software data packet to be upgraded to a position, and feeding back a complete instruction of the software data packet to be upgraded to the host computer, otherwise feeding back a failure to receive the software data packet to be upgraded to the host computer, requesting retransmission, and repeating S26 until the upgrading software data packet verification succeeds.
8. The system for online upgrading of DSP software based on dual FLASH program space according to claim 3 is characterized in that: The upgrade software control program running on the host computer needs to perform the following steps: S31, after the software upgrade control program is started, the user selects the software to be upgraded; S32, establishing a communication link with the application; S33, sending a software data packet to be upgraded to the application; S34, receiving a complete instruction of the software data package to be upgraded, and then sending an instruction to upgrade the software; S35, receiving a retransmission instruction sent by the application, and then repeating S33; S36, receiving the burning status instruction sent by the application, displaying the burning result and prompting the user to shut down and restart.
Citation Information
Patent Citations
Upgrade system and upgrade method based on DSP
CN101178658A
Quick and stable serial port software upgrading method
CN107885523A