[go: up one dir, main page]

CN108491197A - A kind of in-orbit maintenance injection code generating method of the spacecraft compiled based on same platform combination - Google Patents

A kind of in-orbit maintenance injection code generating method of the spacecraft compiled based on same platform combination Download PDF

Info

Publication number
CN108491197A
CN108491197A CN201810148099.8A CN201810148099A CN108491197A CN 108491197 A CN108491197 A CN 108491197A CN 201810148099 A CN201810148099 A CN 201810148099A CN 108491197 A CN108491197 A CN 108491197A
Authority
CN
China
Prior art keywords
file
orbit
format
spacecraft
link
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.)
Granted
Application number
CN201810148099.8A
Other languages
Chinese (zh)
Other versions
CN108491197B (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.)
Beijing Institute of Control Engineering
Original Assignee
Beijing Institute of Control Engineering
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 Beijing Institute of Control Engineering filed Critical Beijing Institute of Control Engineering
Priority to CN201810148099.8A priority Critical patent/CN108491197B/en
Publication of CN108491197A publication Critical patent/CN108491197A/en
Application granted granted Critical
Publication of CN108491197B publication Critical patent/CN108491197B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/37Compiler construction; Parser generation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

一种基于同平台组合编译的航天器在轨维护注入码生成方法,(1)采用ERC32编译系统还原航天器在轨运行软件的状态,通过一次链接生成a.out格式在轨状态目标文件;(2)使用ERC32编译系统对在轨维护源代码进行预处理和编译,生成相应的汇编码目标文件;(3)使用RCC编译系统对汇编码目标文件进行汇编处理,生成待上传中间目标文件;(4)将在轨状态目标文件转换为ELF格式的在轨状态中间目标文件;(5)精简在轨状态中间目标文件;(6)新建链接脚本文件;(7)生成新的可执行目标文件;(8)通过RCC编译系统将新的可执行目标文件转换成链接指令文件或BIN文件,直接提取指定起始地址的注入码指令,从而完成航天器在轨维护注入码的生成。

A method for generating injection codes for spacecraft on-orbit maintenance based on combined compilation on the same platform, (1) adopting the ERC32 compilation system to restore the status of the spacecraft’s on-orbit operating software, and generating a.out format on-orbit status object files through one link; ( 2) Use the ERC32 compilation system to preprocess and compile the on-orbit maintenance source code to generate the corresponding assembly code target file; (3) use the RCC compilation system to assemble the assembly code target file to generate an intermediate target file to be uploaded; ( 4) converting the on-orbit state object file into an on-orbit state intermediate object file in ELF format; (5) streamlining the on-orbit state intermediate object file; (6) creating a new link script file; (7) generating a new executable object file; (8) Convert the new executable object file into a link instruction file or a BIN file through the RCC compilation system, and directly extract the injection code instruction specifying the starting address, thereby completing the generation of the spacecraft maintenance injection code.

Description

一种基于同平台组合编译的航天器在轨维护注入码生成方法A Method of Injection Code Generation for Spacecraft On-orbit Maintenance Based on Compilation on the Same Platform

技术领域technical field

本发明是属于航天器在轨维护领域,针对但不限于sparc体系架构的航天器软件在轨维护注入码的生成方法。The invention belongs to the field of on-orbit maintenance of spacecraft, and is aimed at but not limited to a method for generating injection codes for on-orbit maintenance of spacecraft software in a sparc architecture.

背景技术Background technique

航天器软件的在轨维护能力是保证航天器长寿命不可或缺的手段,与硬件的冗余备份相比,这种方法更经济更灵活。通过软件在轨维护来提高航天器在轨运行的长寿命和高可靠性的方法越来越受到重视。The on-orbit maintenance capability of the spacecraft software is an indispensable means to ensure the long life of the spacecraft. Compared with the redundant backup of hardware, this method is more economical and more flexible. The method of improving the long life and high reliability of spacecraft on-orbit operation through software on-orbit maintenance has been paid more and more attention.

当前我国航天器在轨运行的处理器平台主体是sparc系列体系架构,具体来说,主要是sparc V7体系架构和sparc V8体系架构。航天器在轨运行维护的主要手段是实施软件的在轨维护。航天器在轨软件的维护,主要是基于钩子函数的方法,即在可写存储注入区上注一段在轨维护注入码,当在轨维护使能时,钩子函数通过指定的地址跳转到注入区执行,执行完毕后再返回到原在轨软件继续执行。这种应用场景下,在轨维护注入码的生成是软件在轨维护的关键环节,同时也是一件比较困难的工作。由于sparc V8架构处理器平台采用的是RCC(RTEMS Cross Compilation System)交叉编译器,RCC编译器生成的目标文件为ELF格式,且支持基于“section”属性的编译链接,便于通过“section”属性设定注入区起始地址,利用二次链接的方式(已申请专利:一种基于二次链接的航天器在轨维护注入码生成方法,201710476446.5)实现在轨维护注入码的生成。而sparc V7架构处理器平台一般采用的是ERC32交叉编译器,该编译器系统生成的目标文件为a.out格式,且不支持基于“section”属性的编译链接,无法直接采用二次链接的方式实现在轨维护注入码的生成。之前面向采用ERC32交叉编译器的航天器软件,其在轨维护注入码的生成主要是通过对原在轨软件和在轨维护软件编译结果文件进行解析,梳理出在轨维护指令码中所有需要重定位的信息,并完成重定位。该过程相对复杂,一方面要求熟练掌握编译结果文件格式,能够梳理出所有的重定位信息;另一方面要求对指令规则集有较深入的了解,能够对在轨维护指令码实现重定位。At present, the main processor platform of my country's spacecraft in orbit is the sparc series architecture, specifically, the sparc V7 architecture and the sparc V8 architecture. The main means of on-orbit operation and maintenance of spacecraft is to implement software on-orbit maintenance. The maintenance of the spacecraft’s on-orbit software is mainly based on the hook function method, that is, an on-orbit maintenance injection code is injected on the writable storage injection area. When the on-orbit maintenance is enabled, the hook function jumps to the injection through the specified address. After execution, return to the original on-orbit software to continue execution. In this application scenario, the generation of on-orbit maintenance injection code is a key link in software on-orbit maintenance, and it is also a relatively difficult task. Since the sparc V8 architecture processor platform uses the RCC (RTEMS Cross Compilation System) cross compiler, the object file generated by the RCC compiler is in ELF format, and supports compilation and linking based on the "section" attribute, which is convenient for setting the "section" attribute. Set the starting address of the injection area, and use the method of secondary linking (patent applied for: a method for generating injection codes for spacecraft on-orbit maintenance based on secondary links, 201710476446.5) to realize the generation of on-orbit maintenance injection codes. The sparc V7 architecture processor platform generally uses the ERC32 cross compiler. The object file generated by the compiler system is in the a.out format, and does not support compilation links based on the "section" attribute, and cannot directly use the secondary link method. Realize the generation of injection code for on-orbit maintenance. Previously, for the spacecraft software using the ERC32 cross-compiler, the generation of the on-orbit maintenance injection code was mainly by analyzing the original on-orbit software and the compilation result files of the on-orbit maintenance software, and sorting out all the on-orbit maintenance instruction codes that need to be re-written. Locate the information and complete the relocation. This process is relatively complicated. On the one hand, it requires proficiency in the file format of the compilation result and the ability to sort out all relocation information; on the other hand, it requires a deeper understanding of the command rule set and the ability to relocate the on-orbit maintenance command code.

发明内容Contents of the invention

本发明的技术解决问题是:克服现有技术的不足,提供一种基于同平台组合编译的航天器在轨维护注入码生成方法。The technical problem of the present invention is to overcome the deficiencies of the prior art and provide a method for generating injection codes for on-orbit maintenance of spacecraft based on the same platform combination compilation.

本发明的技术解决方案是:一种基于同平台组合编译的航天器在轨维护注入码生成方法,通过下述方式实现:The technical solution of the present invention is: a method for generating injection codes for on-orbit maintenance of spacecraft based on the combined compilation of the same platform, which is realized in the following manner:

(1)采用ERC32编译系统还原航天器在轨运行软件的状态,通过一次链接生成a.out格式在轨状态目标文件;(1) Use the ERC32 compilation system to restore the status of the spacecraft’s on-orbit software, and generate the a.out format on-orbit status object file through a link;

(2)编写在轨维护源代码,使用ERC32编译系统对在轨维护源代码进行预处理和编译,生成相应的汇编码目标文件;(2) Write the on-orbit maintenance source code, use the ERC32 compilation system to preprocess and compile the on-orbit maintenance source code, and generate the corresponding assembly code target file;

(3)使用RCC编译系统对步骤(2)中生成的汇编码目标文件进行汇编处理,生成待上传中间目标文件;(3) use the RCC compilation system to assemble the assembly code target file generated in step (2), and generate an intermediate target file to be uploaded;

(4)将步骤(1)中生成的a.out格式在轨状态目标文件,经过目标文件格式转换,转换为ELF格式的在轨状态中间目标文件;(4) the a.out format on-track state target file generated in the step (1) is converted into the on-track state intermediate target file of the ELF format through target file format conversion;

(5)将步骤(4)中生成的ELF格式的在轨状态中间目标文件进行精简,除去与链接重定位过程无关的信息;(5) streamline the on-orbit state intermediate object file of the ELF format generated in step (4), remove information irrelevant to the link relocation process;

(6)新建链接脚本文件;(6) Create a link script file;

(7)基于步骤(6)建立的链接脚本文件,使用RCC编译系统,对步骤(5)所述精简后的在轨状态中间目标文件、待上传中间目标文件以及相应的静态库文件进行二次链接,生成新的可执行目标文件;(7) Based on the link script file established in step (6), use the RCC compilation system to perform a secondary process on the simplified in-orbit state intermediate object file, the intermediate object file to be uploaded, and the corresponding static library file described in step (5). link to generate a new executable object file;

(8)通过RCC编译系统将步骤(7)中生成的新的可执行目标文件转换成链接指令文件或BIN文件,从链接指令文件或BIN文件中直接提取指定起始地址的注入码指令,从而完成航天器在轨维护注入码的生成。(8) convert the new executable target file generated in step (7) into a link instruction file or a BIN file by the RCC compilation system, and directly extract the injection code instruction of the specified starting address from the link instruction file or the BIN file, thereby Complete the generation of injection codes for spacecraft on-orbit maintenance.

进一步的,步骤(1)中通过使用与航天器原在轨软件相同的sparc平台ERC32编译系统,对原在轨软件源文件目录进行编译链接,生成a.out格式在轨状态目标文件。Further, in step (1), by using the same sparc platform ERC32 compilation system as the original on-orbit software of the spacecraft, the original on-orbit software source file directory is compiled and linked to generate the a.out format on-orbit status target file.

进一步的,在轨维护源代码存储路径是在航天器原在轨软件的源文件目录下新建的在轨维护的注入代码源文件中。Further, the storage path of the on-orbit maintenance source code is in the injected code source file of the new on-orbit maintenance under the original on-orbit software source file directory of the spacecraft.

进一步的,所使用的RCC编译系统和ERC32编译系统同属于sparc平台下的编译系统,并且ERC32编译系统编译生成的指令集ΦERC32是RCC编译系统编译生成的指令集ΦRCC的子集,即 Further, the RCC compilation system and the ERC32 compilation system used belong to the compilation system under the sparc platform, and the instruction set Φ ERC32 compiled by the ERC32 compilation system is a subset of the instruction set Φ RCC compiled by the RCC compilation system, namely

进一步的,所述步骤(4)将步骤(1)中生成的a.out格式在轨状态目标文件,利用RCC编译系统自带的目标文件格式转换工具,将a.out格式在轨状态目标文件转换为ELF格式的在轨状态中间目标文件。Further, the step (4) converts the a.out format on-track status target file generated in step (1) to the a.out format on-track status target file by using the target file format conversion tool that comes with the RCC compilation system. Convert to an in-orbit state intermediate object file in ELF format.

进一步的,所述步骤(5)将步骤(4)中生成的ELF格式的在轨状态中间目标文件,利用RCC编译系统自带的文件裁剪工具strip,对ELF格式的在轨状态中间目标文件进行精简,除去与链接重定位过程无关的信息。Further, described step (5) utilizes the on-track state intermediate object file of the ELF format generated in step (4), utilizes the file cutting tool strip that the RCC compiling system carries, carries out the on-track state intermediate object file of the ELF format Compact, removing information not relevant to the link relocation process.

进一步的,所述步骤(6)新建链接脚本文件,具体为:在脚本文件SECTIONS一节中,依据原在轨软件的输出段的地址设置,新建第一输出段空间,将所述新建的第一输出段空间的起始地址设置为原在轨软件的输出段的起始地址,将所述新建的第一输出段空间的输入段元素设置为一次链接后经步骤(5)文件格式精简后生成的精简后的在轨状态中间目标文件,再依据预先设定的注入区起始地址,新建第二输出段空间,将所述第二输出段空间的起始地址设置为预先设定的注入区起始地址,将所述第二输出段空间的输入段元素设置为在轨维护软件经同平台组合编译后生成的待上传中间目标文件。Further, described step (6) new link script file is specifically: in the section of script file SECTIONS, according to the address setting of the output section of the original in-track software, create a new first output section space, and create the first output section space of the newly created section The initial address of an output section space is set to the initial address of the output section of the original in-track software, and the input section element of the first output section space of the described new creation is set to a link after being simplified through step (5) file format The generated streamlined in-track state intermediate object file, and then according to the preset start address of the injection area, create a new second output segment space, and set the start address of the second output segment space to the preset injection area The starting address of the area, and the input section element of the second output section space is set as an intermediate target file to be uploaded generated by the on-orbit maintenance software after being combined and compiled on the same platform.

进一步的,所述在轨状态目标文件为a.out文件格式的可执行目标文件,所述在轨状态中间目标文件、所述精简后的在轨状态中间目标文件、所述待上传中间目标文件和所述新的可执行目标文件均为ELF文件格式。Further, the on-track status target file is an executable target file in a.out file format, the on-track status intermediate target file, the simplified on-track status intermediate target file, and the to-be-uploaded intermediate target file and the new executable object files are in ELF file format.

进一步的,通过RCC编译系统,使用objdump命令将步骤(7)中生成的ELF格式的新的可执行目标文件a.out转换成扩展名为.lst的链接指令文件,或者使用objcopy命令将步骤(7)中生成的ELF格式的新的可执行目标文件a.out转换成扩展名为.bin的BIN文件。Further, through the RCC compilation system, use the objdump command to convert the new executable object file a.out in ELF format generated in step (7) into a link instruction file with the extension .lst, or use the objcopy command to convert the step ( 7) The new executable object file a.out of the ELF format that generates in the conversion is the BIN file that extension is called .bin.

进一步的,航天器在轨运行软件以及在轨维护源代码均使用C语言编写。Furthermore, the source codes of the spacecraft’s on-orbit operation software and on-orbit maintenance are written in C language.

本发明与现有技术相比有益效果为:Compared with the prior art, the present invention has beneficial effects as follows:

(1)基于同平台组合编译的航天器在轨维护注入码生成方法,通过综合利用sparc平台ERC32和RCC两个编译系统进行组合编译,能够在保证所生成目标文件的指令集和符号信息一致性的前提下,实现在轨维护软件注入码相对原在轨软件的地址信息重定位,大大提高了在轨维护注入码生成的效率和正确性。(1) The spacecraft on-orbit maintenance injection code generation method based on the combined compilation of the same platform, through the comprehensive utilization of the sparc platform ERC32 and RCC two compilation systems for combined compilation, can ensure the consistency of the instruction set and symbol information of the generated target files Under the premise of this, the on-orbit maintenance software injection code is relocated relative to the address information of the original on-orbit software, which greatly improves the efficiency and correctness of the on-orbit maintenance injection code generation.

(2)基于同平台组合编译的航天器在轨维护注入码生成方法,主要是面向采用sparc平台ERC32编译系统的在轨航天器软件,生成在轨维护注入码,相较于其原有文件解析方式生成注入码的方法,消除了新增全局变量、新增库函数调用等多方面的在轨维护代码编写限制要求,大大提高了在轨维护源代码的实现效率。(2) The spacecraft on-orbit maintenance injection code generation method based on the combined compilation of the same platform is mainly for the on-orbit spacecraft software that uses the ERC32 compilation system of the sparc platform to generate the on-orbit maintenance injection code. Compared with its original file analysis The method of generating injection code in this way eliminates the restrictions on the writing of on-orbit maintenance codes such as new global variables and new library function calls, and greatly improves the implementation efficiency of on-orbit maintenance source codes.

(3)基于同平台组合编译的航天器在轨维护注入码生成方法,通过对ELF格式的在轨状态中间目标文件进行裁剪,除去了与链接重定位过程无关的信息,实现了链接过程中轻量级的目标文件,扩展了二次链接方式下航天器软件在轨维护重定位有效的地址空间。(3) The spacecraft on-orbit maintenance injection code generation method based on the combined compilation of the same platform, by cutting the on-orbit state intermediate object file in ELF format, the information irrelevant to the link relocation process is removed, and the link process is realized. The magnitude of the target file expands the effective address space for the on-orbit maintenance and relocation of the spacecraft software in the secondary link mode.

(4)该方法已经在多个面向采用sparc平台ERC32编译系统的在轨航天器软件的在轨维护实现中得到了应用,经工程实践验证了该方法的可行性和有效性,提高了在轨航天器软件的可维护性,为后续航天器软件的研制,提供了新的在轨维护实现方法。(4) This method has been applied in the implementation of on-orbit maintenance for several on-orbit spacecraft software using the sparc platform ERC32 compilation system. The feasibility and effectiveness of this method have been verified by engineering practice, and the on-orbit The maintainability of spacecraft software provides a new method for realizing on-orbit maintenance for the development of subsequent spacecraft software.

附图说明Description of drawings

图1为本发明流程图。Fig. 1 is the flow chart of the present invention.

具体实施方式Detailed ways

下面结合附图及实例对本发明作详细说明。The present invention will be described in detail below in conjunction with the accompanying drawings and examples.

本发明的一种基于同平台组合编译的航天器在轨维护注入码生成方法,主要是面向但不限于采用sparc平台ERC32编译系统的在轨航天器软件。内容包括:依据航天器软件在轨维护任务需求,编写相应的在轨维护源代码(C语言),利用同一sparc平台下的两种编译器系统:ERC32编译系统和RCC编译系统,对在轨维护源代码进行组合编译生成待上传中间目标文件,该中间目标文件与原在轨软件编译链接后的可执行目标文件进行二次链接,从而完成航天器在轨维护注入码的生成。A spacecraft on-orbit maintenance injection code generation method based on same-platform combined compilation of the present invention is mainly oriented to, but not limited to, on-orbit spacecraft software using the sparc platform ERC32 compilation system. The content includes: according to the requirements of the spacecraft software on-orbit maintenance tasks, write the corresponding on-orbit maintenance source code (C language), use two compiler systems under the same sparc platform: ERC32 compilation system and RCC compilation system, for on-orbit maintenance The source code is combined and compiled to generate an intermediate object file to be uploaded, and the intermediate object file is relinked with the executable object file compiled and linked to the original on-orbit software, thereby completing the generation of the spacecraft on-orbit maintenance injection code.

本发明的实现方法如下:Implementation method of the present invention is as follows:

(1)采用ERC32编译系统还原航天器在轨运行软件的状态,通过一次链接生成a.out格式在轨状态目标文件;(1) Use the ERC32 compilation system to restore the status of the spacecraft’s on-orbit software, and generate the a.out format on-orbit status object file through a link;

具体为:使用sparc平台ERC32编译系统对航天器在轨软件的源文件目录进行编译并实现一次链接,所述ERC32编译系统和航天器在轨软件的源文件目录要与航天器在轨软件可执行代码生成时的状态保持一致。Specifically: use the ERC32 compilation system of the sparc platform to compile the source file directory of the spacecraft on-orbit software and realize a link. The ERC32 compilation system and the source file directory of the spacecraft on-orbit software must be executable with the spacecraft on-orbit software The state at the time of code generation remains consistent.

(2)编写在轨维护源代码;(2) Write source code for on-orbit maintenance;

具体为:在航天器在轨软件的源文件目录下,新建扩展名为.c的在轨维护代码源文件,并依据航天器软件在轨维护任务需求编写相应的在轨维护源代码及所需头文件。Specifically: in the source file directory of the spacecraft’s on-orbit software, create a new on-orbit maintenance code source file with the extension .c, and write the corresponding on-orbit maintenance source code and required head File.

(3)使用ERC32编译系统对步骤(2)中编写的在轨维护源代码进行单独预处理和编译,生成相应的汇编码目标文件,汇编码目标文件是以.s或者.S为扩展名;(3) Use the ERC32 compilation system to preprocess and compile the on-orbit maintenance source code written in step (2) separately, and generate the corresponding assembly code target file. The assembly code target file has the extension of .s or .S;

(4)使用RCC编译系统对步骤(3)中生成的汇编码目标文件进行汇编处理,生成待上传中间目标文件,待上传中间目标文件是扩展名为.o的ELF目标文件格式;(4) use the RCC compilation system to assemble the assembly code object file generated in step (3), generate an intermediate object file to be uploaded, and the intermediate object file to be uploaded is the ELF object file format with an extension of .o;

(5)将步骤(1)中生成的a.out格式在轨状态目标文件,通过目标文件格式转换,转换为ELF格式的在轨状态中间目标文件,目标文件格式转换工具可以采用RCC编译系统自带的目标文件格式转换工具objcopy来实现;(5) Convert the on-orbit state object file in the a.out format generated in step (1) to an on-orbit state intermediate object file in ELF format through object file format conversion. The object file format conversion tool can automatically use the RCC compilation system It is realized by the object file format conversion tool objcopy;

(6)将步骤(5)生成的ELF格式的在轨状态中间目标文件进行裁剪,除去与链接重定位过程无关的符号信息、调试信息和字符串信息等,以便实现链接过程中轻量级的目标文件,更好的扩展有效注入区地址空间,在轨状态中间目标文件裁剪可以采用RCC编译系统自带的strip工具来实现;(6) Cut the on-orbit intermediate object file in ELF format generated in step (5), and remove symbol information, debugging information, and character string information that are not related to the link relocation process, so as to realize lightweight in the link process Target files, to better expand the address space of the effective injection area, and the clipping of target files in the middle of the track state can be realized by using the strip tool that comes with the RCC compilation system;

(7)新建链接脚本文件;(7) Create a link script file;

具体为:新建一个新的链接脚本文件,在新的链接脚本文件SECTIONS一节中,依据航天器原在轨软件的输出段的地址设置,新建第一输出段空间,将所述新建的第一输出段空间的起始地址设置为航天器原在轨软件的输出段的起始地址,将所述新建的第一输出段空间的输入段元素设置为一次链接后经步骤(6)文件裁剪后生成的精简后的在轨状态中间目标文件,再依据预先设定的注入区起始地址,新建第二输出段空间,将所述第二输出段空间的起始地址设置为预先设定的注入区起始地址,将所述第二输出段空间的输入段元素设置为在轨维护软件经同平台组合编译后生成的待上传中间目标文件。Specifically: create a new link script file, in the section of the new link script file SECTIONS, according to the address setting of the output section of the original in-orbit software of the spacecraft, create a new first output section space, and place the newly created first The initial address of the output section space is set to the initial address of the output section of the spacecraft's former on-orbit software, and the input section element of the first output section space of the new creation is set to a link after the step (6) file is clipped The generated streamlined in-track state intermediate object file, and then according to the preset start address of the injection area, create a new second output segment space, and set the start address of the second output segment space to the preset injection area The starting address of the area, and the input section element of the second output section space is set as an intermediate target file to be uploaded generated by the on-orbit maintenance software after being combined and compiled on the same platform.

(8)基于步骤(7)建立的链接脚本文件,使用RCC编译系统,对所述精简后的在轨状态中间目标文件、待上传中间目标文件以及相应的静态库文件进行二次链接,生成ELF格式的新的可执行目标文件a.out;(8) Based on the link script file established in step (7), use the RCC compilation system to perform secondary linking on the simplified in-orbit state intermediate object file, the intermediate object file to be uploaded, and the corresponding static library file to generate ELF A new executable object file in the format a.out;

(9)通过RCC编译系统,使用objdump命令将步骤(8)中生成的ELF格式的新的可执行目标文件a.out转换成扩展名为.lst的链接指令文件,或者使用objcopy命令将步骤(8)中生成的ELF格式的新的可执行目标文件a.out转换成扩展名为.bin的BIN文件,从上述生成的链接指令文件或BIN文件中直接提取指定起始地址的注入码指令,从而完成航天器在轨维护注入码的生成。(9) Through the RCC compilation system, use the objdump command to convert the new executable object file a.out in ELF format generated in step (8) into a link instruction file with an extension of .lst, or use the objcopy command to convert the step ( 8) The new executable object file a.out in ELF format generated in 8) is converted into a BIN file with an extension of .bin, and the injection code instruction specifying the starting address is directly extracted from the link instruction file or BIN file generated above, In this way, the generation of injection codes for on-orbit maintenance of the spacecraft is completed.

实施例:Example:

(1)在确保航天器在轨软件的ERC32编译系统、源文件编译目录与航天器在轨软件可执行代码生成时状态一致的前提下,使用ERC32编译器sparc-rtems-gcc,通过makefile文件,对航天器在轨软件的源文件编译目录进行编译链接,生成a.out文件格式的可执行目标文件a.out。(1) On the premise of ensuring that the ERC32 compilation system and source file compilation directory of the spacecraft on-orbit software are consistent with the state of the spacecraft on-orbit software when the executable code is generated, use the ERC32 compiler sparc-rtems-gcc, through the makefile file, The source file compilation directory of the spacecraft on-orbit software is compiled and linked to generate an executable object file a.out in the a.out file format.

(2)在航天器在轨软件的源文件目录下,新建在轨维护的注入代码源文件task_inject.c,并在task_inject.c源文件中编写在轨维护源代码,如表1所示:(2) In the source file directory of the spacecraft’s on-orbit software, create a new injection code source file task_inject.c for on-orbit maintenance, and write the on-orbit maintenance source code in the task_inject.c source file, as shown in Table 1:

表1在轨维护源代码示例Table 1 Example of source code for on-orbit maintenance

(3)使用ERC32编译器sparc-rtems-gcc对在轨维护源代码task_inject.c进行单独预处理和编译,生成相应的汇编码目标文件task_inject.s。(3) Use the ERC32 compiler sparc-rtems-gcc to preprocess and compile the on-orbit maintenance source code task_inject.c separately, and generate the corresponding assembly code object file task_inject.s.

(4)使用RCC编译器sparc-rtems-gcc对步骤(3)中生成的汇编码目标文件task_inject.s进行汇编处理,生成待上传中间目标文件task_inject.o;(4) Use the RCC compiler sparc-rtems-gcc to assemble the assembly code target file task_inject.s generated in step (3), and generate the intermediate target file task_inject.o to be uploaded;

(5)使用RCC编译器目标文件格式转换工具sparc-rtems-objcopy将步骤(1)中生成的a.out文件格式的可执行目标文件a.out转换为ELF格式的在轨状态中间目标文件a.o。(5) Use the RCC compiler object file format conversion tool sparc-rtems-objcopy to convert the executable object file a.out in the a.out file format generated in step (1) into the on-orbit state intermediate object file a.o in ELF format .

(6)使用RCC编译器文件裁剪工具sparc-rtems-strip将步骤(5)中生成的ELF格式的在轨状态中间目标文件a.o进行裁剪,除去与链接重定位过程无关的符号信息、调试信息和字符串信息,生成精简后的在轨状态中间目标文件a.o。(6) Use the RCC compiler file clipping tool sparc-rtems-strip to clip the in-track state intermediate object file a.o in ELF format generated in step (5), and remove symbolic information, debugging information and String information, generate the streamlined on-orbit intermediate object file a.o.

(7)新建链接脚本文件linkobsm作为新的链接脚本文件,如表2所示:(7) Create a new link script file linkobsm as a new link script file, as shown in Table 2:

表2二次链接脚本文件示例Table 2 Secondary link script file example

(8)基于新的链接脚本文件linkobsm,使用RCC编译器sparc-rtems-gcc,对精简后的在轨状态中间目标文件a.o、待上传中间目标文件task_inject.o以及数学库等静态库文件进行链接,生成新的链接后的ELF格式可执行目标文件a.out;(8) Based on the new link script file linkobsm, use the RCC compiler sparc-rtems-gcc to link the simplified in-orbit intermediate object file a.o, the intermediate object file task_inject.o to be uploaded, and the static library files such as the math library , generate a new linked ELF format executable object file a.out;

(9)使用RCC编译系统的sparc-rtems-objdump命令将步骤(8)生成的新的链接后的ELF格式可执行目标文件a.out转换成扩展名为.lst的链接指令文件boot.lst,或者使用RCC编译系统的sparc-rtems-objcopy命令将步骤(8)生成的新的链接后的ELF格式可执行目标文件a.out转换成扩展名为.bin的BIN文件boot.bin。从上述生成的文件boot.lst或boot.bin文件中直接提取起始地址为0x21a0000的注入码指令,从而完成航天器在轨维护注入码的生成。(9) Use the sparc-rtems-objdump command of the RCC compilation system to convert the new linked ELF format executable object file a.out generated by step (8) into a link instruction file boot.lst with an extension of .lst, Or use the sparc-rtems-objcopy command of the RCC compilation system to convert the new linked ELF format executable object file a.out generated in step (8) into a BIN file boot.bin with an extension of .bin. Directly extract the injection code instruction whose starting address is 0x21a0000 from the above-mentioned generated file boot.lst or boot.bin file, so as to complete the generation of the spacecraft maintenance injection code.

本实施例技术方案通过sparc平台的两种编译系统:ERC32编译系统和RCC编译系统,对在轨维护源代码进行组合编译,通过与原在轨软件编译后的可执行目标文件进行二次链接,自动实现在轨维护软件注入码相对原在轨软件的地址信息重定位,大大提高了在轨维护注入码生成的效率和正确性。The technical solution of this embodiment uses two compilation systems of the sparc platform: the ERC32 compilation system and the RCC compilation system, to combine and compile the on-orbit maintenance source code, and perform secondary linking with the executable target file compiled by the original on-orbit software. The on-orbit maintenance software injection code is automatically relocated relative to the address information of the original on-orbit software, which greatly improves the efficiency and correctness of the on-orbit maintenance injection code generation.

本发明未详细说明部分属于本领域技术人员公知常识。Parts not described in detail in the present invention belong to the common knowledge of those skilled in the art.

Claims (10)

1.一种基于同平台组合编译的航天器在轨维护注入码生成方法,其特征在于通过下述方式实现:1. A spacecraft on-orbit maintenance injection code generation method based on the same platform combination compilation is characterized in that it is realized in the following manner: (1)采用ERC32编译系统还原航天器在轨运行软件的状态,通过一次链接生成a.out格式在轨状态目标文件;(1) Use the ERC32 compilation system to restore the status of the spacecraft’s on-orbit software, and generate the a.out format on-orbit status object file through a link; (2)编写在轨维护源代码,使用ERC32编译系统对在轨维护源代码进行预处理和编译,生成相应的汇编码目标文件;(2) Write the on-orbit maintenance source code, use the ERC32 compilation system to preprocess and compile the on-orbit maintenance source code, and generate the corresponding assembly code target file; (3)使用RCC编译系统对步骤(2)中生成的汇编码目标文件进行汇编处理,生成待上传中间目标文件;(3) use the RCC compilation system to assemble the assembly code target file generated in step (2), and generate an intermediate target file to be uploaded; (4)将步骤(1)中生成的a.out格式在轨状态目标文件,经过目标文件格式转换,转换为ELF格式的在轨状态中间目标文件;(4) the a.out format on-track state target file generated in the step (1) is converted into the on-track state intermediate target file of the ELF format through target file format conversion; (5)将步骤(4)中生成的ELF格式的在轨状态中间目标文件进行精简,除去与链接重定位过程无关的信息;(5) streamline the on-orbit state intermediate object file of the ELF format generated in step (4), remove information irrelevant to the link relocation process; (6)新建链接脚本文件;(6) Create a link script file; (7)基于步骤(6)建立的链接脚本文件,使用RCC编译系统,对步骤(5)所述精简后的在轨状态中间目标文件、待上传中间目标文件以及相应的静态库文件进行二次链接,生成新的可执行目标文件;(7) Based on the link script file established in step (6), use the RCC compilation system to perform a secondary process on the simplified in-orbit state intermediate object file, the intermediate object file to be uploaded, and the corresponding static library file described in step (5). link to generate a new executable object file; (8)通过RCC编译系统将步骤(7)中生成的新的可执行目标文件转换成链接指令文件或BIN文件,从链接指令文件或BIN文件中直接提取指定起始地址的注入码指令,从而完成航天器在轨维护注入码的生成。(8) convert the new executable target file generated in step (7) into a link instruction file or a BIN file by the RCC compilation system, and directly extract the injection code instruction of the specified starting address from the link instruction file or the BIN file, thereby Complete the generation of injection codes for spacecraft on-orbit maintenance. 2.根据权利要求1所述的方法,其特征在于:步骤(1)中通过使用与航天器原在轨软件相同的sparc平台ERC32编译系统,对原在轨软件源文件目录进行编译链接,生成a.out格式在轨状态目标文件。2. method according to claim 1, it is characterized in that: in the step (1), by using the same sparc platform ERC32 compiling system with the original on-orbit software of the spacecraft, the original on-orbit software source file directory is compiled and linked to generate a.out format on-orbit state object file. 3.根据权利要求1所述的方法,其特征在于:在轨维护源代码存储路径是在航天器原在轨软件的源文件目录下新建的在轨维护的注入代码源文件中。3. The method according to claim 1, characterized in that: the on-orbit maintenance source code storage path is in the newly-created on-orbit maintenance injection code source file under the original on-orbit software source file directory of the spacecraft. 4.根据权利要求1所述的方法,其特征在于:所使用的RCC编译系统和ERC32编译系统同属于sparc平台下的编译系统,并且ERC32编译系统编译生成的指令集ΦERC32是RCC编译系统编译生成的指令集ΦRCC的子集,即 4. the method according to claim 1 is characterized in that: used RCC compilation system and ERC32 compilation system belong to the compilation system under the sparc platform together, and the instruction set Φ ERC32 that ERC32 compilation system compiles and generates is that RCC compilation system compiles The generated instruction set Φ is a subset of RCC , namely 5.根据权利要求1所述的方法,其特征在于:所述步骤(4)将步骤(1)中生成的a.out格式在轨状态目标文件,利用RCC编译系统自带的目标文件格式转换工具,将a.out格式在轨状态目标文件转换为ELF格式的在轨状态中间目标文件。5. The method according to claim 1, characterized in that: said step (4) utilizes the target file format conversion carried by the RCC compiling system to convert the a.out format on-track state target file generated in step (1) Tool to convert a.out format on-orbit state object file to ELF format on-orbit state intermediate object file. 6.根据权利要求1所述的方法,其特征在于:所述步骤(5)将步骤(4)中生成的ELF格式的在轨状态中间目标文件,利用RCC编译系统自带的文件裁剪工具strip,对ELF格式的在轨状态中间目标文件进行精简,除去与链接重定位过程无关的信息。6. the method according to claim 1 is characterized in that: described step (5) utilizes the file clipping tool strip that RCC compilation system carries with the on-track state intermediate object file of the ELF format that generates in step (4) , streamline the on-track state intermediate object file in ELF format, and remove information irrelevant to the link relocation process. 7.根据权利要求1所述的方法,其特征在于:所述步骤(6)新建链接脚本文件,具体为:在脚本文件SECTIONS一节中,依据原在轨软件的输出段的地址设置,新建第一输出段空间,将所述新建的第一输出段空间的起始地址设置为原在轨软件的输出段的起始地址,将所述新建的第一输出段空间的输入段元素设置为一次链接后经步骤(5)文件格式精简后生成的精简后的在轨状态中间目标文件,再依据预先设定的注入区起始地址,新建第二输出段空间,将所述第二输出段空间的起始地址设置为预先设定的注入区起始地址,将所述第二输出段空间的输入段元素设置为在轨维护软件经同平台组合编译后生成的待上传中间目标文件。7. The method according to claim 1, characterized in that: said step (6) newly-built link script file, specifically: in the script file SECTIONS section, according to the address setting of the output section of the original in-track software, newly-created The first output segment space, the initial address of the first output segment space of the new creation is set to the initial address of the output segment of the original in-track software, and the input segment element of the first output segment space of the new creation is set to After a link, the streamlined in-track state intermediate object file generated after the file format streamlining in step (5), and then according to the pre-set initial address of the injection area, create a second output segment space, and the second output segment The start address of the space is set to the preset start address of the injection area, and the input segment element of the second output segment space is set to be an intermediate object file to be uploaded generated by the on-orbit maintenance software combined and compiled on the same platform. 8.根据权利要求1所述的方法,其特征在于:所述在轨状态目标文件为a.out文件格式的可执行目标文件,所述在轨状态中间目标文件、所述精简后的在轨状态中间目标文件、所述待上传中间目标文件和所述新的可执行目标文件均为ELF文件格式。8. The method according to claim 1, characterized in that: the on-track state target file is an executable target file in the a.out file format, the on-track state intermediate target file, the simplified on-track The state intermediate object file, the intermediate object file to be uploaded and the new executable object file are all in ELF file format. 9.根据权利要求1所述的方法,其特征在于:通过RCC编译系统,使用objdump命令将步骤(7)中生成的ELF格式的新的可执行目标文件a.out转换成扩展名为.lst的链接指令文件,或者使用objcopy命令将步骤(7)中生成的ELF格式的新的可执行目标文件a.out转换成扩展名为.bin的BIN文件。9. the method according to claim 1 is characterized in that: by RCC compiling system, use objdump order to convert the new executable target file a.out of the ELF format that generates in step (7) into extension name.lst link instruction file, or use the objcopy command to convert the new executable object file a.out in ELF format generated in step (7) into a BIN file with an extension of .bin. 10.根据权利要求1所述的方法,其特征在于:航天器在轨运行软件以及在轨维护源代码均使用C语言编写。10. The method according to claim 1, characterized in that: the spacecraft on-orbit operation software and the on-orbit maintenance source code are written in C language.
CN201810148099.8A 2018-02-13 2018-02-13 Spacecraft on-orbit maintenance injection code generation method based on same-platform combined compilation Active CN108491197B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810148099.8A CN108491197B (en) 2018-02-13 2018-02-13 Spacecraft on-orbit maintenance injection code generation method based on same-platform combined compilation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810148099.8A CN108491197B (en) 2018-02-13 2018-02-13 Spacecraft on-orbit maintenance injection code generation method based on same-platform combined compilation

Publications (2)

Publication Number Publication Date
CN108491197A true CN108491197A (en) 2018-09-04
CN108491197B CN108491197B (en) 2021-06-11

Family

ID=63340545

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810148099.8A Active CN108491197B (en) 2018-02-13 2018-02-13 Spacecraft on-orbit maintenance injection code generation method based on same-platform combined compilation

Country Status (1)

Country Link
CN (1) CN108491197B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2746105C2 (en) * 2019-02-07 2021-04-07 Акционерное общество "Лаборатория Касперского" System and method of gateway configuration for automated systems protection
US11057102B2 (en) * 2019-04-18 2021-07-06 Microsoft Technology Licensing, Llc On-platform analytics

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1147141C (en) * 1996-12-31 2004-04-21 大宇电子有限公司 Coding method and coder of D-VHS codec system
CN101963915A (en) * 2010-09-25 2011-02-02 中兴通讯股份有限公司 Building method of compilation and system thereof
CN102360305A (en) * 2011-10-09 2012-02-22 中国航天科技集团公司第五研究院第五一三研究所 VxWorks operating system scaling and customizing method for aerospace computer
US8271932B2 (en) * 2010-06-24 2012-09-18 International Business Machines Corporation Hierarchical error injection for complex RAIM/ECC design
CN107315587A (en) * 2017-06-21 2017-11-03 北京控制工程研究所 A kind of spacecraft based on secondary link is in-orbit to safeguard injection code generating method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1147141C (en) * 1996-12-31 2004-04-21 大宇电子有限公司 Coding method and coder of D-VHS codec system
US8271932B2 (en) * 2010-06-24 2012-09-18 International Business Machines Corporation Hierarchical error injection for complex RAIM/ECC design
CN101963915A (en) * 2010-09-25 2011-02-02 中兴通讯股份有限公司 Building method of compilation and system thereof
CN102360305A (en) * 2011-10-09 2012-02-22 中国航天科技集团公司第五研究院第五一三研究所 VxWorks operating system scaling and customizing method for aerospace computer
CN107315587A (en) * 2017-06-21 2017-11-03 北京控制工程研究所 A kind of spacecraft based on secondary link is in-orbit to safeguard injection code generating method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
李振松等: "基于DSP平台的航天器软件在轨维护实现方法研究", 《空间控制技术与应用》 *
王建永等: "SPARC高性能处理器集成开发环境及其编译器设计与实现", 《电子产品世界》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2746105C2 (en) * 2019-02-07 2021-04-07 Акционерное общество "Лаборатория Касперского" System and method of gateway configuration for automated systems protection
US11057102B2 (en) * 2019-04-18 2021-07-06 Microsoft Technology Licensing, Llc On-platform analytics

Also Published As

Publication number Publication date
CN108491197B (en) 2021-06-11

Similar Documents

Publication Publication Date Title
CN111090433B (en) Data processing method, device and storage medium
US8756572B2 (en) Debugger-set identifying breakpoints after coroutine yield points
CN103744709B (en) patch loading method and device
US20030145312A1 (en) Source code transformation
US6874140B1 (en) Debug annotations
CN103077111B (en) A kind of localization method of continuous integrating failure use-case and system
CN104298534B (en) Programmed method and device based on Lua language
JP2007519105A (en) Method and system for converting an automatic test script into an abstract test case representation with persistence
US8225286B2 (en) Debugging interpreted input
JP2002196937A (en) Method of compiling assembly language code for an instruction set architecture including new instructions using conventional assembler
CN101866315A (en) Testing method and system for software development tools
CN104572238A (en) Method and system for generating executable software package efficiently
Yie et al. Advanced traceability for ATL
CN103077038B (en) The method of dynamic generation and compiling .NET project
CN108491197A (en) A kind of in-orbit maintenance injection code generating method of the spacecraft compiled based on same platform combination
US8473903B2 (en) Code edit apparatus and recording medium
CN111158665B (en) Code generation method and device, electronic equipment and storage medium
US7624381B1 (en) Portable detection of start and completion of object construction
Muslu et al. Development history granularity transformations (N)
CN113805851B (en) Flink automatic integration method and system
US20110246966A1 (en) Embedding source files into program symbol files
CA2019603A1 (en) Incremental compiler for source-code development system
CN104536892B (en) A kind of software on-line debugging method and system
CN107315587B (en) A method for generating injection code for spacecraft on-orbit maintenance based on secondary link
Ratanotayanon et al. Cross-artifact traceability using lightweight links

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