CN112486515B - FPGA software online upgrading method based on 1K-XModem protocol - Google Patents

FPGA software online upgrading method based on 1K-XModem protocol Download PDF

Info

Publication number
CN112486515B
CN112486515B CN202011366224.6A CN202011366224A CN112486515B CN 112486515 B CN112486515 B CN 112486515B CN 202011366224 A CN202011366224 A CN 202011366224A CN 112486515 B CN112486515 B CN 112486515B
Authority
CN
China
Prior art keywords
data
upper computer
fpga software
software
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011366224.6A
Other languages
Chinese (zh)
Other versions
CN112486515A (en
Inventor
滑立
毛义伟
刘琼
汪江华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Luoyang Institute of Electro Optical Equipment AVIC
Original Assignee
Luoyang Institute of Electro Optical Equipment AVIC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Luoyang Institute of Electro Optical Equipment AVIC filed Critical Luoyang Institute of Electro Optical Equipment AVIC
Priority to CN202011366224.6A priority Critical patent/CN112486515B/en
Publication of CN112486515A publication Critical patent/CN112486515A/en
Application granted granted Critical
Publication of CN112486515B publication Critical patent/CN112486515B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/63Image based installation; Cloning; Build to order
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The invention provides an FPGA software online upgrading method based on a 1K-XModem protocol, which comprises the steps of firstly obtaining a programming file, adopting the 1K-Xmodem protocol as a serial port transmission protocol, newly adding a series check to ensure the correctness of file transmission, increasing the operations of integral reading and one-to-one comparison at the stage of writing data into FLASH and improving the reliability of software programming. When the method is applied to the infrared imaging software upgrading process in the infrared imaging equipment, compared with a series of complicated operations of disassembling a product, connecting a simulator, loading a program, filling nitrogen and the like which are required by the original method for upgrading software through a JTAG interface, the serial port online upgrading method simplifies the upgrading process of FPGA software, does not need to disassemble products, and reduces risks and cost brought by software upgrading.

Description

FPGA software online upgrading method based on 1K-XModem protocol
Technical Field
The invention relates to the technical field of infrared imaging software upgrading in infrared imaging equipment, in particular to an FPGA software online upgrading method based on a 1K-XModem protocol.
Background
In the process of developing embedded software of an NIOS soft core + FPGA system architecture, the infrared imaging software in the infrared imaging equipment needs to be updated, and the FPGA software is generally programmed after being debugged by using an emulator through a JTAG interface. If the software is upgraded by adopting the method after the infrared imaging equipment is delivered, the product is required to be disassembled, the simulator is connected, the program is loaded, and nitrogen is required to be refilled after the software is verified to be correct, so that the process is quite complex to operate and is easy to make mistakes.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides an FPGA software online upgrading method based on a 1K-XModem protocol, which realizes the software online upgrading function based on an RS422 serial port, firstly, a programming file needs to be acquired, a serial port transmission protocol adopts the 1K-Xmodem protocol, new sequence verification is added to ensure the correctness of file transmission, the operations of integral reading and one-to-one comparison are added in the data writing FLASH stage, and the reliability of software programming is improved. When the method is applied to the infrared imaging software upgrading process in the infrared imaging equipment, compared with a series of complicated operations of disassembling a product, connecting a simulator, loading a program, filling nitrogen and the like which are originally needed by a method for upgrading software through a JTAG interface, the serial port online upgrading method simplifies the upgrading process of FPGA software, does not need to disassemble products, and reduces risks and cost brought by software upgrading.
The technical scheme of the invention is as follows:
the FPGA software online upgrading method based on the 1K-XModem protocol comprises the following steps:
step 1: generating a programming file:
step 1.1: erasing a FLASH memory in the infrared imaging equipment in a whole chip; this may be done by reading the data and checking if all are FFs to see if all are erased;
step 1.2: writing an elf file and a bit file after FPGA software compiling is completed into the FLASH memory through a JTAG interface;
step 1.3: reading data in the FLASH memory to obtain a storage area of the file programmed in the step 1.2; for example, by performing read judgment on each storage sector in the FLASH memory, the non-full FF storage sector is the storage area of the file programmed in step 1.2;
step 1.4: packing the data read in the step 1.3 according to a 1K-Xmodem protocol, and sending the data to an upper computer; for example, the packed data can be sent to an upper computer through an RS422 serial port;
step 1.5: the upper computer receives the data and then generates an out file of FPGA software;
step 1.6: after the FLASH memory is erased again in a whole piece, the out file generated in the step 1.5 is programmed into the FLASH memory; for example, one-key programming can be performed through a flash programming file programming function in an NIOS II 7.2 environment;
after the infrared imaging equipment is powered on again, the FPGA software is started normally, and the functions and the version of the software are confirmed; the innovation point of the step is that the storage area of the burning effective code in the FLASH can be confirmed, and the upper computer is used for exporting data and forming a burning file.
Step 2: and (3) data transmission process:
step 2.1: the infrared imaging equipment is powered on, if the FPGA software receives an on-line upgrading command, the FPGA software sends a NAK signal to the upper computer, and the NAK signal indicates that transmission is started and a file is to be received;
step 2.2: circularly receiving upgrade data sent by an upper computer by FPGA software according to a 1K-Xmodem protocol and storing an array, wherein the upgrade data comprises code data and column check data;
step 2.3: after receiving the EOT signal, the FPGA software calculates the checksum of the array storing the code data according to the columns, compares the checksum with the received column check data one by one, sends an ACK signal to the upper computer if the checksum is correct, and sends a CAN signal to cancel the upgrading process if the checksum is not correct; the EOT signal represents that the file transmission is finished, and the ACK signal represents that the response is normal;
the innovation point of the step is that new row verification is added to ensure that the transmission of the programming file is correct.
And 3, step 3: writing data into a FLASH memory:
step 3.1: after the FPGA software checks the code data column correctly, the code data is written into a code storage area in the FLASH memory, wherein the code storage area is the storage area obtained in the step 1.3;
step 3.2: reading the data in the code storage area, comparing the data with the code data stored in the array one by one, and feeding back the success of programming to the upper computer after confirming no error; if the comparison data are not consistent, repeating the step 3.1 until the comparison data are consistent; if the comparison data are not consistent after the repeated setting times, feeding back the upgrading programming failure to the upper computer.
Then, the infrared imaging equipment is electrified again, the FPGA software is started normally, and the functions and versions of the software are confirmed; the innovation point of the step is that the code data are written into the FLASH and then are integrally read and compared one by one so as to ensure the reliability.
Advantageous effects
The invention realizes the software online upgrading function based on the RS422 serial port, firstly, a programming file needs to be obtained, the serial port transmission protocol adopts a 1K-Xmodem protocol, the correctness of file transmission is ensured by newly adding sequence verification, the operation of integral reading and one-to-one comparison is added at the stage of writing data into FLASH, and the reliability of software programming is improved. When the method is applied to the infrared imaging software upgrading process in the infrared imaging equipment, compared with a series of complicated operations of disassembling a product, connecting a simulator, loading a program, filling nitrogen and the like which are originally needed by a method for upgrading software through a JTAG interface, the serial port online upgrading method simplifies the upgrading process of FPGA software, does not need to disassemble products, and reduces risks and cost brought by software upgrading.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a flow chart of the generation of a write file;
FIG. 3 is a flow chart of data transmission;
fig. 4 is a flow chart of data writing to FLASH.
Detailed Description
The following detailed description of embodiments of the invention is intended to be illustrative, and not to be construed as limiting the invention.
As shown in fig. 1, the FPGA software online upgrade method based on the 1K-XModem protocol provided by the present invention includes processes of generating a programming file, transmitting data, and writing data into a FLASH memory, and specifically includes:
as shown in fig. 2, step 1: generating a programming file:
step 1.1: erasing the FLASH memory (EPCS64) in the infrared imaging device in its entirety; here, we adopt a mode of reading data and checking whether the data are all FF to confirm whether all data are erased;
step 1.2: writing an elf file and a bit file into the FLASH memory through a JTAG interface in the infrared imaging equipment after FPGA software compiling is completed;
step 1.3: reading data in the FLASH memory to obtain a storage area of the file programmed in the step 1.2, wherein the storage area is a storage area (sector 0-sector 31) of software and logic code data; the specific judgment process is as follows: reading and judging each storage sector in the FLASH memory, wherein the non-full FF storage sector is the storage area of the file programmed in the step 1.2;
step 1.4: packing the data read in the step 1.3 according to a 1K-Xmodem protocol, and sending the data to an upper computer through an RS422 serial port;
step 1.5: the upper computer receives the data and then generates an out file of the FPGA software;
step 1.6: after the FLASH memory is erased again in a whole piece, the out file generated in the step 1.5 is programmed into the FLASH memory; here we do one-key programming through the flash programming file function in NIOS II 7.2 environment.
And after the infrared imaging equipment is powered on again, the FPGA software is normally started to confirm the function and version of the software.
As shown in fig. 3, step 2: and (3) data transmission process:
step 2.1: after the infrared imaging equipment is powered on, and the software runs into a refrigeration standby state, if the received first packet command is an online upgrade command (specifically, the order is A9E 0 FF FD FC FB FA F9 Checksum), entering an online upgrade function; otherwise, executing according to a normal flow and not entering an online upgrading mode;
after receiving an online upgrading command, sending a NAK signal to an upper computer by FPGA software, wherein the NAK signal indicates starting transmission and waits for receiving a file;
step 2.2: the FPGA software circularly receives upgrade data sent by an upper computer according to a 1K-Xmodem protocol and stores an array, wherein the upgrade data comprises 2048 packets of code data and 1 packet of column check data, and the method comprises the following specific steps:
after receiving the NAK signal, the upper computer sends a first packet of data (1028 bytes), after receiving by FPGA software, the upper computer judges whether the packet head, the packet number and the packet number complement are correct or not and calculates whether the packet checksum is correct or not, if so, the current data is stored in an array, the number of the data packets is increased by 1, the upper computer sends an ACK signal to the upper computer, after receiving the ACK signal, the upper computer sends the next packet of data, and so on until all 2049 packets of data are completely transmitted; if any packet is checked to be wrong, CAN cancellation transmission is sent to the upper computer, the upgrading process is cancelled, and power-off is needed to be restarted;
step 2.3: after receiving the EOT signal, the FPGA software calculates the checksum of the array storing the code data according to the columns, compares the checksum with the received column check data one by one, sends an ACK signal to an upper computer if the checksum is correct, and otherwise sends a CAN signal to cancel the upgrading process and restart after power off; the EOT signal indicates that the file is transmitted completely, and the ACK signal indicates that the response is normal.
As shown in fig. 4, step 3: writing data into a FLASH memory:
step 3.1: after the FPGA software checks the code data column correctly, the code data is written into a code storage area in the FLASH memory, wherein the code storage area is the storage area obtained in the step 1.3;
step 3.2: reading the data in the code storage area, comparing the data with the code data stored in the array one by one, and feeding back the success of programming to the upper computer after confirming no error; if the comparison data are not consistent, repeating the step 3.1 until the comparison data are consistent; if the comparison data are inconsistent after repeating for 10 times, feeding back the upgrading programming failure to the upper computer.
And then the infrared imaging equipment is electrified again, the FPGA software is normally started, and the functions and the version of the software are confirmed.
The invention realizes the software online upgrading function based on the RS422 serial port, firstly, a programming file is required to be obtained, the serial port transmission protocol adopts a 1K-Xmodem protocol, the serial check is newly added to ensure the correctness of file transmission, the operations of integral reading and one-to-one comparison are added at the stage of writing data into a FLASH, and the reliability of software programming is improved. When the method is applied to the infrared imaging software upgrading process in the infrared imaging equipment, compared with a series of complicated operations of disassembling a product, connecting a simulator, loading a program, filling nitrogen and the like which are originally needed by a method for upgrading software through a JTAG interface, the serial port online upgrading method simplifies the upgrading process of FPGA software, does not need to disassemble products, and reduces risks and cost brought by software upgrading.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made in the above embodiments by those of ordinary skill in the art without departing from the principle and spirit of the present invention.

Claims (6)

1. A FPGA software online upgrading method based on a 1K-XModem protocol is characterized by comprising the following steps: the method comprises the following steps:
step 1: generating a programming file:
step 1.1: erasing a FLASH memory in the infrared imaging equipment in a whole piece;
step 1.2: writing an elf file and a bit file after FPGA software compiling is completed into the FLASH memory through a JTAG interface;
step 1.3: reading data in the FLASH memory to obtain a storage area of the file programmed in the step 1.2;
step 1.4: packing the data read in the step 1.3 according to a 1K-Xmodem protocol, and sending the data to an upper computer;
step 1.5: the upper computer receives the data and then generates an out file of the FPGA software;
step 1.6: after the FLASH memory is erased again in a whole piece, the out file generated in the step 1.5 is programmed into the FLASH memory;
and 2, step: and (3) data transmission process:
step 2.1: the infrared imaging equipment is powered on, if the FPGA software receives an on-line upgrading command, the FPGA software sends a NAK signal to the upper computer, and the NAK signal indicates that transmission is started and a file is to be received;
step 2.2: circularly receiving upgrade data sent by an upper computer by FPGA software according to a 1K-Xmodem protocol and storing an array, wherein the upgrade data comprises code data and column check data;
step 2.3: after receiving the EOT signal, the FPGA software calculates the check sum of the array storing the code data according to the columns, compares the check sum with the received column check data one by one, and sends an ACK signal to an upper computer if the check sum is correct, or sends a CAN signal to cancel the upgrading process; the EOT signal represents that the file transmission is finished, and the ACK signal represents that the response is normal;
and step 3: writing data into a FLASH memory:
step 3.1: after the FPGA software checks the code data column correctly, the code data is written into a code storage area in the FLASH memory, wherein the code storage area is the storage area obtained in the step 1.3;
step 3.2: reading the data in the code storage area, comparing the data with the code data stored in the array one by one, and feeding back the success of programming to the upper computer after confirming no error; if the comparison data are not consistent, repeating the step 3.1 until the comparison data are consistent; if the comparison data are not consistent after the repeated setting times, feeding back the upgrading programming failure to the upper computer.
2. The FPGA software online upgrading method based on the 1K-XModem protocol according to claim 1, characterized by comprising the steps of: in step 1.1, whether the FLASH memory is completely erased is determined by reading the data in the FLASH memory and checking whether the data is completely FF.
3. The FPGA software online upgrading method based on the 1K-XModem protocol according to claim 1, characterized by comprising the steps of: in step 1.3, each storage sector in the FLASH memory is read and judged, wherein the non-full-FF storage sector is the storage area of the file programmed in step 1.2.
4. The FPGA software online upgrading method based on the 1K-XModem protocol according to claim 1, characterized by comprising the steps of: and step 1.4, sending the packaged data to an upper computer through an RS422 serial port.
5. The FPGA software online upgrade method based on the 1K-XModem protocol according to claim 1, characterized in that: in step 1.6, one-key programming is carried out through the function of programming files by the flash program in the NIOS II 7.2 environment.
6. The FPGA software online upgrade method based on the 1K-XModem protocol according to claim 1, characterized in that: in step 2, the upgrade data comprises N packets of code data and 1 packet of column check data; the upper computer sends a first packet of data after receiving the NAK signal, the FPGA software judges whether a packet header, a packet number and a packet number complement code are correct or not, and calculates whether a packet checksum is correct or not, if the packet checksum is correct, the current code data are stored into an array, the number of data packets is increased by 1, an ACK signal is sent to the upper computer, the upper computer sends the next packet of data after receiving the ACK signal, and the rest is done by analogy until all the N +1 packets of data are completely transmitted; if any packet is checked to be wrong, CAN cancellation transmission is sent to the upper computer, and the upgrading process is cancelled.
CN202011366224.6A 2020-11-29 2020-11-29 FPGA software online upgrading method based on 1K-XModem protocol Active CN112486515B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011366224.6A CN112486515B (en) 2020-11-29 2020-11-29 FPGA software online upgrading method based on 1K-XModem protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011366224.6A CN112486515B (en) 2020-11-29 2020-11-29 FPGA software online upgrading method based on 1K-XModem protocol

Publications (2)

Publication Number Publication Date
CN112486515A CN112486515A (en) 2021-03-12
CN112486515B true CN112486515B (en) 2022-09-30

Family

ID=74936840

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011366224.6A Active CN112486515B (en) 2020-11-29 2020-11-29 FPGA software online upgrading method based on 1K-XModem protocol

Country Status (1)

Country Link
CN (1) CN112486515B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103136028A (en) * 2013-03-11 2013-06-05 西北工业大学 FLASH memorizer long-distance on-line upgrade method based on field programmable gate array (FPGA)
CN104077166A (en) * 2014-07-10 2014-10-01 西北工业大学 EPCS and EPCQ storer online upgrading method based on IP core in FPGA
WO2016188344A1 (en) * 2015-05-28 2016-12-01 武汉精测电子技术股份有限公司 Soft processor-based image signal source and method for processing image signal
WO2017041567A1 (en) * 2015-09-07 2017-03-16 武汉精测电子技术股份有限公司 Fpga multi-mirror upgrade loading method and device based on soft core processor
CN106598650A (en) * 2016-11-25 2017-04-26 积成电子股份有限公司 Device and method for online upgrade of FPGA program based on fiber communication
CN108874424A (en) * 2018-06-21 2018-11-23 大唐电信(成都)信息技术有限公司 FPGA safety on-line upgrade method based on serial port protocol
CN109857433A (en) * 2019-01-15 2019-06-07 四川虹美智能科技有限公司 A kind of scm software upgrading tool and method
CN111506335A (en) * 2020-04-27 2020-08-07 湖北三江航天红峰控制有限公司 DSP + FPGA-based program online upgrading method and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9043778B2 (en) * 2011-12-01 2015-05-26 Tencent Technology (Shenzhen) Company Limited Method and system for upgrading software

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103136028A (en) * 2013-03-11 2013-06-05 西北工业大学 FLASH memorizer long-distance on-line upgrade method based on field programmable gate array (FPGA)
CN104077166A (en) * 2014-07-10 2014-10-01 西北工业大学 EPCS and EPCQ storer online upgrading method based on IP core in FPGA
WO2016188344A1 (en) * 2015-05-28 2016-12-01 武汉精测电子技术股份有限公司 Soft processor-based image signal source and method for processing image signal
WO2017041567A1 (en) * 2015-09-07 2017-03-16 武汉精测电子技术股份有限公司 Fpga multi-mirror upgrade loading method and device based on soft core processor
CN106598650A (en) * 2016-11-25 2017-04-26 积成电子股份有限公司 Device and method for online upgrade of FPGA program based on fiber communication
CN108874424A (en) * 2018-06-21 2018-11-23 大唐电信(成都)信息技术有限公司 FPGA safety on-line upgrade method based on serial port protocol
CN109857433A (en) * 2019-01-15 2019-06-07 四川虹美智能科技有限公司 A kind of scm software upgrading tool and method
CN111506335A (en) * 2020-04-27 2020-08-07 湖北三江航天红峰控制有限公司 DSP + FPGA-based program online upgrading method and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"The Design and Implication of Multilevel FPGA Upgrade Online";Xiaohui Wang等;《2012 International Conference on Computer Science and Service System》;20121231;第2099-2102页 *
"利用UART对FPGA进行升级的方法";常亮等;《吉林大学学报(自然科学版)》;20200531;第38卷(第3期);第286-290页 *

Also Published As

Publication number Publication date
CN112486515A (en) 2021-03-12

Similar Documents

Publication Publication Date Title
US7237145B2 (en) Fault-tolerant architecture for in-circuit programming
US8612734B2 (en) Method and apparatus for reprogramming applications in embedded devices
CN111104143B (en) Firmware upgrading method and upgrading device
US8601464B2 (en) Memory online update system and method
CN106951253A (en) A kind of embedded firmware on line upgrading method
CN106598654B (en) Method for updating PowerPC mainboard boot chip on line
CN111813428A (en) Method and device for upgrading terminal firmware, electronic equipment and storage medium
CN114281394A (en) Method, system, equipment and medium for fast on-line upgrading program
KR101533813B1 (en) Apparatus and method for controlling power relay assembly
CN112947977A (en) Software online upgrading method and system
US20040107320A1 (en) Control path failover in an automated data storage library
CN113778822A (en) Error correction capability test method and device, readable storage medium and electronic equipment
CN112486515B (en) FPGA software online upgrading method based on 1K-XModem protocol
CN112332902B (en) On-orbit reconstruction system and method for on-satellite autonomous control
CN107479924B (en) Software upgrading verification method based on Android system
CN111966369B (en) Method for manufacturing and verifying off-line burning mirror image of NAND memory
US20050097236A1 (en) HDD Firmware download
US7747911B1 (en) Self verification of non-volatile memory
CN114443175B (en) Startup configuration method for missile-borne FPGA (field programmable Gate array) online upgrading
CN115857983A (en) FPGA remote upgrading method with encryption verification function
CA2420791A1 (en) Method of storing a quantity of data in a target memory location and storage system
CN111124742B (en) Flash data verification method, flash controller, storage medium and device
US11586504B2 (en) Electronic apparatus and boot method thereof
CN113741934A (en) Inverter program upgrading method
CN111158660A (en) Multi-mode satellite-borne software EEPROM on-orbit programming method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant