Partial upgrading method for embedded software
Technical Field
The invention relates to the field of embedded software, in particular to a partial upgrading method of embedded software.
Background
The embedded software is operating system and development tool software embedded in hardware, and the association relationship in the industry is embodied as follows: chip design and manufacture, embedded system software, and embedded electronic device development and manufacture, wherein the embedded system refers to a special computer system for executing independent functions. It is composed of a series of microelectronic chips and devices including microprocessor, timer, microcontroller, memory and sensor, and micro-operation system and control application software embedded in the memory, and can implement various automatic processing tasks of real-time control, monitoring, management, mobile calculation and data processing, etc.
In the using process of the embedded software, for example, the embedded software is often required to be upgraded to make up for some bugs or improve some performances, and the upgrading stability of the existing embedded software is low, so that the upgrading process is slow.
Therefore, it is necessary to provide a partial upgrade method for embedded software to solve the above technical problems.
Disclosure of Invention
The invention provides a partial upgrading method of embedded software, which solves the problems of low upgrading stability and low upgrading process speed when the existing embedded software is upgraded.
In order to solve the technical problem, the method for partially upgrading the embedded software provided by the invention comprises the following steps:
s1: the used compiler generates an embedded operating system file in an ELF format;
1. s2: downloading the embedded operating system file in the S1 to a single chip microcomputer system and operating the single chip microcomputer system, wherein the single chip microcomputer system comprises an embedded system core program area and a dynamically loadable program area, and the single chip microcomputer system program area has enough storage space for upgrading codes;
s3: generating an upgrading program file X in an ELF format by using a compiler;
s4: transmitting the upgrading program file X to the single chip microcomputer system through a communication link;
s5: after the single chip microcomputer system determines that the transmission of the upgrading program file X is completed, the embedded operating system verifies the validity and the integrity of the file;
s6: carrying out upgrading operation, wherein an embedded operating system in a singlechip system in the upgrading analyzes the received file X data, modifies the corresponding address of the symbol table, and realizes the relocation of code segments, data segments, the symbol table and program entry information addresses;
s7: after the updating code segment is relocated, replacing the program entry address to be updated in the entry address list of the loadable program as the updating program entry address, starting a new program to complete the updating, and arranging a plurality of program entry addresses in the single chip microcomputer system.
Preferably, the embedded operating system file in S1 includes an embedded system kernel and a dynamically loadable program.
Preferably, the program of the singlechip system is based on an embedded operating system, and the embedded operating system supports dynamic connection and dynamic loading functions.
Preferably, in S4, the single chip microcomputer system needs to establish a communication link with the upgrade server first, and then store the upgrade program file X in the data program storage area of the single chip microcomputer system through the communication link.
Preferably, the communication link in S4 may be UART, SPI, IIC, BLE, NB-Iot, etc.
Preferably, the embedded operating system in S6 relocates code segments, data segments, symbol tables, and program entry information addresses of the file X through a dynamic loading function.
Preferably, in S6, after the relocation of the upgrade code segment is completed, the target program needs to be exited.
Preferably, the upgrade program file X is transmitted to the single chip microcomputer system by the upgrade server through a communication link.
Preferably, the embedded operating system file and the upgrade program file X generated by the encoder must be in the ELF format.
Preferably, in S5, if the upgrade program file X is validated, the upgrade operation is performed, otherwise, the upgrade program file X is deleted.
Compared with the related art, the partial upgrading method of the embedded software provided by the invention has the following beneficial effects:
the invention provides a part of embedded software upgrading method, the compiler used generates the embedded operating system file of ELF format, download the embedded operating system file in S1 to the one-chip computer system, and operate, the compiler used generates the upgrading program file X of ELF format, the one-chip computer system sets up the communication link with upgrading server, transmit upgrading program file X to the one-chip computer system through the communication link, the one-chip computer system is after confirming that upgrading program file X transmits and finishes, the embedded operating system checks file validity and integrality, carry on the upgrading operation, the embedded operating system in the one-chip computer system analyzes the file X data received in upgrading, revise the corresponding address of symbol table, realize the relocation of code segment, data segment, symbol table, procedure entry information address through the dynamic loading function; after the updating code segment is relocated, replacing the program entry address to be updated in the entry address list of the loadable program as the updating program entry address, starting the new program, and completing the updating.
Drawings
FIG. 1 is a schematic structural diagram of a preferred embodiment of a method for partially upgrading embedded software according to the present invention;
FIG. 2 is a partial functional block diagram of FIG. 1;
FIG. 3 is a partial functional block diagram of FIG. 1;
fig. 4 is a partial schematic block diagram of fig. 1.
Detailed Description
The invention is further described with reference to the following figures and embodiments.
Please refer to fig. 1, fig. 2, fig. 3 and fig. 4 in combination, wherein fig. 1 is a schematic structural diagram of a preferred embodiment of a partial upgrading method for embedded software according to the present invention; FIG. 2 is a partial functional block diagram of FIG. 1; FIG. 3 is a partial functional block diagram of FIG. 1; fig. 4 is a partial schematic block diagram of fig. 1. The partial upgrading method of the embedded software comprises the following steps:
s1: the used compiler generates an embedded operating system file in an ELF format;
s2: downloading the embedded operating system file in the S1 to a single chip microcomputer system and operating;
s3: generating an upgrading program file X in an ELF format by using a compiler;
s4: transmitting the upgrading program file X to the single chip microcomputer system through a communication link;
s5: after the single chip microcomputer system determines that the transmission of the upgrading program file X is completed, the embedded operating system verifies the validity and the integrity of the file;
s6: carrying out upgrading operation, wherein an embedded operating system in a singlechip system in the upgrading analyzes the received file X data, modifies the corresponding address of the symbol table, and realizes the relocation of code segments, data segments, the symbol table and program entry information addresses;
s7: after the updating code segment is relocated, replacing the program entry address to be updated in the entry address list of the loadable program as the updating program entry address, and starting the new program to complete the updating.
The embedded operating system file in S1 includes an embedded system kernel and a dynamically loadable program.
The system program of the single chip microcomputer is based on an embedded operating system, and the embedded operating system supports dynamic connection and dynamic loading functions.
In S4, the single chip microcomputer system needs to establish a communication link with the upgrade server first, and then stores the upgrade program file X in the data program storage area of the single chip microcomputer system through the communication link.
The communication link in the S4 can be UART, SPI, IIC, BLE, NB-Iot and the like, and the upgrade file can be directly written into the program area of the single chip microcomputer system through the communication link.
The embedded operating system in S6 realizes relocation of the file X code segment, data segment, symbol table, and program entry information address through a dynamic loading function.
In S6, after the relocation of the upgrade code segment is completed, the target program needs to be exited.
And the upgrading program file X is transmitted to the singlechip system by the upgrading server through a communication link.
The embedded operating system file and the upgrade program file X generated by the encoder must be in the ELF format.
And in the step S5, if the upgrade program file X is validated, performing an upgrade operation, otherwise, deleting the upgrade program file X.
The working principle of the partial upgrading method of the embedded software provided by the invention is as follows:
s1: the used compiler generates an embedded operating system file in an ELF format;
s2: downloading the embedded operating system file in the S1 to a single chip microcomputer system and operating;
s3: generating an upgrading program file X in an ELF format by using a compiler;
s4: the single chip microcomputer system and the upgrading server establish a communication link, and an upgrading program file X is transmitted to the single chip microcomputer system through the communication link;
s5: after the single chip microcomputer system determines that the transmission of the upgrading program file X is completed, the embedded operating system verifies the validity and the integrity of the file;
s6: carrying out upgrading operation, wherein an embedded operating system in a singlechip system in the upgrading analyzes the received file X data, modifies the corresponding address of the symbol table, and realizes the relocation of code segments, data segments, the symbol table and program entry information addresses through a dynamic loading function;
s7: after the updating code segment is relocated, replacing the program entry address to be updated in the entry address list of the loadable program as the updating program entry address, and starting the new program to complete the updating.
Compared with the related art, the partial upgrading method of the embedded software provided by the invention has the following beneficial effects:
the invention provides a part of embedded software upgrading method, the compiler used generates the embedded operating system file of ELF format, download the embedded operating system file in S1 to the one-chip computer system, and operate, the compiler used generates the upgrading program file X of ELF format, the one-chip computer system sets up the communication link with upgrading server, transmit upgrading program file X to the one-chip computer system through the communication link, the one-chip computer system is after confirming that upgrading program file X transmits and finishes, the embedded operating system checks file validity and integrality, carry on the upgrading operation, the embedded operating system in the one-chip computer system analyzes the file X data received in upgrading, revise the corresponding address of symbol table, realize the relocation of code segment, data segment, symbol table, procedure entry information address through the dynamic loading function; after the updating code segment is relocated, replacing the program entry address to be updated in the entry address list of the loadable program as the updating program entry address, starting the new program, and completing the updating.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.