FPGA online upgrading method and system based on QuickBoot
Through the FPGA online upgrade method based on QuickBoot, online upgrades can be performed independently, which solves the problems of physical link limitations and main system logic occupation, and achieves a fast, flexible and reliable FPGA upgrade process.
Patent Information
- Application Number
- CN202410584108.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-11
- Publication Date
- 2024-10-01
AI Technical Summary
The existing fixed upgrade method of FPGA is limited by the length of the physical link, which makes the upgrade process cumbersome and unfavorable for development and maintenance. The common online upgrade method requires embedding the upgrade logic into the main system, which increases development difficulty and resource usage.
Using the FPGA online upgrade method based on QuickBoot, an independent online upgrade program is separated from the main system program, and the handshake module, frame judgment module and FLASH control module are used to transmit and write online upgrade data, avoiding physical link restrictions and main System logic occupied.
It realizes online upgrade without additional wiring and quick response, which simplifies the development process, improves development speed and flexibility, and increases the reliability of upgrade.
Smart Images

Figure CN118733076A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of FPGA upgrade application, and in particular relates to a QuickBoot-based FPGA online upgrade method and system. Technical Background
[0002] Field Programmable Gate Array (FPGA) is a product developed on the basis of PAL (Programmable Array Logic), CPLD (Complex Programmable Logic Device) and other programmable logic devices. Due to its flexible reprogramming ability, excellent logic operation ability, short development cycle and stable and reliable performance, FPGA is the first choice and preferred platform for the development of small and medium batch, complex and highly integrated systems, and is widely used in many fields, especially in the communication field.
[0003] In actual use, due to the volatility of FPGA running programs, after a relatively stable product is formed, it is often necessary to use non-volatile storage units, such as FLASH, to store the solidified FPGA program.
[0004] Common FPGA program fixation and upgrade methods, such as JTAG link connection fixation and upgrade, often require a dedicated physical link to connect the FPGA to complete the FPGA program fixation. This type of fixation and upgrade method is limited by the length of the physical link, and in the case of a product with a difficult-to-remove shell, it will make the product testing and upgrade process cumbersome and time-consuming, which is not conducive to product development and testing, nor is it conducive to the maintenance and upgrade of the product after it is put on the market.
[0005] Common FPGA program online upgrade methods, such as MultiBoot, can solve the above-mentioned problem of using physical links to complete the upgrade. However, the online upgrade logic must be embedded in the FPGA main system program, occupying the logic resources of the main system program, resulting in a complex program structure, difficult layout and routing, and increased development difficulty. Summary of the invention
[0006] In view of the above problems, the present invention provides a QuickBoot-based FPGA online upgrade method and system.
[0007] The technical solution to achieve the purpose of the present invention is as follows: In the first aspect, the present invention provides an FPGA online upgrade method based on QuickBoot, comprising the following steps:
[0008] S1. After the FPGA is powered on, it reads the main program startup control word, enters the main system program, and jumps to step S2. If the main program startup control word cannot be read because the last online upgrade was forcibly interrupted, it directly enters the online upgrade program and jumps to S3;
[0009] S2. Wait for the host computer to send an online upgrade command in normal working state. If an online upgrade command is received, jump to S3, otherwise keep S2 working normally and wait;
[0010] S3. Enter the independent online upgrade program, send the online upgrade preparation completion instruction to the host computer, and shake hands with the host computer;
[0011] S4. After the handshake between FPGA and the host computer is successful, FPGA erases the main system program and the main system startup control word. The host computer divides the online upgrade data into several parts and adds a frame header, frame count, data length, CRC check result and frame tail, and sends them to FPGA in sequence;
[0012] S5. Each time the FPGA receives an online upgrade data frame, it determines whether its frame header, frame tail, frame count and data length are correct. If they are correct, it parses the upgrade program for upgrading and notifies the host computer that the frame is correct. If they are wrong, it discards the wrong data and notifies the host computer that the frame is wrong.
[0013] S6. According to the upgrade status of FPGA feedback, send the online upgrade data packet to FPGA again. If the frame correct instruction is received, send the next frame of online upgrade data. If the frame error instruction is received, resend the current online upgrade data frame;
[0014] S7.FPGA writes the online upgrade data into FLASH and performs CRC check on the data. If the last frame of data is written successfully, the CRC check result is output. It is judged based on the CRC result in the data frame. If the results are consistent, the upgrade is successful and the main system startup control word is rewritten. If they are inconsistent, the host computer is notified to re-upgrade online.
[0015] Furthermore, in steps S4 and S7, the main system startup control word includes a frame header, an address, a jump instruction, and a frame tail, wherein the address refers to the starting address of the main system program, and the jump instruction is a judgment condition for whether to jump to the specified address.
[0016] Further, in step S4, the online upgrade data frame includes a frame header, data length, total number of frames, frame count, online upgrade data, CRC result and frame tail, where the total number of frames is the total number of data frames, the frame count is the current frame count, and the CRC result is the complete online upgrade data, which is only valid in the last data frame.
[0017] In a second aspect, the present invention provides an FPGA online upgrade system based on QuickBoot, used in the method described in the first aspect, the system comprising:
[0018] The handshake module is used to determine whether the handshake with the host computer is successful or not. If the handshake is successful, it sends an enable to the frame judgment module and the FLASH control module. If the handshake fails, it continues to send handshake instructions and waits for the handshake success feedback signal from the host computer;
[0019] The frame judgment module is used to judge whether the received online upgrade data frame is correct. If it is correct, it notifies the host computer to send the next frame of data, and extracts the online upgrade data and sends it to the FLASH control module. If it is wrong, it notifies the host computer of the frame error and resends the current frame.
[0020] The FLASH control module is used to generate control words and data that can be received by the FLASH. If the FPGA main system program is erased and its startup control word enable is received, the erase operation is performed; if the online upgrade data is received, the data write operation is performed; if the online upgrade success enable is received, the startup control word write operation is performed;
[0021] The SPI protocol conversion module is used to send the control word and data generated by the FLASH control module to the FLASH in the form of SPI protocol.
[0022] Furthermore, after loading the online upgrade program, the handshake module performs a handshake operation with the host computer to confirm whether the online upgrade operation can be performed. If the handshake is successful, an enable is sent to the frame judgment module to make it enter a state of waiting for online upgrade data, and an enable is sent to the FLASH control module to control the FLASH to erase the FPGA main system program and its startup control word. If the handshake fails, the handshake instructions are continuously sent and a handshake success feedback signal is waited for from the host computer.
[0023] Furthermore, the FLASH control module is used to generate corresponding control words and data to control the FLASH to perform read, write or erase operations based on the received enable signal and online upgrade data. If an enable signal for erasing the FPGA main system program and its startup control word is received, the corresponding control words and data are generated to control the FLASH to complete the erase work. If online upgrade data is received, it is cached and sent to the FLASH in address order from low to high. If an online upgrade success enable signal is received, the FPGA main system startup control word is re-written into the corresponding position.
[0024] In a third aspect, the present invention provides an FPGA online upgrade device based on QuickBoot, based on the system implementation described in the second aspect, the online upgrade device includes:
[0025] The host computer is used to start the online upgrade program and send online upgrade data and online upgrade instructions;
[0026] FPGA, used to load and run online upgrade programs and main programs;
[0027] FLASH, used to store the main program startup control word, online upgrade program and main program;
[0028] In the normal startup state, after the FPGA reads the main program startup control word and runs the main program, the host computer sends an online upgrade instruction to enable the FPGA to load the online upgrade program from the online upgrade program storage area in the FLASH;
[0029] In an abnormal startup state, the FPGA cannot read the main program startup control word from FLASH. At this time, the FPGA will read the online upgrade program sequentially and run the online upgrade program directly.
[0030] Compared with the prior art, the present invention has the following beneficial effects:
[0031] The present invention is no longer limited by the limitations of the physical link connection upgrade method. No additional wiring is required during the upgrade, and no product casing needs to be disassembled. It is easy and quick to use.
[0032] The present invention forms a separate program for the online upgrade logic, which exists independently of the main system program, achieves modularization and generalization, and improves the development speed and flexibility;
[0033] The FPGA loader of the present invention responds more quickly, reducing the time required for online upgrades;
[0034] The present invention designs a re-upgrade method to prevent the upgrade from failing due to unexpected circumstances, thereby increasing the reliability of the online upgrade method. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 This is the online upgrade logic flow chart.
[0036] Figure 2 This is the architecture diagram of the online upgrade program.
[0037] Figure 3 This is the hardware structure diagram for online upgrade. DETAILED DESCRIPTION
[0038] The present invention proposes an FPGA online upgrade method based on QuickBoot, which separates the online upgrade logic from the FPGA main system program. By utilizing the advantages of QuickBoot, the FPGA main system program to be upgraded can be flexibly and reliably burned into the specified FLASH storage space. By utilizing the characteristics of QuickBoot, the FPGA can jump to the online upgrade mode in any working state to upgrade the FPGA main system program without re-powering on; avoiding the use of the traditional JTAG connection solidification method, solving the problem of the need to disassemble the product during the upgrade, and no longer needing to consider the length limitation of the JTAG cable, and being suitable for a variety of environments, and being flexible and convenient to use. Different from MultiBoot storing two or more identical main system programs containing online upgrade logic in FLASH, QuickBoot separates the online upgrade logic from the main system program, reducing the impact of adding the online upgrade function on the structure and scale of the main system program, and the method is more flexible; the QuickBoot method requires the main system startup control word, the online upgrade program and the main system program to be stored in FLASH, and the required storage space is smaller, which reserves more sufficient space for the main system function expansion and performance improvement.
[0039] The following is a specific embodiment and attached Figure 1 to Figure 3 , detailing the feasibility and practicality of the present invention; the specific names, hardware structures, etc. appearing in this embodiment are not limitations of the present invention.
[0040] Now we are performing an online upgrade operation on a system consisting of an FPGA, a FLASH and a host computer. We plan to upgrade the FPGA main system program version from V1.0 to V1.1. The FPGA model is XC7K480T, the FLASH model is N25Q256A11ESF40F, and the host computer is a desktop computer with Windows 10 64-bit operating system. The specific implementation steps are as follows:
[0041] S1. After the system is powered on successfully, the FPGA starts from the address 0x0000_0000 of the external FLASH chip, reads the pre-written 32-bit main system startup control word 0xAA99_5566, and then jumps to the starting address 0x0100_0000 of the V1.0 main system program (hereinafter referred to as the V1.0 program) stored in the next address 0x0000_0001 of the startup control word, and loads the V1.0 program. The FPGA starts to work normally;
[0042] S2. The host computer sends a 32-bit start online upgrade instruction 0xFFBE_BEFF to the FPGA. The FPGA main running system program successfully receives the instruction, calls the ICAP primitive, stops the running of the V1.0 program, and loads the online upgrade program from the starting address 0x0000_0100 stored in the FLASH, and enters the online upgrade mode.
[0043] S3. After entering the online upgrade program, the handshake module in the online upgrade program sends a 32-bit handshake instruction 0x7F1E_1E7F to the host computer. After receiving the instruction, the host computer replies with a 32-bit handshake success instruction 0x7F2E_2E7F to the FPGA to complete the handshake operation with the FPGA.
[0044] S4. After the handshake is successful, the FPGA generates an erase instruction through the FLASH control module, which is then converted through the SPI module and sent to the FLASH to erase the V1.0 program and the main system startup control word in the FLASH;
[0045] S5. The host computer divides the 16MB V1.1 main system program (hereinafter referred to as V1.1 program) into 64 packets of data, each of which is 256KB in size, and caches them in order from low to high addresses. It also inserts a 32-bit frame header 0xA5A5_A5A5, a data length 0x0004_0000, a total number of frames 0x0000_0040 and a current frame count (incremented from 0x0000_0001 to 0x0000_0040, as the frame number) before the data, adds a 32-bit instruction after the data, the lower 16 bits are the CRC check result of the V1.1 program data (this result is the CRC result only in the data frame with a frame count of 0x0000_0040, and is 0 in the other frames), and the upper 16 bits are the frame tail 0x6666;
[0046] S5. After FPGA completes the operation of erasing the main system, it enters the frame judgment module of the online upgrade program, receives and judges whether the frame header, frame tail, frame count and data length of the online upgrade data frame are correct. If correct, the online upgrade data part in the frame is sent to the FLASH module and CRC module and a 32-bit instruction 0x7FF5_F57F is sent to notify the host computer to send the next frame of data. If it is wrong, the wrong data is discarded and a 32-bit instruction 0x7FFF_FF7F is sent to notify the host computer to retransmit the frame data. Repeat this step until the host computer has sent all online upgrade data frames and the frame count increases to 0x000_0040, which is equal to the total number of frames.
[0047] S6. The FLASH control module in the online upgrade program receives and caches the V1.1 program data, arranges the data in order from low to high address, sends it to the SPI protocol conversion module, converts it into the SPI protocol, and writes it to the original V1.0 program address stored in the FLASH. The address range is from 0x0100_0000 to 0x01FF_FFFF, completing the update and upgrade of the FPGA main system program;
[0048] S7. The CRC check module of FPGA will synchronously check the online upgrade data. After receiving all the online upgrade data, the CRC check result obtained is consistent with the CRC check result sent by the host computer. At this time, the online upgrade is successful and an enable notification is sent to the FLASH control module.
[0049] S8. After receiving the online upgrade success enable, the FLASH control module of FPGA regenerates the main system startup control word and startup address, converts them into SPI protocol format through the SPI protocol conversion module, writes them into the original main system startup control word address 0x0000_0000 to 0x0000_00FF of FLASH, and sends the 32-bit upgrade success instruction 0x7FFF_FFFE to notify the host computer to end the upgrade;
[0050] S9. After the host computer receives the upgrade success instruction, the online upgrade ends and the system is powered on again. The FPGA reads the 32-bit main system startup control word 0xAA99_5566 from the FLASH again, and then jumps to the starting address 0x0100_0000 of the main system program stored in the next address 0x0000_0001 of the startup control word and loads the program. The FPGA starts to work normally, reads the FPGA main program version number, and verifies that the FPGA main system program has been updated to version V1.1. At this point, an FPGA online upgrade is completed.
[0051] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A QuickBoot-based FPGA online upgrade method, characterized in that: The steps include: S1. After the FPGA is powered on, it reads the main program startup control word, enters the main system program, and jumps to step S2. If the main program startup control word cannot be read due to the last online upgrade being forcibly interrupted, it directly enters the online upgrade program and jumps to S3. S2. Wait for the host computer to send an online upgrade command in normal working state. If an online upgrade command is received, jump to S3, otherwise keep S2 working normally and wait; S3. Enter the independent online upgrade program, send the online upgrade preparation completion instruction to the host computer, and shake hands with the host computer; S4. After the FPGA successfully shakes hands with the host computer, the FPGA erases the main system program and the main system startup control word. The host computer divides the online upgrade data into several parts and adds a frame header, frame count, data length, CRC check result, and frame trailer, and sends them to the FPGA in sequence. S5. Each time the FPGA receives an online upgrade data frame, it determines whether its frame header, frame footer, frame count, and data length are correct. If they are correct, it parses the upgrade program, performs the upgrade, and notifies the host computer that the frame is correct. If they are incorrect, it discards the incorrect data and notifies the host computer that the frame is incorrect. S6. According to the upgrade status of FPGA feedback, the online upgrade data packet is sent to FPGA again. If the frame is correct, the next frame of online upgrade data is sent. If the frame error instruction is received, the current online upgrade data frame is resent. S7.FPGA writes the online upgrade data into FLASH and performs a CRC check on the data. If the last frame of data is written successfully, the CRC check result is output. The CRC result in the data frame is used to determine if the results are consistent. If the results are consistent, the upgrade is successful and the main system startup control word is rewritten. If they are inconsistent, the host computer is notified to re-upgrade online.
2. The FPGA online upgrade method based on QuickBoot according to claim 1, characterized in that: In steps S4 and S7, the main system startup control word includes a frame header, an address, a jump instruction, and a frame tail, wherein the address refers to the starting address of the main system program, and the jump instruction is a judgment condition for whether to jump to the specified address.
3. The FPGA online upgrade method based on QuickBoot according to claim 1, characterized in that: In step S4, the online upgrade data frame includes a frame header, data length, total number of frames, frame count, online upgrade data, CRC result and frame tail, where the total number of frames is the total number of data frames, the frame count is the current frame count, and the CRC result is the complete online upgrade data, which is only valid in the last data frame.
4. A QuickBoot-based FPGA online upgrade system, characterized in that: For implementing the method described in any one of claims 1 to 3, the system includes: The handshake module is used to determine whether the handshake with the host computer is successful or not. If the handshake is successful, it sends an enable signal to the frame judgment module and the FLASH control module. If the handshake fails, it continues to send handshake instructions and waits for the handshake success feedback signal from the host computer. The frame judgment module is used to judge whether the received online upgrade data frame is correct. If it is correct, it notifies the host computer to send the next frame of data. At the same time, it extracts the online upgrade data and sends it to the FLASH control module. If it is wrong, it notifies the host computer of the frame error and resends the current frame. The FLASH control module is used to generate control words and data that can be received by the FLASH. If the FPGA main system program is erased and its startup control word is enabled, the erase operation is performed. If the online upgrade data is received, the data write operation is performed. If the online upgrade success enable is received, the startup control word write operation is performed. The SPI protocol conversion module is used to send the control word and data generated by the FLASH control module to the FLASH in the form of SPI protocol.
5. The QuickBoot-based FPGA online upgrade system according to claim 4, characterized in that: After loading the online upgrade program, the handshake module performs a handshake operation with the host computer to confirm whether the online upgrade operation can be performed. If the handshake is successful, it sends an enable to the frame judgment module to make it enter the waiting state for online upgrade data, and sends an enable to the FLASH control module to control the FLASH to erase the FPGA main system program and its startup control word. If the handshake fails, it continues to send handshake instructions and waits for the handshake success feedback signal from the host computer.
6. The QuickBoot-based FPGA online upgrade system according to claim 4, characterized in that: The FLASH control module is used to generate corresponding control words and data to control the FLASH to perform read, write or erase operations based on the received enable signal and online upgrade data. If the enable signal for erasing the FPGA main system program and its startup control word is received, the corresponding control word and data are generated to control the FLASH to complete the erase operation. If the online upgrade data is received, it is cached and sent to the FLASH in address order from low to high. If the online upgrade is successfully enabled, the FPGA main system startup control word is rewritten into the corresponding position.
7. A QuickBoot-based FPGA online upgrade device, characterized in that: Based on the system implementation of claim 4, the device includes: The host computer is used to start the online upgrade program and send online upgrade data and online upgrade instructions; FPGA, used to load and run online upgrade programs and main programs; FLASH, used to store the main program startup control word, online upgrade program and main program; In the normal startup state, after the FPGA reads the main program startup control word and runs the main program, the host computer sends an online upgrade instruction to enable the FPGA to load the online upgrade program from the online upgrade program storage area in the FLASH; In an abnormal startup state, the FPGA cannot read the main program startup control word from the FLASH. At this time, the FPGA will sequentially read the online upgrade program.
Citation Information
Cited By
Remote batch online upgrading method for software of pseudo-satellite navigation and positioning system
CN119847575A
OTA remote upgrading method of gamma-ray energy spectrometer and FPGA applied to gamma-ray energy spectrometer
CN120994226A
