A method and system for remotely upgrading an FPGA board card
By loading SPI and MTD drivers into the CPU operating system and using the PCIe interconnect system to upgrade FPGA boards, the problems of multiple adaptation programs, long cycles, and poor stability in existing technologies are solved, achieving high efficiency, high stability, and strong adaptability in remote upgrades.
Patent Information
- Application Number
- CN202411619082.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-11-13
AI Technical Summary
Existing FPGA board upgrade methods suffer from problems such as a large number of compatibility programs, long development cycles, and poor stability.
By loading the SPI driver and MTD driver in the CPU operating system, utilizing the PCIe interconnect system, registering the SPI controller and calling the SPI driver, connecting the SPI flash memory, generating the MTD block device, and sending the upgrade program to the MTD block device, the FPGA board upgrade is completed.
Remote upgrades of FPGA boards have been enabled, reducing development cycles, improving stability and adaptability, and lowering costs.
Smart Images

Figure CN119621097B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent hardware, and in particular to a FPGA board upgrade method and system. Background Art
[0002] There are two main ways to upgrade existing FPGA (Field Programmable Gate Array) boards:
[0003] Method 1: A technician needs to go to the site and remove the card from the chassis. Figure 1 As shown, a computer is connected to the circuit board using a programmer, and the upgrade program is downloaded to the memory using a tool on the computer. The board is then reinstalled into the chassis. This entire process is cumbersome, costly, and prone to errors.
[0004] Method 2: If Figure 2 As shown, if the circuit board has Ethernet, the upgrade program can be sent to the onboard MCU (Microcontroller Unit) via Ethernet. The MCU is connected to the FPGA board via USB or serial port. Custom programs must be developed between the MCU and FPGA board, and between the FPGA board and memory. The upgrade program is downloaded to the memory through program control, completing the program upgrade. Compared to method one, this method avoids the need for on-site technicians and chassis disassembly, solving the problems of multiple intermediate adaptation programs, long development cycles, and poor stability. Summary of the Invention
[0005] The purpose of the embodiments of the present invention is to provide a method and device for upgrading an FPGA board, which can solve the problems existing in the prior art of having too many adaptation programs, a long development cycle and poor stability.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] An embodiment of the present invention provides a method for upgrading an FPGA (Field Programmable Gate Array) board. The method is applied to a system in which an FPGA board and a CPU (Central Processing Unit) are interconnected via PCIE. The method includes:
[0008] During the operation of the CPU operating system, the SPI driver and the MTD driver are loaded through preset commands;
[0009] The PCIE device driver calls a preset registration code to register the SPI controller to call the SPI driver;
[0010] The SPI driver calls the MTD driver and connects to the SPI flash memory;
[0011] The MTD driver generates a corresponding MTD block device in a specified directory;
[0012] The CPU operating system sends the FPGA board upgrade program to the MTD block device, and the MTD block device burns the FPGA board upgrade program into the SPI flash memory to complete the FPGA board upgrade.
[0013] Optionally, during the operation of the CPU operating system, the step of loading the SPI driver and the MTD driver through a preset command includes:
[0014] During the operation of the CPU operating system, the SPI driver and the MTD driver are loaded using the insmod command or the modprobe command.
[0015] Optionally, a serial communication interface (QSPI) is preset in the FPGA, and the serial communication interface (QSPI) is connected to the PCIE through an interconnection network based on the AXI protocol, and the other end of the PCIE is connected to the CPU.
[0016] Optionally, the step of the PCIE device driver calling a preset registration code to register the SPI controller to call the SPI driver includes:
[0017] Defining an abstract SPI controller pointer in the private data structure of the FPGA board;
[0018] Using the registration code preset in the probe function code portion of the FPGA board, create an SPI controller, and assign the SPI controller address to the SPI controller pointer;
[0019] Initializing the internal data of the SPI controller;
[0020] Use the spi_bitbang_start function to start the SPI bus and start working to call the SPI driver.
[0021] Optionally, after the step of the MTD block device burning the FPGA board upgrade program into the SPI flash memory, the method further includes:
[0022] The MTD block device is used to read the burned upgrade program from the SPI flash memory, and the upgrade program is compared with the upgrade program written into the SPI flash memory by the MTD block device to complete the upgrade program verification.
[0023] An embodiment of the present invention further provides an FPGA board upgrade system, wherein the system includes: an FPGA board and a CPU interconnected via PCIE, wherein the CPU includes:
[0024] A loading module, used to load the SPI driver and the MTD driver through preset commands during the operation of the CPU operating system;
[0025] The FPGA board includes:
[0026] A first calling module is used to call a preset registration code through a PCIE device driver to register an SPI controller to call the SPI driver;
[0027] A second calling module is used to call the MTD driver through the SPI driver and connect to the SPI flash memory;
[0028] A generation module, configured to generate a corresponding MTD block device in a specified directory through the MTD driver;
[0029] The CPU further includes:
[0030] The sending module is used to send the FPGA board upgrade program to the MTD block device, and burn the FPGA board upgrade program into the SPI flash memory through the MTD block device to complete the FPGA board upgrade.
[0031] Optionally, the loading module is specifically used to:
[0032] During the operation of the CPU operating system, the SPI driver and the MTD driver are loaded using the insmod command or the modprobe command.
[0033] Optionally, a serial communication interface (QSPI) is preset in the FPGA, and the serial communication interface (QSPI) is connected to the PCIE through an interconnection network based on the AXI protocol, and the other end of the PCIE is connected to the CPU.
[0034] Optionally, the first calling module includes:
[0035] A first submodule is configured to define an abstract SPI controller pointer in a private data structure of the FPGA board;
[0036] The second submodule is configured to create an SPI controller using the registration code preset in the probe function code portion of the FPGA board, and assign the SPI controller address to the SPI controller pointer;
[0037] The third submodule is used to initialize the internal data of the SPI controller;
[0038] The fourth submodule is used to use the spi_bitbang_start function to start the SPI bus to start working, so as to call the SPI driver.
[0039] Optionally, the CPU further includes:
[0040] The verification module is used to burn the FPGA board upgrade program into the SPI flash memory by operating the MTD block device, then use the MTD block device to read the burned upgrade program from the SPI flash memory, and compare the upgrade program with the upgrade program written into the SPI flash memory by the MTD block device to complete the upgrade program verification.
[0041] The FPGA board upgrade solution disclosed in the present invention loads the SPI driver and MTD driver through preset commands during the operation of the CPU operating system; the PCIE device driver calls the preset registration code, registers the SPI controller to call the SPI driver; the SPI driver calls the MTD driver and connects to the SPI flash memory; the MTD driver generates a corresponding MTD block device in a specified directory; the CPU operating system sends the FPGA board upgrade program to the MTD block device, and the MTD block device burns the FPGA board upgrade program into the SPI flash memory to complete the FPGA board upgrade. The FPGA board upgrade solution provided in the embodiment of the present application can realize remote upgrade of the FPGA board by adding a small amount of code, such as the preset registration code, to the FPGA board driver. Since only a small amount of code is added, it has the advantages of a short development cycle, high stability, and strong adaptability. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a structural block diagram showing an FPGA board upgrade system in the prior art;
[0043] Figure 2 It is a block diagram showing another FPGA board upgrade system in the prior art;
[0044] Figure 3 Schematic diagram showing the working mode of the FPGA board in an embodiment of the present application;
[0045] Figure 4 is a flowchart showing the steps of the FPGA board upgrade method according to an embodiment of the present application;
[0046] Figure 5 1 is a diagram showing the internal interconnection logic between the FPGA board and the PCIE of an embodiment of the present application;
[0047] Figure 6 is a schematic diagram showing the structure of an operating system according to an embodiment of the present application;
[0048] Figure 7 It is a structural block diagram of an FPGA board upgrade system according to an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0050] In order to solve the above problems existing in the prior art, this application provides a remote upgrade solution for FPGA boards such as PCIE accelerator cards and acquisition cards. The solution is suitable for Figure 3 Remote upgrade of the FPGA board in the working mode shown. The FPGA board is connected to the CPU mainboard through the PCIE interface, and the CPU communicates with the FPGA board through the PCIE interface and controls the FPGA board. This application is based on this PCIE architecture and uses public and open source module resources (including IP cores integrated in the FPGA board development environment, standard drivers of the operating system, and open source software tools). By adding a small amount of code to the FPGA board driver, the remote upgrade function can be realized. Among them, PCIE is the third generation I / O bus after the ISA and PCI buses. The PCIE protocol is an end-to-end interconnection protocol. The CPU communicates with the FPGA board through PCIE, and the two comply with the PCIE protocol specification when communicating.
[0051] The FPGA board upgrade solution provided in the embodiment of the present application is described in detail below with reference to specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0052] As attached Figure 4 As shown, the FPGA board upgrade method of the embodiment of the present application includes the following steps:
[0053] Step 101: During the operation of the CPU operating system, the SPI driver and the MTD driver are loaded through a preset command.
[0054] This application adds an "AXI_Quad_SPI" module to the FPGA software logic. This module is included with the software development tool. AXIQuad SPI (Quad Serial Peripheral Interface) is a serial communication interface widely used in FPGAs and other integrated circuits for connecting SPI (Serial Peripheral Interface) devices, such as Flash memory. It supports single-, dual-, and quad-wire modes. The more lines, the faster the data transfer. The "AXI_Quad_SPI" module is included with the software development tool.
[0055] like Figure 5As shown, the FPGA is pre-configured with a serial communication interface (such as the "AXI_Quad_SPI" module). This serial communication interface connects to the PCIE module via an AXI-based interconnect network. The other end of the PCIE module is connected to the CPU. The AXI interconnect network is provided by the AXI Interconnect module. The FPGA is equipped with a PCIE module for connection to one end of the PCIE module, and the other end of the PCIE module is connected to the CPU. The "AXI_Interconnect module" connects the "PCIE module" to the "AXI_Quad_SPI" module. The "AXI_Interconnect module" is included with the software development tool.
[0056] In actual use, use the Address Editor tool to assign an address to the AXI_Quad_SPI module. The starting address is freely configurable, and the address space can be up to 64K bytes. In the constraint file, constrain the pins of the AXI_Quad_SPI module. These pins include: spi_iso, spi_osi, spi_cs, and spi_clk. The pin locations and voltages must be consistent with the board design.
[0057] Figure 6 Schematic diagram of the operating system structure of the embodiment of the present application; Figure 6 As shown, the operating system is divided into a kernel layer and an application layer. The application layer interacts with the kernel layer through shell commands. The application layer also includes mtd-utils, a set of tools for managing the MTD (Memory Technology Device) subsystem, which provides powerful storage device management capabilities for embedded operating systems. The kernel layer of the operating system includes the MTD driver, the SPI (Serial Peripheral Interface) driver, and the PCIE driver. These drivers are activated during the operating system startup.
[0058] An optional method of loading the SPI driver and the MTD driver by using a preset command during the operation of the CPU operating system may be: using an insmod command or a modprobe command to load the SPI driver and the MTD driver during the operation of the CPU operating system.
[0059] The SPI driver can further control the "AXI_Quad_SPI" module to access data from the SPI flash memory. The MTD driver can generate an MTD block device, which triggers the operation of burning the FPGA board upgrade program to the SPI flash memory.
[0060] The insmod command can only load a specific device driver at a time and requires the specific address of the driver. An exemplary insmod command may be insmod drv.ko.
[0061] modprobe can load all dependent drivers into the kernel at once without adding the specific address of the driver, but it is necessary to install the driver module in the manner of make modules_intall when installing the file system. An exemplary modprobe command can be modprobe drv.
[0062] Step 102: The PCIE device driver calls a preset registration code to register the SPI controller to call the SPI driver.
[0063] In an embodiment of the present application, a registration code is preset in the probe function code part of the FPGA board, and the registration code is used to register the SPI controller. After the SPI controller is registered, the communication link between the CPU, PCIE, FPGA board and SPI flash memory can be opened.
[0064] An optional method for the PCIE device driver to call a preset registration code and register the SPI controller to call the SPI driver may be:
[0065] First, define an abstract SPI controller pointer in the private data structure of the FPGA board;
[0066] That is, define a struct_spi_master pointer spimaster. struct_spi_master abstracts the controller hardware. In SoC, it refers to the internal SPI controller. When registering an SPI controller with the SPI core layer, such a structure variable needs to be provided.
[0067] Secondly, use the preset registration code in the probe function code of the FPGA board to create an SPI controller and assign the SPI controller address to the SPI controller pointer;
[0068] The registration code can be the spi_alloc_master function. The prototype of the spi_alloc_master function is as follows:
[0069] struct_spi_master*spi_alloc_master(struct device*dev, unsigned size)
[0070] The parameter dev is the dev pointed to by the FPGA board, and size is the size of the struct_spi_master structure.
[0071] Again, initialize the internal data of the SPI controller;
[0072] Finally, use the spi_bitbang_start function to start the SPI bus and call the SPI driver.
[0073] Step 103: The SPI driver calls the MTD driver and connects to the SPI flash memory.
[0074] The SPI driver will call the MTD driver and automatically scan and load the connected SPI flash memory.
[0075] SPI Flash (SPI Flash) is a non-volatile memory chip based on the Serial Peripheral Interface (SPI) protocol. It is widely used in embedded systems and various portable devices. SPI Flash memory is widely used due to its small size, low cost, fast read and write speed, and strong durability. Figure 3 The memory shown in .
[0076] Step 104: The MTD driver generates a corresponding MTD block device in the specified directory.
[0077] In the actual implementation process, the MTD driver can automatically generate the corresponding MTD block device in the / dev directory, for example, it can be named "mtd0".
[0078] Step 105: The CPU operating system sends the FPGA board upgrade program to the MTD block device. The MTD block device burns the FPGA board upgrade program into the SPI flash memory to complete the FPGA board upgrade.
[0079] It should be noted that the FPGA board upgrade method provided in this application can not only remotely update the FPGA board upgrade program to the SPI flash memory, but also allow the CPU to remotely store other key data to the SPI flash memory.
[0080] In an optional embodiment, after the MTD block device burns the FPGA board upgrade program into the SPI flash memory, the MTD block device can also be used to read the burned upgrade program from the SPI flash memory, and compare the read upgrade program with the upgrade program written into the SPI flash memory by the MTD block device to complete the upgrade program verification.
[0081] Verification can be used to determine whether the upgrade program written into the SPI flash memory is accurate, thereby ensuring the reliability of the FPGA board program upgrade.
[0082] When the upgrade program verification result shows that the upgrade has failed, the FPGA's MultiBoot technology can be used to implement upgrade failure rollback. If the upgrade fails, the program can be rolled back to the version before the upgrade, further improving system stability.
[0083] In an optional embodiment, when the FPGA board is successfully upgraded, hot loading can be achieved using technologies such as WarmBoot, and the program upgrade can be achieved without restarting the FPGA board.
[0084] In situations where security is high and the FPGA board cannot be connected to the outside world via Ethernet, the upgrade package can be copied via a USB flash drive, CD, etc. to achieve FPGA upgrade.
[0085] The FPGA board upgrade method provided in the embodiment of the present application loads the SPI driver and MTD driver through a preset command during the operation of the CPU operating system; the PCIE device driver calls the preset registration code, registers the SPI controller to call the SPI driver; the SPI driver calls the MTD driver and connects the SPI flash memory; the MTD driver generates the corresponding MTD block device in the specified directory; the CPU operating system sends the FPGA board upgrade program to the MTD block device, and the MTD block device burns the FPGA board upgrade program into the SPI flash memory to complete the FPGA board upgrade. The FPGA board upgrade solution provided in the embodiment of the present application can realize remote upgrade of the FPGA board by adding a small amount of code, such as the preset registration code, to the FPGA board driver. Since only a small amount of code is added, it has the advantages of a short development cycle, high stability, and strong adaptability.
[0086] The following is a specific example to illustrate the FPGA board upgrade method of the embodiment of the present application.
[0087] This specific example provides a remote upgrade solution for FPGA boards such as PCIE accelerator cards and acquisition cards. This solution is suitable for Figure 3 Remote upgrade of the FPGA board in the working mode shown. The FPGA board is connected to the CPU motherboard via the PCIE interface. The CPU communicates with and controls the FPGA board through the PCIE interface. In this specific example, based on this PCIE architecture, public and open source module resources (including IP cores integrated in the FPGA board development environment, standard operating system drivers, and open source software tools) are utilized to implement the remote upgrade function by adding a small amount of code to the FPGA board driver.
[0088] FPGA board part:
[0089] Add "AXI_Quad_SPI" module and "AXI_Interconnect" module to the FPGA board software logic, as shown in the attached Figure 5 As shown, the "AXI_Interconnect module" connects the "PCIE module" to the "AXI_Quad_SPI" module. The "AXI_Interconnect module" also comes with the software development tool.
[0090] Use the Address Editor tool to assign addresses to the "AXI_Quad_SPI module". The starting address can be freely configured, and the address space is 64K bytes.
[0091] In the constraint file, constrain the pins of the AXI_Quad_SPI module, including spi_iso, spi_osi, spi_cs, and spi_clk. Ensure that the pin locations and voltages match those in the board design.
[0092] The structural diagram of the operating system is as follows Figure 6 As shown, the operating system has been adjusted as follows:
[0093] In a Linux-based operating system, use the insmod or modprobe command to load the SPI and MTD drivers. Commonly used SPI Flash memories are supported by the Linux kernel's MTD driver, which scans for the corresponding chip model and loads the driver.
[0094] The FPGA board driver has been adjusted as follows. To remotely upgrade the FPGA board, perform the following operations:
[0095] Add the code to register the SPI controller in the probe code of the FPGA board;
[0096] The SPI driver will call the MTD driver and automatically scan and load the connected SPI Flash;
[0097] The MTD driver will automatically generate the corresponding MTD block device in the / dev directory, such as "mtd0";
[0098] By operating this block device, you can operate the SPI Flash and burn the upgrade program into the SPI Flash;
[0099] Use the tool to read the data from the SPI Flash and verify it.
[0100] The FPGA board upgrade method provided in the embodiment of the present application, on the one hand, utilizes the existing FPGA development environment IP core and operating system standard driver, reducing additional development work; on the other hand, it can realize remote upgrade of FPGA boards, thereby improving development efficiency and system stability; on the other hand, the method has good adaptability and can be widely applied to different types of FPGA boards.
[0101] Figure 7 This is a structural block diagram of an FPGA board upgrade system for implementing an embodiment of the present application.
[0102] The FPGA board upgrade system provided in the embodiment of the present application includes: an FPGA board 702 and a CPU 703 interconnected via a PCIE 701, wherein the CPU 703 includes:
[0103] The loading module 7031 is used to load the SPI driver and the MTD driver through preset commands during the operation of the CPU operating system;
[0104] The FPGA board 702 includes:
[0105] The first calling module 7021 is configured to call a preset registration code through a PCIE device driver to register an SPI controller to call the SPI driver;
[0106] The second calling module 7022 is used to call the MTD driver through the SPI driver and connect to the SPI flash memory;
[0107] A generation module 7023 is used to generate a corresponding MTD block device in a specified directory through the MTD driver;
[0108] The CPU 703 further includes:
[0109] The sending module 7032 is used to send the FPGA board upgrade program to the MTD block device through the PCIE, and burn the FPGA board upgrade program into the SPI flash memory through the MTD block device to complete the FPGA board upgrade.
[0110] Optionally, the loading module is specifically used to:
[0111] During the operation of the CPU operating system, the SPI driver and the MTD driver are loaded using the insmod command or the modprobe command.
[0112] Optionally, a serial communication interface is preset in the FPGA, and the serial communication interface is connected to the PCIE module through an interconnection network based on the AXI protocol, and the other end of the PCIE module is connected to the CPU.
[0113] Optionally, the first calling module includes:
[0114] A first submodule is configured to define an abstract SPI controller pointer in a private data structure of the FPGA board;
[0115] The second submodule is configured to create an SPI controller using the registration code preset in the probe function code portion of the FPGA board, and assign the SPI controller address to the SPI controller pointer;
[0116] The third submodule is used to initialize the internal data of the SPI controller;
[0117] The fourth submodule is used to use the spi_bitbang_start function to start the SPI bus to start working, so as to call the SPI driver.
[0118] Optionally, the CPU further includes:
[0119] The verification module is used to burn the FPGA board upgrade program into the SPI flash memory by operating the MTD block device, then use the MTD block device to read the burned upgrade program from the SPI flash memory, and compare the upgrade program with the upgrade program written into the SPI flash memory by the MTD block device to complete the upgrade program verification.
[0120] The embodiments of the present application provide Figure 7 The FPGA board upgrade system shown can achieve Figure 4 To avoid repetition, the various processes implemented in the method embodiment are not described here.
[0121] The FPGA board upgrade system provided by the embodiment of the present application loads the SPI driver and MTD driver through preset commands during the operation of the CPU operating system; the PCIE device driver calls the preset registration code, registers the SPI controller to call the SPI driver; the SPI driver calls the MTD driver and connects the SPI flash memory; the MTD driver generates the corresponding MTD block device in the specified directory; the CPU operating system sends the FPGA board upgrade program to the MTD block device, and the MTD block device burns the FPGA board upgrade program into the SPI flash memory to complete the FPGA board upgrade. By adding a small amount of code such as the preset registration code to the FPGA board driver, the FPGA board can be remotely upgraded. Since only a small amount of code is added, it has the advantages of a short development cycle, high stability, and strong adaptability.
[0122] An embodiment of the present invention further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus.
[0123] Memory for storing computer programs;
[0124] The processor is used to execute the program stored in the memory to implement the relevant operations performed by the CPU in the FPGA board upgrade method shown in the above method embodiment.
[0125] The communication bus mentioned in the terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.
[0126] The communication interface is used for communication between the above terminal and other devices.
[0127] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.
[0128] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0129] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, which stores instructions. When the computer-readable storage medium is executed on a computer, it enables the computer to implement the steps executed by the CPU in the FPGA board upgrade method described in any of the above embodiments.
[0130] In another embodiment provided by the present invention, a computer program product containing instructions is also provided. When the computer is run on the computer, the computer implements the steps executed by the CPU in the FPGA board upgrade method described in any of the above embodiments.
[0131] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0132] The above is a preferred embodiment 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 method for upgrading an FPGA board, characterized in that: Applicable to a system where an FPGA board and a CPU are interconnected via PCIE, the method includes: During the operation of the CPU operating system, the SPI driver and the MTD driver are loaded through preset commands; The PCIE device driver calls a preset registration code to register the SPI controller to call the SPI driver; The SPI driver calls the MTD driver and connects to the SPI flash memory; The MTD driver generates a corresponding MTD block device in a specified directory; The CPU operating system sends the FPGA board upgrade program to the MTD block device, and the MTD block device burns the FPGA board upgrade program into the SPI flash memory to complete the FPGA board upgrade. The step of the PCIE device driver calling a preset registration code to register the SPI controller to call the SPI driver includes: Defining an abstract SPI controller pointer in the private data structure of the FPGA board; Using the registration code preset in the probe function code portion of the FPGA board, create an SPI controller, and assign the SPI controller address to the SPI controller pointer; Initializing the internal data of the SPI controller; Use the spi_bitbang_start function to start the SPI bus and start working to call the SPI driver.
2. The method according to claim 1, characterized in that During the operation of the CPU operating system, the steps of loading the SPI driver and the MTD driver through preset commands include: During the operation of the CPU operating system, the SPI driver and the MTD driver are loaded using the insmod command or the modprobe command.
3. The method according to claim 1, characterized in that A serial communication interface is preset in the FPGA, and the serial communication interface is connected to the PCIE module through an interconnection network based on the AXI protocol, and the other end of the PCIE module is connected to the CPU.
4. The method according to claim 1, wherein After the step of the MTD block device burning the FPGA board upgrade program into the SPI flash memory, the method further includes: The MTD block device is used to read the burned upgrade program from the SPI flash memory, and the upgrade program is compared with the upgrade program written into the SPI flash memory by the MTD block device to complete the upgrade program verification.
5. An FPGA board upgrade system, characterized in that: The system includes: an FPGA board and a CPU interconnected via PCIE, and the CPU includes: A loading module, used to load the SPI driver and the MTD driver through preset commands during the operation of the CPU operating system; The FPGA board includes: A first calling module is used to call a preset registration code through a PCIE device driver to register an SPI controller to call the SPI driver; A second calling module is used to call the MTD driver through the SPI driver and connect to the SPI flash memory; A generation module, configured to generate a corresponding MTD block device in a specified directory through the MTD driver; The CPU further includes: A sending module, configured to send the FPGA board upgrade program to the MTD block device through the PCIE, and burn the FPGA board upgrade program into the SPI flash memory through the MTD block device to complete the FPGA board upgrade; Wherein, the first calling module includes: A first submodule is configured to define an abstract SPI controller pointer in a private data structure of the FPGA board; The second submodule is configured to create an SPI controller using the registration code preset in the probe function code portion of the FPGA board, and assign the SPI controller address to the SPI controller pointer; The third submodule is used to initialize the internal data of the SPI controller; The fourth submodule is used to use the spi_bitbang_start function to start the SPI bus to start working, so as to call the SPI driver.
6. The FPGA board upgrade system according to claim 5, characterized in that: The loading module is specifically used for: During the operation of the CPU operating system, the SPI driver and the MTD driver are loaded using the insmod command or the modprobe command.
7. The FPGA board upgrade system according to claim 5, characterized in that: A serial communication interface is preset in the FPGA, and the serial communication interface is connected to the PCIE through an interconnection network based on the AXI protocol, and the other end of the PCIE is connected to the CPU.
8. The FPGA board upgrade system according to claim 5, characterized in that: The CPU further includes: The verification module is used to burn the FPGA board upgrade program into the SPI flash memory by operating the MTD block device, then use the MTD block device to read the burned upgrade program from the SPI flash memory, and compare the upgrade program with the upgrade program written into the SPI flash memory by the MTD block device to complete the upgrade program verification.
Citation Information
Patent Citations
System for realizing online upgrading
CN116661825A