CN116225502A - Embedded software upgrading method based on memory reconstruction - Google Patents

Embedded software upgrading method based on memory reconstruction Download PDF

Info

Publication number
CN116225502A
CN116225502A CN202211469584.8A CN202211469584A CN116225502A CN 116225502 A CN116225502 A CN 116225502A CN 202211469584 A CN202211469584 A CN 202211469584A CN 116225502 A CN116225502 A CN 116225502A
Authority
CN
China
Prior art keywords
software
upgrade
memory
upgrading
target
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.)
Pending
Application number
CN202211469584.8A
Other languages
Chinese (zh)
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.)
Hubei Institute Of Aerospacecraft
Original Assignee
Hubei Institute Of Aerospacecraft
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 Hubei Institute Of Aerospacecraft filed Critical Hubei Institute Of Aerospacecraft
Priority to CN202211469584.8A priority Critical patent/CN116225502A/en
Publication of CN116225502A publication Critical patent/CN116225502A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses an embedded software upgrading method based on memory reconstruction, wherein the software comprises upgrading software containing erasure function number codes and upgrading target software, and the method comprises the following steps: compiling the recombined upgrade software by using a development tool, replacing the erasure function number index code with an invalid byte, and storing the erasure function number index code for use in upgrading the upgrade target software; and when the software is upgraded, the invalid byte is replaced by the erasure function number index code, and the upgrading software is recovered to upgrade the upgrading target software. The method of the invention realizes normal software upgrade on the premise of eliminating hidden trouble of the traditional upgrade method.

Description

Embedded software upgrading method based on memory reconstruction
Technical Field
The invention belongs to the technical field of aircraft control system software upgrading, and particularly relates to an embedded software upgrading method based on memory reconstruction.
Background
The control software of the aircraft control system, namely the upgrade target software, is solidified in an external nonvolatile memory (external memory) of the embedded chip assembly, after the control system is powered on, the embedded chip guides the control software into an internal volatile memory (internal memory) of the chip from the external memory, and then the whole aircraft control system is controlled to operate according to logic set by the software. In order to facilitate updating and maintaining of weapon system control software, the control software is usually added with an external online upgrading function based on a certain communication mode, so that frequent disassembly of an aircraft control system is avoided, and structural stability is damaged. In a common online upgrading scheme, function codes related to upgrading functions are solidified in an external memory, and are integrally loaded into an internal memory when power is supplied, and when a user needs, connection is established through an external certain communication mode, and the function codes are called to update a control system target code; the function code comprises a software erasing function, and in very special cases, such as power-on voltage-build reset, power-off low power consumption or program abnormal out-of-range of a control system, an operation pointer of an embedded software memory randomly points to the erasing function, so that irreversible erasing damage can be performed on an external memory, and risk hidden danger exists. Therefore, there is a need to develop a safe and reliable method that satisfies the external upgrade functions.
Disclosure of Invention
The invention aims to solve the problem of the hidden danger of the software upgrading risk, namely, the erasing function of the pointer in the memory entering the memory is executed and the erasing damage is carried out on the control system memory due to the abnormal program operation; after this problem has occurred, it is often necessary for an external person to disassemble the aircraft control system and to re-perform the software upgrade via the simulator. In order to eliminate the risk hidden trouble and improve the reliability of the aircraft control software, a software upgrading method based on memory reconstruction is provided.
In order to achieve the above object, the present invention provides the following method:
an embedded software upgrading method based on memory reconstruction, wherein the software comprises upgrading software containing erasure function number codes and upgrading target software, and the method comprises the following steps:
compiling the recombined upgrade software by using a development tool, replacing the erasure function number index code with an invalid byte, and storing the erasure function number index code for use in upgrading the upgrade target software;
and when the software is upgraded, the invalid byte is replaced by the erasure function number index code, and the upgrading software is recovered to upgrade the upgrading target software.
Further, the development tool is utilized to compile the recombined upgrade software, the erasure function number code is replaced by invalid bytes, and the erasure function number code is saved for use when the upgrade target software is upgraded
Included
Compiling an upgrade software source code by a development tool to generate a binary target code containing the erasure function number target code, namely an original target code and a memory allocation file;
and positioning the erasure function number index code data segments according to the memory allocation file, removing the erasure function number index code data segments in the erasure function number index codes, filling invalid bytes to generate a reorganization target code, storing the erasure function number index code data segments, and simultaneously storing memory reconfiguration information, namely the data address and the length of the erasure function number index codes.
Specifically, the development tool includes Code Composer Studio of TI company or Keil of ARM company.
Specifically, the invalid byte includes 0xFF.
Further, when the software is upgraded, the invalid byte is replaced by the erasure function number index code, and the upgrading software is recovered to upgrade the upgrading target software
Included
After the software upgrading process is started, receiving memory reconstruction information and erasing function data segments;
according to the memory reconstruction information, the upgrade software writes the data segment of the erasing function into the memory of the corresponding address, and the erasing function of the upgrade software is recovered;
the upgrade software erases the upgrade target software to be upgraded, writes in new upgrade target software, and completes the software upgrade.
Further, the upgrade software and the upgrade target software are respectively stored in an upgrade software sector and a control soft (i.e., upgrade target software) piece sector of the external memory.
The invention also provides a computer readable storage medium, which comprises a stored program, wherein the program executes the embedded software upgrading method based on memory reconstruction.
The invention also provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the embedded software upgrading method based on memory reconstruction through the computer program.
Compared with the prior art, the technical scheme of the invention is that the software upgrading method based on memory reconstruction, the embedded equipment and the memory are provided, and the external memory comprises an upgrading software storage sector for storing upgrading software reorganization target codes and a control software storage sector for storing control software target codes; the upgrade software target reorganization target code is obtained by reconstructing the original target code removing the erasing function data segment, and when the target code is guided to be written into the memory and runs, the target code does not have an erasing function, so that the hidden danger that a pointer points to the erasing function and causes the damage of an external storage due to risks such as abnormal power failure is eliminated; and simultaneously, when the upgrading process is started, writing the data segment of the erasing function into the corresponding internal memory by injecting the data segment of the erasing function externally, recovering the erasing function and finishing the normal software upgrading process.
In a word, when the aircraft control system software normally operates, the function of erasing functions in the memory is removed, so that the program memory pointer cannot illegally jump to the erasing functions under abnormal conditions, irreversible external memory damage is caused, and potential safety hazards are eliminated; in the process of program upgrading, the erasing function data segment is uploaded through external communication (CAN communication or RS422 communication), the complete memory of the upgrading software is reconstructed, the erasing function is recovered, the control software is upgraded, the erasing function data segment in the memory is removed again after the upgrading is finished, and the safe and reliable power-down process of the control system is ensured. The method of the invention realizes normal software upgrade on the premise of eliminating hidden trouble of the traditional upgrade method.
Drawings
FIG. 1 is a schematic diagram of an upgrade software sector and a control software (i.e., upgrade target software) sector respectively stored in an external memory for upgrade software and upgrade target software according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an upgrade software target code reconfiguration provided in an embodiment of the present invention;
FIG. 3 is a flowchart of a power-on startup of upgrade software according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of memory reconstruction of upgrade software according to an embodiment of the present invention;
FIG. 5 is a flowchart of an upgrade of control software (i.e., upgrade target software) according to an embodiment of the present invention;
fig. 6 is a flowchart of a control software (i.e., upgrade target software) start-up provided in an embodiment of the invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, are intended to fall within the scope of the present invention.
The invention will be described in further detail with reference to the drawings and the detailed description. The following examples are illustrative only and are not to be construed as limiting the invention.
The embedded software upgrading method based on memory reconfiguration includes the upgrading software containing the erasure function number code and the upgrading target software, which are stored in the upgrading software sector and the control soft (i.e. upgrading target software) part sector of the external memory, and includes the following steps:
step S1, utilizing development tools such as Code Composer Studio of TI company or Keil of ARM company, the embodiment uses Code Composer Studio version 3.3 development tools to compile recombined upgrade software, replaces the erasure number index code with invalid bytes, and stores the erasure number index code for use when upgrading the upgrade target software, namely the invention provides a method for splitting and recombining the recombined upgrade software target code:
Included
compiling an upgrade software source code by a development tool to generate a binary target code containing the erasure function number target code, namely an original target code and a memory allocation file;
positioning the erasure function number index code data segments according to the memory allocation file, removing the erasure function number index code data segments in the erasure function number index code, filling invalid bytes to generate a reorganization target code, taking the invalid bytes as 0xFF as an example, storing the erasure function number index code data segments, and simultaneously storing memory reconstruction information, namely the data address and the length of the erasure function number index code;
in particular, the method comprises the steps of,
generating an original guide upgrade software target code with an upgrade function by using a development tool, and simultaneously, storing a memory allocation file used for generating the target code, wherein the memory allocation file stores a global function of software, a variable storage address and a variable length and is stored in an upgrade software sector of an external memory;
inquiring to generate a memory allocation file, positioning the address and the length of a target code corresponding to the erasing function, extracting the corresponding binary data to obtain an erasing function data segment, storing the erasing function data segment in a memory other than an external memory, which can be a ground-end memory, writing the erasing function data segment into the external memory for recovery in the subsequent upgrading process, and simultaneously, replacing the binary data of the erasing function data segment corresponding to the original target code of the upgrading software with null data, namely invalid bytes, and replacing the null data with 0xFF to obtain a recombined target code;
therefore, the recombined target code does not have the function data segment of the erasing function, but other functions are normally reserved at the same time, the normal operation of the starting function of the upgrading software guide control software is not influenced, and the potential safety hazard of damaging the memory under special conditions is eliminated.
The external nonvolatile memory (external memory) required by the embedded software upgrading method based on memory reconstruction provided by the embodiment is used as the external memory of an embedded chip of an aircraft control system (hereinafter collectively referred to as embedded equipment), after the embedded equipment is powered on, the embedded chip guides the upgrading software of the external memory into the internal volatile memory (internal memory) of the chip, if an upgrading command of external communication is not received within 1s, the upgrading software guides the control software of the external memory into the internal memory of the chip, the control software is guided to start, and then the whole aircraft system is controlled to run according to the setting logic of the control software; fig. 1 is a schematic diagram of an external memory provided in this embodiment, and as shown in fig. 1, the external memory includes an upgrade software storage area for storing an upgrade software reorganization target code and a control software storage area for storing a control software target code; for example: the external memory stores upgrade software reorganization target codes in 0-32K, and control software target codes in 32-256K. After the upgrade software reorganization target code is loaded by the embedded device chip, the guiding starting and upgrade functions of the control software are executed.
Fig. 2 is a schematic diagram of reconstruction of an object code of upgrade software provided in an embodiment of the present invention, and as shown in fig. 2, the schematic diagram describes an input of a safe reconstruction of original upgrade software, a process of the reconstruction, and an output obtained by the reconstruction, and the specific steps are as follows:
s000: compiling the upgrade software source code by using a development tool to generate an original target code and a corresponding memory allocation file; for example: for embedded chip TMS320C6713, the original binary object code file and corresponding memory allocation file may be generated using Code Composer Studio compilation by TI corporation.
It should be noted that the original binary object code file contains the data segment of the erase function, and the object code is written into the external memory and directly used, which has a risk hidden danger.
S010: positioning the data address and length of the erasing function through the memory allocation file, processing the original target code, extracting the erasing function data segment, and obtaining the erasing function data segment; meanwhile, original binary data (for example, 0 xFF) is written into a corresponding target code data segment for replacement, so that a recombined target code is obtained; and storing the data address and the length of the erasing function in the target code to obtain the memory reconstruction information.
It should be noted that, the difference between the upgrade software reorganization target code and the original target code is mainly that the binary data segment related to the erasure function in the reorganization target code is filled with invalid bytes, and other data segments remain unchanged, so that when the reorganization target code is imported into the memory, the functions except the erasure function are normal, but the erasure function cannot be invoked normally.
S020: the target code after reconstruction is written into an external memory through an emulator, and the data segment of the erasure function related to reconstruction and the memory reconstruction information are saved.
It should be noted that, the upgrade software storage area of the embedded chip needs to write the reorganization target code through the emulator, and the software upgrade is only aimed at the control software; the function data segment and the memory reconfiguration information are erased, and are used when the control software is upgraded, and can be used for recovering the function erasing function of the upgraded software.
S2, when the software is upgraded, the invalid byte is replaced by the erasure function number index code, and the upgrade software is recovered to upgrade the upgrade target software, namely the invention provides a method for reconstructing the memory of the upgrade software and controlling the safe upgrade of the software:
Included
after the software upgrading process is started, receiving memory reconstruction information and erasing function data segments;
according to the memory reconstruction information, the upgrade software writes the data segment of the erasing function into the memory of the corresponding address, and the erasing function of the upgrade software is recovered;
the upgrade software erases the upgrade target software to be upgraded, writes in new upgrade target software, and completes the software upgrade;
in particular, the method comprises the steps of,
sending a control software upgrading command through external communication, and controlling the software to enter an upgrading process;
after entering the upgrading flow, the software running in the memory does not have the software upgrading function at this time, mainly because the memory area corresponding to the erasing function lacks correct data segments and cannot execute the erasing function;
the data segment of the erasing function is sent through external communication, the upgrade software enters a memory reconstruction process, and the partial data segment is written into a corresponding memory area, so that the upgrade software recovers the erasing function and can enter a software erasing process;
the control software erasing command is sent through external communication, and the upgrade software erases an external memory area corresponding to the control software target code and enters a software writing flow;
the control software target code is sent through external communication, and the upgrade software writes the control software target code into a corresponding external memory area and enters a memory recovery flow;
and sending a memory recovery command through external communication, and restoring the memory area corresponding to the erasing function to ensure that the memory erasing function is removed when the program is powered down.
Fig. 3 is a flowchart of power-on and start-up of upgrade software provided in an embodiment of the present invention, as shown in fig. 3, describing a start-up process of program handling, initializing, upgrading or booting control software after chip power-on, and specifically includes the following steps:
s100, powering on the embedded device, and carrying an upgrade software reorganization target code to an internal memory from an external memory by an embedded chip;
s110, initializing upgrade software and waiting for a software upgrade command sent externally; the initialization comprises chip starting, clock configuration, program variable initialization assignment and the like;
s120, judging whether an online upgrade instruction is received within 1S of a certain power-on time (the time is finished within 1S according to the power-on initialization time requirement of the system, and if so, entering an upgrade flow; if not, entering a control program starting flow.
Fig. 4 is a schematic diagram of memory recovery of upgrade software provided in an embodiment of the present invention, and as shown in fig. 4, the reconstructed schematic diagram describes a specific process of memory recovery of upgrade software, including recovery of an input object, a process after recovery, and a result after recovery, and the specific steps are as follows:
s200: after the upgrading process is started, receiving memory reconstruction information and erasing function data segments through external communication;
s210: according to the memory reconstruction information, the upgrade software writes the data segment of the erasing function into the memory of the corresponding address, and the erasing function of the upgrade software is recovered;
fig. 5 is a control software upgrading flowchart provided in the embodiment of the present invention, as shown in fig. 5, after entering a software upgrading process, a memory reconfiguration command is received, memory recovery of an erasing function is started, an external memory sector of the software is controlled to be erased, a target code of the software is controlled to be written, and the memory of the erasing function is emptied, which specifically includes the following steps:
s300, S200-S210 flow describes an erasure function recovery flow, and mainly aims to recover the erasure function of the upgrade software, so that the external memory is conveniently updated;
s310, controlling the erasure of the software sector, calling the erasure function recovered in the memory, and erasing the external control software storage sector;
s320, after the control software storage sector is erased, receiving an externally transmitted new version control software binary target code, writing the new version control software binary target code into the control software storage sector, and finishing the external control software upgrading work;
s330, the erasing function memory in the internal memory is cleared and restored to a safe state, and the operation is mainly to avoid potential safety hazards caused by abnormal operation of the chip memory when the control system is powered down after the upgrading is completed.
Fig. 6 is a control software start-up flow chart provided in the embodiment of the present invention, as shown in fig. 6, describing a control program start-up flow guided by an upgrade program after a chip is powered on, specifically including the following steps:
s400: the upgrade software carries the control software target code in the external memory to the internal memory;
s410: upgrading the software, checking the memory data of the control software in the internal memory, and after the memory data passes the check, jumping to the Main function address of the control software to start executing the control software; otherwise, the program is suspended, and the exception is fed back.
The invention also provides a computer readable storage medium, which comprises a stored program, wherein the program executes the embedded software upgrading method based on memory reconstruction.
The invention also provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the embedded software upgrading method based on memory reconstruction through the computer program.

Claims (8)

1. An embedded software upgrading method based on memory reconstruction, wherein the software comprises upgrading software containing erasure function number codes and upgrading target software, and the method is characterized by comprising the following steps:
compiling the recombined upgrade software by using a development tool, replacing the erasure function number index code with an invalid byte, and storing the erasure function number index code for use in upgrading the upgrade target software;
and when the software is upgraded, the invalid byte is replaced by the erasure function number index code, and the upgrading software is recovered to upgrade the upgrading target software.
2. The method for upgrading embedded software based on memory reconfiguration of claim 1, wherein the development tool is used to compile the recombined upgrade software, replace the erasure number code with invalid bytes, and save the erasure number code for use in upgrading the upgrade target software
Included
Compiling an upgrade software source code by a development tool to generate a binary target code containing the erasure function number target code, namely an original target code and a memory allocation file;
and positioning the erasure function number index code data segments according to the memory allocation file, removing the erasure function number index code data segments in the erasure function number index codes, filling invalid bytes to generate a reorganization target code, storing the erasure function number index code data segments, and simultaneously storing memory reconfiguration information, namely the data address and the length of the erasure function number index codes.
3. The embedded software upgrade method based on memory reconfiguration of claim 2, wherein the development tool comprises.
4. The embedded software upgrade method based on memory reconstruction as claimed in claim 3, wherein said invalid byte comprises 0xFF.
5. The method for upgrading embedded software based on memory reconstruction according to any one of claims 1-4, wherein said invalid byte is replaced by said erasure function number index code during said software upgrade, and the upgrade software is restored to upgrade the upgrade target software
Included
After the software upgrading process is started, receiving memory reconstruction information and erasing function data segments;
according to the memory reconstruction information, the upgrade software writes the data segment of the erasing function into the memory of the corresponding address, and the erasing function of the upgrade software is recovered;
the upgrade software erases the upgrade target software to be upgraded, writes in new upgrade target software, and completes the software upgrade.
6. The embedded software upgrading method based on memory reconstruction according to any one of claims 1-4, wherein the upgrading software and the upgrading target software are respectively stored in an upgrading software sector and a control software sector of an external memory.
7. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored program, wherein the program when run performs the method of any of the preceding claims 1 to 6.
8. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 6 by means of the computer program.
CN202211469584.8A 2022-11-22 2022-11-22 Embedded software upgrading method based on memory reconstruction Pending CN116225502A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211469584.8A CN116225502A (en) 2022-11-22 2022-11-22 Embedded software upgrading method based on memory reconstruction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211469584.8A CN116225502A (en) 2022-11-22 2022-11-22 Embedded software upgrading method based on memory reconstruction

Publications (1)

Publication Number Publication Date
CN116225502A true CN116225502A (en) 2023-06-06

Family

ID=86583147

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211469584.8A Pending CN116225502A (en) 2022-11-22 2022-11-22 Embedded software upgrading method based on memory reconstruction

Country Status (1)

Country Link
CN (1) CN116225502A (en)

Similar Documents

Publication Publication Date Title
KR100987628B1 (en) Method for updating firmware in embedded controller and medium recorded update firmware
CN110413230B (en) Embedded system construction method and storage medium
CN110333891A (en) The method of enhanced OTA upgrading based on Internet of Things
CN105808292A (en) Firmware upgrade method of embedded terminal device
CN104239082A (en) Hot patching implementation method of embedded system
CN107566169B (en) Firmware upgrading method based on openwrt and router
CN106990985A (en) Apparatus and method based on BMC renewals and standby system UEFI firmwares
US9043680B2 (en) Method and system for in-place updating content stored in a storage device
CN103136002A (en) Automatic upgrade control method based on UBoot instruction and system
CN115718610A (en) Reliable method for updating application program of single chip microcomputer
CN108694052B (en) Firmware upgrading method, firmware upgrading device and firmware upgrading system
US20080172584A1 (en) Method and system for in-place updating content stored in a storage device
WO2022227409A1 (en) Embedded terminal remote software updating method
CN116302011B (en) Firmware upgrading method for cable monitoring equipment
CN117608619A (en) Updating method, updating system, electronic device and storage medium of UEFI BIOS firmware
KR20180023575A (en) Firmware auto updating method and computer readable recording medium writing firmware auto updating method
CN116225502A (en) Embedded software upgrading method based on memory reconstruction
US11513792B2 (en) Tracking history of firmware program updates
CN102467522B (en) Self-programming method and device of file system based on NAND flash
CN111045709B (en) Firmware upgrading method and firmware upgrading device
CN102945190B (en) Utilize card to the method that still can continue after being interrupted in embedded device Code renewal process to upgrade
CN114996717A (en) Upgrade program design method for preventing error erasure
CN111290765B (en) Firmware quick burning method, system and storage medium
CN113778485A (en) System operation method and device of electronic chip, electronic chip and storage medium
CN111309350A (en) Bootload updating 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