Embedded software development method and device

In embedded software development, new modules are built based on pre-built main modules, and the problems of long compilation and linking time, large bin files, and long burning time in the existing technology are solved, and the effect of improving development efficiency is achieved.

CN118312144BActive Publication Date: 2025-04-25欧摩威软件系统开发(重庆)有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410413158.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-07
Publication Date
2025-04-25
Estimated Expiration
2044-04-07

AI Technical Summary

Technical Problem

The existing embedded software development methods have strong code integration and easy management and maintenance, but the compilation and linking time is long, the generated bin files are large, and the burning time is long, which affects the development efficiency.

Method used

A development method for building new modules based on pre-built main modules. This method includes compiling the source code of the newly added module, generating corresponding files, and generating global symbol tables, entrance tables and other files based on the main module, generating burned files through linking and conversion, and burning them independently or in conjunction with burned them.

Benefits of technology

The number of software modules involved in compilation and linking is reduced, the compilation and linking time is reduced, and the generated burned files are smaller and the burned time is shorter, thus significantly improving development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118312144B_ABST
    Figure CN118312144B_ABST
Patent Text Reader

Abstract

The invention discloses a method and device for developing embedded software, which can improve development efficiency. The method comprises: constructing a main body module, and the constructed main body module comprises: a first entry table (stubs_entry_table.s) for storing a stub function of a global function to be implemented, and a second entry table (entry_tables.s) for storing a jump function for jumping to the stub function in the first entry table; and constructing a new module on the basis of the constructed main body module, and the new module needs to run together with the main body module; wherein, when constructing the new module, based on the implementation of the global function by the new module, the jump function in the second entry table is linked to an empty function in the first entry table, or is linked to a global function implemented by the new module, so as to become a second entry table of the new module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to software technology, and in particular to an embedded software development method and device. Background Art

[0002] In the development of embedded software systems, all modules of the entire software system are generally compiled and linked together into a binary file, and then burned into the Flash memory of the device. Specifically, the process generally includes the following steps:

[0003] Source code writing step: Developers need to write the source code of all software modules. These modules may include the main program, library functions, drivers, etc.

[0004] Compilation step: Use a suitable compiler to compile the source code of each module to generate the target file.

[0005] Linking step: Link all target files and required library files to generate an executable file (such as ELF file). The linker will handle issues such as function calls and variable references between modules to ensure that the program can run correctly.

[0006] Format conversion step: Convert the executable file to a format suitable for burning into Flash, such as a bin file. This may involve some format conversion tools or scripts.

[0007] Burning steps: Use the burning tool to burn the bin file into the Flash memory of the device. The burning process may require specific hardware interfaces (such as JTAG, UART, etc.) and burning software.

[0008] This development method has the advantages of strong code integration, easy management and maintenance, etc. However, this method also has problems such as too many software modules involved in compilation at the same time, long compilation and linking time, large generated bin files, and relatively long burning time, which affects the development efficiency of embedded software. Summary of the invention

[0009] An embedded software development method and device according to an embodiment of the present invention can improve development efficiency.

[0010] An embedded software development method according to an embodiment of the present invention comprises: constructing a new module based on a pre-constructed main module; wherein the main module and the new module are combined to form an embedded software, and the main module can be combined and run with different new modules; wherein the step of constructing the new module comprises: compiling the source code of the new module to generate a first file; generating second to fifth files based on the main module; combining the first to fourth files to generate a sixth file; linking the fifth and sixth files to generate a seventh file; and converting the seventh file into a burning file of the new module; wherein the second file is a global symbol table (external_symbol.s ), including the addresses of global functions and global variables in the main module, for the newly added module to link to the main module; wherein the third file is the first entry table (stubs_entry_table.s), used to store empty functions of the global functions to be implemented, and the newly added module at least implements a part of the global functions to be implemented; wherein the fourth file is the second entry table (entry_tables.s), used to store jump functions, and when linking, the jump function is linked to the empty function in the first entry table, or is linked to the global function implemented by the newly added module; wherein the fifth file is a link script file, used to indicate the layout and storage rules of code and data when linking.

[0011] Among them, the burning file of the newly added module includes: a header, an entry table segment, a code segment, a read-only data segment and a readable and writable data segment, wherein the entry table segment is used to store the data in the second entry table; the header includes: description information of each segment, and the description information includes the offset address of the segment storage, the length of the data, the running address and / or the type of the segment.

[0012] Among them, the development method also includes: independently burning the burning file of the main module and the burning file of the newly added module into the first memory respectively; loading the main module from the first memory to the second memory; according to the segment description information in the header, loading the newly added module from the first memory to the second memory; when loading, the entry table segment of the newly added module replaces the entry table segment of the main module, and the code segment, read-only data segment and readable and writable data segment of the newly added module and the main module are merged respectively.

[0013] Among them, the development method also includes: fusing the burning file of the newly added module and the burning module of the main module; and burning the merged burning file into the first memory; during the fusion, based on the segment description information in the header, the entry table segment of the newly added module replaces the entry table segment of the main module, and the code segment, read-only data segment and readable and writable data segment of the newly added module and the main module are merged respectively.

[0014] Among them, the development method also includes: burning the main module into a first memory; loading the main module from the first memory to a second memory; obtaining the new module based on the network, and loading it into the second memory to run together with the main module.

[0015] Among them, in the first entry table, the empty function is implemented in a weak symbol manner.

[0016] A method for developing embedded software according to an embodiment of the present invention comprises: constructing a main body module, wherein the constructed main body module comprises: a first entry table (stubs_entry_table.s) for storing stub functions of global functions to be implemented, and a second entry table (entry_tables.s) for storing jump functions for jumping to the stub functions in the first entry table; and constructing a new module based on the constructed main body module, wherein the new module needs to run together with the main body module; wherein when constructing the new module, based on the implementation of the global function by the new module, the jump function in the second entry table is linked to an empty function in the first entry table, or is linked to a global function implemented by the new module, so as to become the second entry table of the new module.

[0017] Wherein, the stubbing function is an empty function, and / or the stubbing function is implemented in a weak symbol manner.

[0018] The method further includes: when the main module and the newly added module are burned into the first memory, or when the main module and the newly added module are loaded from the first memory to the second memory for operation, the second entry table of the main module is replaced by the second entry table of the newly added module, and the code data, read-only data and readable and writable data of the newly added module are integrated into the main module.

[0019] An embedded software development device according to an embodiment of the present invention comprises: a construction module, which is used to construct a new module based on a pre-constructed main module; wherein the main module and the new module are combined to form an embedded software, and the main module can be combined with different new modules; wherein the construction module is specifically used to: compile the source code of the new module to generate a first file; generate second to fifth files based on the main module; combine the first to fourth files to generate a sixth file; link the fifth and sixth files to generate a seventh file; and convert the seventh file into a burning file of the new module; wherein the second file is a global symbol table (external_symbol .s), containing the addresses of global functions and global variables in the main module, for the newly added module to link to the main module; wherein the third file is the first entry table (stubs_entry_table.s), used to store empty functions of the global functions to be implemented, and the newly added module at least implements a part of the global functions to be implemented; wherein the fourth file is the second entry table (entry_tables.s), used to store jump functions, and when linking, the jump functions are linked to the empty functions in the first entry table, or are linked to the global functions implemented by the newly added module; wherein the fifth file is a link script file, used to indicate the layout and storage rules of code and data when linking.

[0020] A computer device according to an embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method according to the embodiment of the present invention.

[0021] A computer-readable storage medium according to an embodiment of the present invention stores a computer program / instruction thereon, and the computer program / instruction, when executed by a processor, implements the steps of the method according to the embodiment of the present invention.

[0022] A computer program product according to an embodiment of the present invention includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the method according to the embodiment of the present invention are implemented.

[0023] Beneficial effects of the embodiments of the present invention:

[0024] Building new modules on the basis of the already constructed main modules can reduce the number of software modules involved in compilation and linking at the same time, and can also reduce the compilation and linking time, thereby improving development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Other details and advantages of the present invention will become apparent from the detailed description provided below. It should be understood that the following drawings are merely illustrative and thus cannot be considered as limiting the present invention, and the following will be described in detail with reference to the drawings, wherein:

[0026] Figure 1 It is a flowchart of an embodiment of the software development method of the present invention;

[0027] Figure 2A It is a schematic diagram of a process of constructing an additional module according to an embodiment of the present invention;

[0028] Figure 2B It is a structural schematic diagram of an embodiment of a newly added module constructed in the present invention;

[0029] Figure 3 It is a schematic diagram of a flow chart of an embodiment of a burning main module of the present invention;

[0030] Figure 4 It is a schematic diagram of a flow chart of an embodiment of the present invention for burning a newly added module;

[0031] Figure 5 It is a flow chart of an embodiment of the present invention for simultaneously burning a main module and a newly added module;

[0032] Figure 6 It is a flowchart of an embodiment of loading a main module and a newly added module of the present invention;

[0033] Figure 7 is a flow chart of another embodiment of loading the main module and the newly added module of the present invention;

[0034] Figure 8 is a flow chart of another embodiment of loading the main module and the newly added module of the present invention;

[0035] Fig. 9 It is a flow chart of the execution subject module of the present invention;

[0036] Fig.10 It is a flowchart of an embodiment of the execution main module and the newly added module of the present invention;

[0037] Fig.11 It is a flowchart of another embodiment of the execution main module and the newly added module of the present invention;

[0038] Fig.12 It is a structural schematic diagram of an embodiment of an embedded software development device of the present invention;

[0039] Fig.13 It is a schematic structural diagram of an embodiment of a computer device of the present invention. DETAILED DESCRIPTION

[0040] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention clearer and more understandable, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining the present invention and are not intended to limit the present invention.

[0041] In the description of the present invention, it is to be understood that the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. Moreover, the terms "first", "second", etc. are applicable to distinguishing similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.

[0042] The embedded software of the embodiment of the present invention is mainly composed of two parts, namely the main module and the new module, wherein the main module and the new module are both software modules. Among them, the main module has been pre-built, for example, the development process such as compilation, linking and testing has been pre-completed, wherein the main module can be a burning file, that is, a file in Bin format. In addition, the main module can run alone. Since the main module has been pre-built, this embodiment does not need to repeatedly develop the main module and can be used directly. The development of this embodiment mainly lies in the development of the new module. Among them, the new module can be a software module developed for a specific application function, and the new module needs to run together with the main module to realize the application function, that is, the new module cannot run alone. In addition, the main module can be combined with different new modules to generate embedded software that realizes different functions. For example, in vehicle technology, software development is generally based on the AUTOSAR (Automotive Open System Architecture, automotive open system architecture) specification, and the main module is equivalent to the development carried out for the BSW (Basic Software) layer, and the new module is equivalent to the development made for the application layer.

[0043] In this embodiment, when constructing the main module, a pile driving function is set for all global functions to be implemented by the newly added module. In this way, when developing a newly added module, the newly added module can choose to implement the pile driving function in whole or in part according to functional requirements.

[0044] In the present embodiment, because the main module has been built in advance, there is no need to carry out development operations such as source code writing, compiling and linking to the main module again. Only a small amount of source code writing (focusing on the application function that needs to be realized) and development operations such as compiling and linking need to be carried out for the newly added module, thereby the amount of code that needs to be developed can be reduced, the quantity of the software modules that participate in compiling and linking simultaneously can be reduced, the duration of compiling and linking can be reduced, and the volume of the burning file (file of Bin format) that is finally generated is also less simultaneously, and the time required for burning is also shorter. Therefore, the scheme of the present embodiment can significantly improve development efficiency.

[0045] The embedded software development solution of the embodiment of the present invention is described in detail below with reference to the accompanying drawings.

[0046] like Figure 1 FIG. 1 is a flow chart of an embodiment of the method for developing embedded software of the present invention. The method comprises: steps of constructing a new module, burning, loading and executing.

[0047] The steps for building a new module can be found in Figure 2A and 2B For detailed instructions, please refer to Figures 3 to 5 For detailed instructions, please refer to the loading steps Figures 6 to 8 For detailed instructions, please refer to Figures 9 to 11 Detailed description.

[0048] like Figure 2A As shown, it is a schematic diagram of the process of constructing a new module according to an embodiment of the present invention. The construction of the new module includes: writing a source program (such as a source code based on C language), compiling the source program, linking, and a series of operations, and finally converting it into a burning file. In this process, some information provided by the main module will be used.

[0049] Specifically, Figure 2A As shown, the process of building a new module may include:

[0050] Steps to write source program: Based on programming language (such as C language), write code that can realize a specific application function to form a source program. Among them, the new module usually needs to call the global function in the main module. The prototype of the global function to be implemented by the new module is declared in the header file of the main module, so the source program of the new module generally refers to the header file of the main module. In other words, the header file of the main module will participate in the subsequent compilation and linking operations of the new module.

[0051] Compilation steps: Input the source program into the compiler for compilation to generate the compiled file.

[0052] Combination step: Combine the compiled file with the global symbol table (external_symbol.s), the first entry table (entry_tables.s), and the second entry table (stubs_entry_table.s) to generate a combined file.

[0053] Linking and conversion steps: Link the file generated by the combination step with the link script file provided by the main module through a linker to generate an executable file (ELF file), and then use a tool to convert the executable file generated by the link into a burning file, that is, a file in Bin format.

[0054] Among them, the link script file, the global symbol table (external_symbol.s), the first entry table (entry_tables.s) and the second entry table (stubs_entry_table.s) are all provided by the main module that has been developed in advance. For example, these files can be exported from the main module that has been developed in advance through tools, thereby reducing the development workload and improving development efficiency.

[0055] Among them, the link script file can be generated based on the map file in the main module, and can be used to instruct the linker how to layout and store data and code in the program.

[0056] The map file is generated during the linking process when the main module is built. The map file contains information about the code segment (code), read-only data segment (rodata), readable and writable data segment (data), and uninitialized data segment (bss) in the program. It can be used to understand the storage space layout of the program, and to find the address information of functions or variables, etc.

[0057] The starting address and length of the storage area can be provided in the linker script file to facilitate the calculation of the remaining storage space in the newly added module. Because the map file contains the allocation and usage of all storage spaces, the information of the remaining storage space can be obtained by analyzing the file. You can also define linker variables in the linker script file of the main module to conveniently obtain the information of the remaining storage space.

[0058] Among them, the global symbol table (external_symbol.s) can be generated based on the ELF (Executable and Linkable Format) file in the main module. The global symbol table contains the addresses of all global functions and global variables in the main module, which can be used when adding new modules to link with the main module.

[0059] "ELF file" is generally one of the final generated files in the software building process. In addition to containing the relevant information of the generated program binary image file, it also contains the relevant information of various global symbols, etc. It can be used directly as a burning file or as an input file for the debugger.

[0060] "Global function" or "global variable" refers to a globally visible function or variable. Duplicate names are not allowed. When calling a global function that is not in this module, it is usually necessary to first declare it using "extern" plus the prototype of the function or variable.

[0061] The first entry table (stubs_entry_table.s) can be generated based on the arxml file in the main module. Specifically, a Template file is first generated based on the arxml file, and then the second entry table is generated based on the Template file. The Template file is generally a C language source code file generated by an AUTOSAR tool (such as EB Tresos), which contains the interface of the global function to be implemented, generally expressed in the form of an empty function.

[0062] The first entry table includes: a stub function, which is an empty function of the global function to be implemented, and it also belongs to a global symbol, so its address information can be found in the map file. Using an empty function to replace the global function to be implemented will not cause the problem of not being able to find the symbol referenced by the program, so it can avoid the problem of unresolved symbols in the linking process.

[0063] In addition, stubbing functions are generally implemented as weak symbols. The advantage of using weak symbols is that they can stubbing global functions of all newly added modules to be implemented. Even when some of the functions are implemented, there is no need to worry about conflicts and link errors. Weak symbols are considered as alternatives by the linker. Only when the real implementation of a function cannot be found will the linker link to the weak symbol with the same name. Based on this, batch generation can be done automatically through scripts without frequent manual maintenance.

[0064] In addition, an example of a stubbing function may be:

[0065] .weak XXX_MainFunction:: (implemented based on weak symbols)

[0066] b default (empty function)

[0067] .endf XXX_MainFunction

[0068] default::

[0069] Ret

[0070] .endf default

[0071] Among them, the second entry table (entry_tables.s) can also be generated based on the map file in the main module. The essence of the second entry table is a function jump table, including: jump function. For example, if you need to call function A, you need to call function B first, and then function B calls function A, so as to call function A. The jump function generally consists of a function name and a jump instruction, for example, it can be:

[0072] XXX_MainFunction_entry::

[0073] b XXX_MainFunction; (jump to XXX_MainFunction)

[0074] .endf XXX_MainFunction_entry.

[0075] That is to say, in the second entry table (entry_tables.s), the entries of all global functions of the newly added module and the instructions to jump to the real implementation or the empty function (stubs_entry_table.s) are stored.

[0076] In the above linking step, the linker can link the jump function in the second entry table to the global function implemented by the new module, or to the empty function in the first entry table (stubs_entry_table.s) (when not implemented by the new module) based on whether the global function is implemented by the new module. In other words, if the global function is implemented in the new module, it will jump to the specific implementation, if not, it will jump to the empty function implementation of the new module (i.e., stubs_entry_table.s).

[0077] The structure of the new module constructed in the above way can be referred to Figure 2B shown.

[0078] like Figure 2B As shown, the burning file includes: a header (header), a code segment (code), an entry table segment (entry_table), a read-only data segment (rodata) and a readable and writable data segment (data).

[0079] Among them, the code segment (code) generally contains the executable code of the program. The entry table segment generally includes the data of the entry table. The read-only data segment (rodata) generally contains constant data in the program, such as string constants, etc., which are all read-only. The readable and writable data segment (data) contains initialized global variables and static variables in the program, which can be modified. In addition, the burned file generally also includes: BSS (Block Started by Symbol) segment, that is, the uninitialized data segment, which generally includes uninitialized global variables and static variables in the program. However, since the data in the BSS segment is automatically initialized to 0 when the program is loaded, a specific memory address is not required before the program is executed. Therefore, in Figure 2B and Figures 3 to 5 They are not shown or considered not to exist.

[0080] The header includes: segment description information 1 to 5, including the offset address of the segment, the length of the data, the running address and the type of the segment (such as code, read-only data, initialized data, uninitialized data), etc. Based on the segment description information, the corresponding data can be moved to the corresponding storage space when burning or loading.

[0081] In this embodiment, when constructing a new module, the entry table (entry_tables.s) and (stubs_entry_table.s) used and the global symbol table (external_symbol.s) are all provided by the main module, so the developer can focus on implementing specific application functions in the new module. In addition, with this development method, fewer files are involved in compilation and linking, and the compilation efficiency will be greatly improved. At the same time, in the new module, except for the entry table (entry_tables.s), there will not be any redundant code, so a smaller Bin file can be generated, and the smaller Bin file can save burning time. Therefore, in summary, the embodiment of the present invention can significantly improve development efficiency. In addition, after the new module is developed and tested, the relevant code can be gradually moved to the main module, thereby keeping the "lightweight" of the new module.

[0082] like Figures 3 to 5 FIG. 1 is a flow chart of an embodiment of the burning step of the present invention.

[0083] "Burn" refers to the process of downloading and burning binary information such as program code and data into the program memory of an electronic device. Burning can be achieved with the help of a dedicated burning tool.

[0084] Figure 3The process of burning the main module into the memory 30 is shown, that is, burning the data in the code segment, entry table segment, read-only data segment and readable and writable data segment in the main module into the memory 30. The memory 30 may be a non-volatile memory, generally FLASH (flash memory).

[0085] Figure 4 The process of burning the newly added module into the memory 30 is shown, that is, burning the header, code segment, entry table (entry_table) segment, read-only data segment and readable and writable data segment in the newly added module into the memory 30.

[0086] After being burned into the memory 30, the storage spaces of the main module and the newly added module in the memory 30 are independent of each other. In other words, the main module and the newly added module still exist independently in the memory 30 and have not been merged. Figure 3 and 4 In the burning method shown, the main module and the newly added module will be merged during the loading stage.

[0087] and Figure 5 Another burning method is shown, that is, the main module and the new module are first merged, and then burned into the memory 30. As shown in the figure, when the burning files of the main module and the new module are merged, the entry table segment of the new module replaces the entry table segment of the main module, and the code segment, read-only data segment and readable and writable data segment of the new module are respectively inserted into the relevant positions of the code segment, read-only data segment and readable and writable data segment of the main module. The specific insertion position is indicated in the header file of the new module, refer to Figure 2B The segment description information is shown.

[0088] like Figures 6 to 8 , which is a flow chart of the loading steps of an embodiment of the present invention.

[0089] The loading refers to the process of loading the program in the memory 30 into the memory 40 for running. The memory 40 is generally a volatile memory, such as a SRAM (Static Random-Access Memory).

[0090] like Figure 6 As shown, its corresponding Figure 4 The burning structure is such that when data is loaded from the memory 30 to the memory 40, based on the information in the header, the code segment, read-only data segment and readable and writable data segment of the newly added module are respectively inserted into the code segment, read-only data segment and readable and writable data segment in the main module, and the entry table segment of the main module is replaced by the entry table segment of the newly added module.

[0091] like Figure 7 As shown, its corresponding Figure 5 The burning structure. Figure 5 In the embodiment, the main module and the newly added module have been integrated in advance, so the data in the memory 30 can be directly loaded into the memory 40.

[0092] like Figure 8 As shown, it is a method of loading a new module through a network. As shown in the figure, the main module is loaded from the memory 30 into the memory 40, and then the burning file of the new module is obtained through the network and loaded into the memory 40. Figure 8 This method eliminates the need to burn new modules and can further improve development efficiency.

[0093] like Figures 9 to 11 , which is a flow chart of the execution steps of an embodiment of the present invention.

[0094] exist Fig. 9 In this case, only the main module is burned and loaded. At this time, the entry table (entry_tables.s) is not replaced by the entry table of the newly added module. Therefore, the program can only be transferred within the main module, and the newly added module cannot be called.

[0095] exist Fig.10 In the program, both the main module and the new module are burned and loaded, but the new module does not implement the stub function. Therefore, when building the new module, the jump function in the entry table (entry_tables.s) is linked to the empty function in the entry table (stubs_entry_table.s). Therefore, when the program is running, it can only call the empty function in the entry table (stubs_entry_table.s).

[0096] exist Fig.11 In the program, both the main module and the new module are burned and loaded, and the new module implements the stubbing function. Therefore, when building the new module, the jump function in the entry table (entry_tables.s) is linked to the implemented function, so that when the program is running, the main module can jump to the corresponding program module in the new module through the entry table (entry_tables.s) to run and implement related functions.

[0097] like Fig.12 FIG. 1 is a schematic diagram of the structure of an embodiment of an embedded software development device 12 of the present invention. The development device 12 includes: a construction module 120, a burning module 122, a loading module 124 and an execution module 126. The construction module 120 mainly executes Figure 2A The operations involved in the embodiment, the burning module 120 mainly performs Figures 3 to 5 The operations involved in the embodiment, the loading module 124 mainly performs Figures 6 to 8The operations involved in the embodiment, executing step 126 mainly executes Figures 9 to 11 The operations involved.

[0098] like Fig.13 , which is a schematic diagram of the structure of an embodiment of a computer device 13 of the present invention. The computer device 13 includes: a memory 130, a processor 132 and a computer program stored in the memory 132. The processor executes the computer program to implement the method described in the embodiment of the present invention.

[0099] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the method described in the embodiment of the present invention is implemented.

[0100] In addition, an embodiment of the present invention further provides a computer program product, including a computer program / instruction, and when the computer program / instruction is executed by a processor, the method described in the embodiment of the present invention is implemented.

[0101] The description of the above storage medium, program product and device embodiments is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the storage medium, program product and device embodiments of this application, please refer to the description of the method embodiment of this application for understanding.

[0102] The processor may be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, a microprocessor, etc. It is understandable that the electronic device that implements the function of the processor may also be other, and the embodiments of the present application are not specifically limited.

[0103] The above-mentioned computer storage medium / memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and the like; it can also be various terminals including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.

[0104] It should be noted that the above description is only for example and not for limitation of the present invention. In other embodiments of the present invention, the method may have more, fewer or different steps, and the order, inclusion and function of each step may be different from that described and illustrated. For example, generally multiple steps can be combined into a single step, and a single step can also be divided into multiple steps. For those of ordinary skill in the art, without paying creative work, the sequential changes of each step are also within the scope of protection of the present invention.

[0105] The technical solution of the present invention, in essence or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor or a microcontroller to perform all or part of the steps of the method described in each embodiment of the present invention.

[0106] Those skilled in the art will appreciate that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed.

[0107] Although the present invention has been disclosed as above with preferred embodiments, the present invention is not limited thereto. Any changes and modifications made by any person skilled in the art without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention, and therefore the protection scope of the present invention should be subject to the scope defined by the claims.

Claims

1. A method for developing embedded software, characterized in that: The method comprises: Build new modules based on pre-built main modules; Wherein, the main module and the additional module are combined to form an embedded software, and the main module can be combined and run with different additional modules; The step of constructing a new module includes: Compile the source code of the newly added module to generate a first file; Based on the main module, generate the second to fifth files; combining the first to fourth files to generate a sixth file; linking the fifth and sixth files to generate a seventh file; and Convert the seventh file into a burning file of the newly added module; Wherein, the second file is a global symbol table (external_symbol.s), which contains the addresses of global functions and global variables in the main module, and is used by the newly added module to link to the main module; The third file is a first entry table (stubs_entry_table.s), which is used to store empty functions of the global function to be implemented, and the newly added module implements at least a part of the global function to be implemented; The fourth file is a second entry table (entry_tables.s), which is used to store jump functions. When linking, the jump function is linked to an empty function in the first entry table, or is linked to a global function implemented by the newly added module. The fifth file is a link script file, which is used to indicate the layout and storage rules of code and data during linking.

2. The method for developing embedded software according to claim 1, wherein: The burning file of the newly added module includes: a header, an entry table segment, a code segment, a read-only data segment, and a readable and writable data segment, wherein the entry table segment is used to store the data in the second entry table; The header includes: description information of each segment, and the description information includes an offset address where the segment is stored, a length of data, a running address and / or a segment type.

3. The method for developing embedded software according to claim 2, wherein: The development method also includes: Burning the burning file of the main module and the burning file of the newly added module into the first memory independently respectively; Loading the burning file of the main module from the first memory to the second memory; According to the segment description information in the header, the burning file of the newly added module is loaded from the first memory to the second memory; During loading, the entry table segment of the newly added module replaces the entry table segment of the main module, and the code segment, read-only data segment and readable and writable data segment of the newly added module and the main module are merged respectively.

4. The method for developing embedded software according to claim 2, wherein: The development method also includes: Merging the burning file of the newly added module and the burning file of the main module; and Burn the merged burning file into the first memory; During fusion, based on the segment description information in the header, the entry table segment of the newly added module replaces the entry table segment of the main module, and the code segment, read-only data segment and readable and writable data segment of the newly added module and the main module are fused respectively.

5. The method for developing embedded software according to claim 1, wherein: The development method also includes: Burning the main module into the first memory; Loading the main body module from the first memory into the second memory; The newly added module is obtained based on the network and loaded into the second memory to run together with the main module.

6. The method for developing embedded software according to claim 1, wherein: In the first entry table, the empty function is implemented in a weak symbol manner.

7. A method for developing embedded software, characterized in that: include: Constructing a main body module, wherein the constructed main body module includes: a first entry table (stubs_entry_table.s) for storing stub functions of global functions to be implemented, and a second entry table (entry_tables.s) for storing jump functions for jumping to the stub functions in the first entry table; and On the basis of the main module that has been constructed, construct a new module, and the new module needs to run together with the main module; Among them, when constructing the new module, based on the implementation of the global function by the new module, the jump function in the second entry table is linked to the empty function in the first entry table, or linked to the global function implemented by the new module to become the second entry table of the new module.

8. The method for developing embedded software according to claim 7, wherein: The stubbing function is an empty function, and / or the stubbing function is implemented in a weak symbol manner.

9. The method for developing embedded software according to claim 7, wherein: The method further comprises: When the main module and the newly added module are burned into the first memory, or when the main module and the newly added module are loaded from the first memory to the second memory for operation, the second entry table of the main module is replaced by the second entry table of the newly added module, and the code data, read-only data and readable and writable data of the newly added module are integrated into the main module.

10. An embedded software development device, characterized in that: The development device includes: a construction module, which is used to construct a new module based on the pre-constructed main module; Wherein, the main module and the additional module are combined to form an embedded software, and the main module can be combined with different additional modules; Wherein, the building blocks are specifically used for: Compile the source code of the newly added module to generate a first file; Based on the main module, generate the second to fifth files; combining the first to fourth files to generate a sixth file; linking the fifth and sixth files to generate a seventh file; and Convert the seventh file into a burning file of the newly added module; Wherein, the second file is a global symbol table (external_symbol.s), which contains the addresses of global functions and global variables in the main module, and is used by the newly added module to link to the main module; The third file is a first entry table (stubs_entry_table.s), which is used to store empty functions of the global function to be implemented, and the newly added module implements at least a part of the global function to be implemented; The fourth file is a second entry table (entry_tables.s), which is used to store jump functions. When linking, the jump function is linked to an empty function in the first entry table, or is linked to a global function implemented by the newly added module. The fifth file is a link script file, which is used to indicate the layout and storage rules of code and data during linking.

11. A computer device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 9.

12. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

13. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Hot patching implementation method of embedded system

    CN104239082A

  • Multi-instance dynamic loading method and device for TEE trusted application on MCU

    CN116450237A