Firmware generation method, terminal firmware online upgrading method and device

By setting the target constant data in the firmware as an interrupt vector table and using the address offset to obtain the data, the problem of inconsistent versions in the firmware OTA upgrade is solved, and efficient and accurate firmware updates and maintenance are achieved.

CN119182666APending Publication Date: 2024-12-24SUZHOU CHUTIANLONG DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411211760.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-24

AI Technical Summary

Technical Problem

During the firmware OTA upgrade process, the actual firmware version issued is inconsistent with the expected firmware version information, resulting in the upgrade failure or abnormal function, the existing technology is inefficient and there is a risk of update failure.

Method used

By setting the target constant data after the interrupt vector table and obtaining the address offset of the target constant data according to the size of the interrupt vector table, it can quickly obtain the target constant data of the new firmware, improving the efficiency and convenience of firmware update and maintenance .

Benefits of technology

Ensure the accuracy and consistency of firmware version information, reduce the risk of upgrade failure, and improve the efficiency and user experience of firmware updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119182666A_ABST
    Figure CN119182666A_ABST
Patent Text Reader

Abstract

The invention provides a firmware generation method and a terminal firmware online upgrading method and device.A link script is obtained and used for indicating that target constant data is arranged behind an interrupt vector table, and the initial address of the target constant data is adjacent to the termination address of the interrupt vector table; based on the link script, the firmware file after the target constant data is set in the interrupt vector table is obtained, so that the address offset of the target constant data is obtained through the size of the interrupt vector table, and the target constant data of the new firmware can be rapidly obtained according to the address offset of the target constant data. And the firmware updating and maintenance efficiency and convenience are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a firmware generation method, a terminal firmware online upgrade method and equipment. Background Art

[0002] Firmware OTA (Over-The-Air) upgrade is a wireless technology that allows a device's firmware or software to be updated remotely over the network without the need for the user to manually download and transfer the update file to the device through a physical connection such as USB or serial port.

[0003] The inventors of the present application have noticed during their research that during the firmware OTA upgrade process, there may be an abnormal situation where the actual firmware version issued is inconsistent with the expected firmware version information, which may lead to upgrade failure or functional abnormality. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a firmware generation method, a terminal firmware online upgrade method and a device, which can quickly obtain the target constant data of the new firmware through the address offset, thereby improving the efficiency and convenience of firmware updating and maintenance.

[0005] In a first aspect, a firmware generation method is provided, comprising:

[0006] Obtain a link script, wherein the link script is used to indicate that: the target constant data is set after the interrupt vector table, and the starting address of the target constant data is adjacent to the ending address of the interrupt vector table;

[0007] Based on the link script, a firmware file is obtained in which the target constant data is set after the interrupt vector table.

[0008] In an optional embodiment, a link script is obtained, wherein the link script is used to indicate that the target constant data is set after the interrupt vector table, and the starting address of the target constant data is adjacent to the ending address of the interrupt vector table, and further includes:

[0009] Set the interrupt vector table and target constant data at the beginning of the firmware file.

[0010] In an optional embodiment, a link script is obtained, wherein the link script is used to indicate that the target constant data is set after the interrupt vector table, and the starting address of the target constant data is adjacent to the ending address of the interrupt vector table, and further includes:

[0011] Get the starting address of the interrupt vector table;

[0012] Based on the start address of the interrupt vector table and the data length of the interrupt vector table, an address offset is obtained, and the address offset is the address offset of the target constant data.

[0013] In an optional embodiment, based on the link script, a firmware file is obtained in which the target constant data is set after the interrupt vector table, including:

[0014] Get the first data block where the interrupt vector table is located;

[0015] Get the second data block where the target constant data is located;

[0016] Based on the link script, the second data block is located after the first data block and adjacent to the first data block, so as to obtain a firmware file in which the target constant data is set after the interrupt vector table.

[0017] In an optional embodiment, the target constant data includes firmware version information, hardware configuration data, and system parameters.

[0018] In a second aspect, a terminal firmware online upgrade method is provided, comprising:

[0019] Acquire a new firmware file information package and acquire first firmware version information, wherein the new firmware file is obtained by any firmware generation method in the first aspect, and the first firmware version information is firmware version information that the terminal is expected to upgrade;

[0020] Obtaining the firmware version information address offset according to the size of the interrupt vector table of the new firmware file information packet to obtain the second firmware version information, wherein the second firmware version information is the version information of the new firmware file;

[0021] A verification result is obtained based on the first firmware version information and the second firmware version information, and based on the verification result, it is determined that the terminal firmware is to be upgraded online.

[0022] In an optional embodiment, determining that the terminal firmware is to be upgraded online based on the verification result includes:

[0023] If the first firmware version information matches the second firmware version information, the terminal firmware is upgraded online.

[0024] In an optional embodiment, obtaining the first firmware version information includes:

[0025] Get the configuration file corresponding to the new firmware file;

[0026] The first firmware version information is read from the configuration file.

[0027] In a third aspect, an electronic device is provided, the electronic device comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0028] Memory, used to store computer programs;

[0029] The processor is used to implement any one of the method steps in the first aspect or the second aspect when executing the program stored in the memory.

[0030] In a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps in any one of the first aspect or the second aspect are implemented.

[0031] The present invention provides a firmware generation method, a terminal firmware online upgrade method and a device, which obtain a link script, wherein the link script is used to indicate: setting target constant data after an interrupt vector table, and the starting address of the target constant data is adjacent to the ending address of the interrupt vector table; based on the link script, a firmware file in which the target constant data is set after the interrupt vector table is obtained, thereby obtaining the target constant data address offset through the size of the interrupt vector table, and the target constant data of the new firmware can be quickly obtained according to the target constant data address offset, thereby improving the efficiency and convenience of firmware update and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0033] Figure 1 A flowchart of a firmware generation method provided in an embodiment of the present application;

[0034] Figure 2 A schematic diagram of a process flow of a terminal firmware online upgrade method provided in an embodiment of the present application;

[0035] Figure 3 A schematic diagram of the internal data layout of the new firmware provided by an embodiment of the present application;

[0036] Figure 4 A schematic diagram comparing the internal data layout of the new firmware and the traditional firmware provided in the embodiment of the present application;

[0037] Figure 5 A schematic diagram of the structure of a terminal firmware online upgrade device provided in an embodiment of the present application;

[0038] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0040] The inventors of the present application noticed in their research that, during the firmware OTA upgrade process, the server background obtains the latest firmware version information by manually uploading the new firmware upgrade package and filling in the new firmware configuration file to describe the firmware version. Therefore, errors may occur in manually uploading the new firmware version, but the firmware version information in the configuration file describing the new firmware is correct, resulting in an abnormal situation in which the actual firmware version issued is inconsistent with the expected firmware version, which in turn causes the firmware upgrade to fail or functional abnormalities.

[0041] For terminals, traditional firmware OTA upgrades usually go through the following steps: 1. Version detection, the terminal regularly checks or the user manually checks whether there is a new firmware version available for update; 2. Downloading the firmware, after starting the firmware update process, the terminal sends a request to the server through the network to download the new firmware; 3. Updating the firmware, after the download is complete, the terminal prompts the user to confirm whether to start the upgrade, and the terminal writes the new firmware to the corresponding storage area for updating. After the update is completed, the terminal will restart to load the new firmware; 4. Verifying the upgrade result, the terminal detects the correctness of the version information of the new firmware during the restart process to ensure that the new firmware can work normally. If the firmware upgrade fails or there is a problem with the firmware, the terminal will revert to the old version; 5. Feedback on the upgrade result, the terminal will feedback the upgrade result to the server.

[0042] In the MCU chip, the firmware version information is stored after the interrupt vector table, but the specific location is not fixed, and the firmware version information may change as the program changes position. The correctness of the new firmware version can only be verified after the new firmware is installed. This firmware update method takes a long time, is inefficient, and has the risk of update failure.

[0043] Based on this, the present application provides a terminal firmware online upgrade method, a firmware generation method and a device, by setting the firmware version information after the interrupt vector table and adjacent to the interrupt vector table, and setting the interrupt vector table and the firmware version information at the starting position of the new firmware file (i.e., the executable file), thereby realizing rapid acquisition of the firmware version information of the new firmware, reading the firmware version information in the form of reading a file, and at the same time improving the efficiency and convenience of firmware updating and maintenance.

[0044] For ease of understanding, the terms involved in the embodiments of the present application are explained below:

[0045] Firmware files are the storage form of firmware and are the digital representation of firmware programs. They contain the necessary instructions and parameters to run on the device. The firmware file structure refers to the organization of firmware files in the system. It usually contains all the code, data, and configuration information required to perform specific functions. Different devices and MCU chips may have different firmware file structures.

[0046] The firmware file structure generally includes: code segment and data segment.

[0047] The interrupt vector table is a data structure used to map interrupt or exception types to the addresses of corresponding interrupt service routines. The interrupt vector table usually includes: interrupt vectors and interrupt service routine addresses, etc. Among them, the interrupt vector is a unique identifier for each interrupt, usually arranged in a certain order, such as hardware interrupts, software interrupts, and exceptions; the interrupt service routine address is that for each interrupt vector, there is a corresponding address pointing to the service routine that handles the interrupt. When an interrupt occurs, the processor will look up the interrupt vector table, find the corresponding address according to the interrupt type, and jump to the address to execute the code. Among them, the interrupt vector table contains multiple address offsets, each offset corresponds to the entry address of an interrupt service program.

[0048] The link files in the firmware file usually refer to the link files related to the firmware image file, which are various auxiliary files designed to help developers build and debug firmware.

[0049] The target constant data of the firmware file is immutable data that will not be modified during the execution of the firmware, such as firmware version information, hardware configuration data, system parameters, and configuration settings.

[0050] In the present application, since the size of the interrupt vector table in the platform (certain models of MCU) to which the firmware (i.e., executable file) is adapted is fixed, the offset of the target constant data after the interrupt vector table and adjacent to the interrupt vector table is also fixed, so that the target constant data, such as firmware version information, can be subsequently obtained by reading the size of the interrupt vector table in the first package data downloaded from the firmware.

[0051] Link script is a compilation technology that converts the source program from one language (source language) to a target language (target language).

[0052] Firmware version information includes version number, release date, manufacturer, and update content. The version number is a unique code used to identify the firmware and is used to distinguish different firmware versions.

[0053] Figure 1The flowchart of a firmware generation method provided in the embodiment of the present application is shown in FIG. 1 , wherein the execution subject of the method is a PC compiler. Figure 1 As shown, the method may include:

[0054] Step S110 , obtaining a link script, wherein the link script is used to indicate that the target constant data is set after the interrupt vector table, and the start address of the target constant data is adjacent to the end address of the interrupt vector table.

[0055] The internal data of the firmware file includes other data such as the interrupt vector table and the constant data area, wherein the constant data area includes multiple immutable data, such as firmware version information, hardware configuration data, system parameters and other data.

[0056] The target constant data is any data in the constant data area.

[0057] The target constant data is set after the interrupt vector table and adjacent to the interrupt vector table, and the target constant data in the firmware file can be quickly and accurately obtained through the size of the interrupt vector table.

[0058] Furthermore, in order to achieve fast access and retrieval of target constant data, the interrupt vector table and target constant data are set at the file start position of the firmware file, thereby improving the system startup speed and operation effect and reducing the performance loss caused by data access delay.

[0059] Among them, the address offset of the target constant data is obtained based on the size of the interrupt vector table, and the target constant data is read through the address offset of the target constant data, so that the target constant data is read in the form of reading a file. It can be achieved that the target constant data can be obtained without starting the firmware file, which improves the efficiency of data reading and reduces the complexity of data processing.

[0060] In some optional embodiments, determining the address offset of the target constant data based on the data length of the interrupt vector table includes:

[0061] Get the starting address of the interrupt vector table;

[0062] Based on the start address of the interrupt vector table and the data length of the interrupt vector table, an address offset is obtained, and the address offset is the address offset of the target constant data.

[0063] Among them, the starting address and data length of the interrupt vector table can be obtained through a specific system call. By obtaining the starting address of the interrupt vector table, and then calculating the ending address of the interrupt vector table according to the starting address of the interrupt vector table and the data length of the interrupt vector table, the address offset of the target constant data is obtained, so as to conveniently locate the location of the target constant data and realize efficient management of the interrupt vector table and its associated data.

[0064] Step S120: Based on the link script, a firmware file is obtained in which the target constant data is set after the interrupt vector table.

[0065] In a possible embodiment, in step S140, based on the link script, a firmware file is obtained in which the target constant data is set after the interrupt vector table, including:

[0066] Get the first data block where the interrupt vector table is located;

[0067] Get the second data block where the target constant data is located;

[0068] Based on the link script, the second data block is located after the first data block and adjacent to the first data block, so as to obtain a firmware file in which the target constant data is set after the interrupt vector table.

[0069] By modifying the link script, the target constant data is set after the interrupt vector table and adjacent to the interrupt vector table. This allows the target constant data to be obtained without starting the firmware file, thereby improving the efficiency of data reading.

[0070] For example, declare the interrupt vector table in a corresponding segment named ".isr_vt";

[0071] Declare the firmware version information into a fixed-size array and specify the segment name of the array as CodeVersion:

[0072] Eg.cosnt uint8_t g_app_version

[32] __attribute__((section(CodeVersion)))="NOR_V1.0.0"

[0073] Then, through the compilation technology, the compilation link file is modified to set the firmware version information after the interrupt vector table and adjacent to the interrupt vector table.

[0074] Among them, the link file extension of gcc is lds, and the link file is used to set various data blocks inside the firmware.

[0075] Based on Eg., compile the link file, modify the firmware's running start address on the target device (0x01032000), and ensure that the ORIGIN and LENGTH of the CODEVERSION part correspond to the ORIGIN of the ISRVECTOR part. That is, the ORIGIN value corresponding to CodeVersion is the firmware version information set after the interrupt vector table and adjacent to the interrupt vector table, and the offset value of the firmware version information is equal to the ORIGIN+LENGTH of ISRVECTOR.

[0076] Finally, save the modified link file and recompile to generate the firmware file.

[0077] A firmware generation method in the present application sets the target constant data after the interrupt vector table and adjacent to the interrupt vector, generates a corresponding link file based on a link script, further recompiles the firmware file, and finally obtains the firmware file; and achieves the technical effect of small code changes and no impact on program processing logic. At the same time, since it does not rely on the constant data storage address, it has high adaptability and significantly improves the compatibility and convenience of the firmware file.

[0078] Figure 2 The present invention provides a method for online terminal firmware upgrade, the execution subject of the method is a terminal, and the terminal can be a phone, a laptop computer, a tablet computer, etc. Figure 2 As shown, the method may include:

[0079] S210: Acquire a new firmware file information package and acquire first firmware version information, wherein the new firmware file is obtained by the above-mentioned firmware generation method, and the first firmware version information is firmware version information that the terminal is expected to upgrade.

[0080] When the firmware is upgraded online, the terminal can send a download request to the server through the network so that the server can send the new firmware, or the server can send the new firmware to the terminal by itself through the network.

[0081] In order to improve download efficiency and reduce the number of retransmissions triggered by download failures, the firmware data of the new firmware can be downloaded to the terminal in sequence by means of packet download.

[0082] Further, through the firmware generation method, the firmware version information is set after the interrupt vector table and adjacent to the interrupt vector table. Based on the data length of the interrupt vector table, the address offset of the firmware version information is determined. Based on the link script, a link file is obtained in which the firmware version information is set after the interrupt vector table, and the firmware file is recompiled to obtain a new firmware file, such as Figure 3 As shown, the internal data layout of the new firmware is shown. Figure 4The following is a comparison of the internal data layout of the new firmware and the traditional firmware.

[0083] In a possible embodiment, obtaining the new firmware file and the first firmware version information includes:

[0084] Get the configuration file corresponding to the new firmware file;

[0085] The first firmware version information is read from the configuration file.

[0086] Before obtaining the new firmware file, the terminal first obtains the first firmware version information in the configuration file corresponding to the new firmware file, and the first firmware version information is the firmware version information that the terminal is expected to upgrade.

[0087] S220. Obtain the firmware version information address offset according to the size of the interrupt vector table of the new firmware file information packet to obtain second firmware version information, wherein the second firmware version information is the version information of the new firmware file.

[0088] In a possible embodiment, obtaining the firmware version information address offset according to the size of the interrupt vector table of the new firmware file to obtain the second firmware version information includes:

[0089] Get the interrupt vector table of the new firmware file;

[0090] According to the size of the interrupt vector table, the address offset of the firmware version information is obtained;

[0091] Based on the firmware version information address offset, the second firmware version information is read.

[0092] For example, when obtaining the second firmware version information of the new firmware by reading data, the first 4K data of the new firmware file is read as a byte array, and the second firmware version information of the new firmware is obtained according to the address offset of the firmware version information. The data length of the interrupt vector table of a certain MCU chip is (71*4)=284, then the address offset of the firmware version information relative to the interrupt vector table is 284, which is the data length of the interrupt vector table.

[0093] S230: Obtain a verification result based on the first firmware version information and the second firmware version information, and determine that the terminal firmware is to be upgraded online based on the verification result.

[0094] When the server issues the new firmware, it manually uploads the upgrade package of the new firmware file to the server, and when uploading the upgrade package of the new firmware file, it is necessary to fill in the configuration file of the new firmware file to indicate the firmware version, so the first firmware version information in the configuration file is different from the second firmware version information in the new firmware file. Therefore, it is necessary to verify whether the second firmware version information of the new firmware file is correct based on the first firmware version information.

[0095] Specifically, if the first firmware version information matches the second firmware version information, the terminal firmware is upgraded online; if they do not match, the online upgrade is exited and an upgrade failure is prompted.

[0096] In the present application, the new firmware is downloaded in sub-packages, and the sub-package data of the new firmware is updated package by package, that is, updated while downloading.

[0097] The present application provides a terminal firmware online upgrade method, which obtains a new firmware file through an existing firmware generation method, obtains a firmware version information address offset according to the size of an interrupt vector table of an information packet of the new firmware file, so as to obtain second firmware version information, and uses the first firmware version information to verify whether the second firmware version is correct. If correct, the terminal firmware is upgraded online, that is, the version information of the new firmware file itself can be obtained without starting the firmware file, and after obtaining the first packet (i.e., information packet) data of the new firmware file, it can be determined whether the firmware version of the actually issued new firmware file is consistent with the firmware version information of the terminal expected to be upgraded, thereby ensuring the accuracy and security of the upgrade, and the operation is simple, which greatly reduces the difficulty of operation. The method can be widely used in firmware management systems, simplify the version upgrade process, and enhance the user's operating experience.

[0098] When the firmware needs to be ported to a new MCU platform, different platforms may have different Flash address ranges. Since the location of the version information in the technical solution of this application is fixed and close to the interrupt vector table, there is no need to worry about the change of the Flash address during the porting process.

[0099] Corresponding to the above method, the embodiment of the present application also provides a terminal firmware online upgrade device, such as Figure 5 As shown, the device comprises:

[0100] The download module 310 is used to obtain a new firmware file and first firmware version information, wherein the new firmware file is obtained by the above-mentioned firmware generation method, and the first firmware version information is the firmware version information that the terminal is expected to upgrade;

[0101] The acquisition module 320 is used to acquire the firmware version information address offset according to the size of the interrupt vector table of the new firmware file information packet to obtain the second firmware version information, wherein the second firmware version information is the version information of the new firmware file;

[0102] The verification module 330 obtains a verification result based on the first firmware version information and the second firmware version information, and determines that the terminal firmware is to be upgraded online based on the verification result.

[0103] In a possible embodiment, the download module 310 is further used for:

[0104] Get the configuration file corresponding to the new firmware file;

[0105] The first firmware version information is read from the configuration file.

[0106] In a possible embodiment, the acquisition module 320 is further configured to:

[0107] Get the interrupt vector table of the new firmware file;

[0108] According to the size of the interrupt vector table, the address offset of the firmware version information is obtained;

[0109] Based on the firmware version information address offset, the second firmware version information is read.

[0110] In a possible embodiment, the verification module 330 is further configured to:

[0111] If the first firmware version information matches the second firmware version information, the terminal firmware is upgraded online.

[0112] The functions of each functional unit of a terminal firmware online upgrade device provided in the above embodiment of the present application can be realized through the above method steps. Therefore, the specific working process and beneficial effects of each unit in a terminal firmware online upgrade device provided in the embodiment of the present application are not repeated here.

[0113] The present application embodiment also provides an electronic device 600, such as Figure 6 As shown, it includes a processor 601, a communication interface, a memory 602 and a communication bus, wherein the processor 601, the communication interface and the memory 602 communicate with each other through the communication bus.

[0114] Memory 602, used for storing computer programs;

[0115] The processor 601 is used to execute the program stored in the memory, and implements the following steps: obtaining a link script, wherein the link script is used to indicate: setting the target constant data after the interrupt vector table, and the starting address of the target constant data is adjacent to the ending address of the interrupt vector table; based on the link script, obtaining a firmware file in which the target constant data is set after the interrupt vector table, and obtaining a new firmware file information package and obtaining first firmware version information, wherein the new firmware file is obtained by a firmware generation method, and the first firmware version information is the firmware version information of the terminal expected to be upgraded; according to the size of the interrupt vector table of the new firmware file information package, obtaining the firmware version information address offset to obtain the second firmware version information, wherein the second firmware version information is the version information of the new firmware file; based on the first firmware version information and the second firmware version information, obtaining a verification result, and based on the verification result, determining that the terminal firmware is to be upgraded online.

[0116] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0117] The communication interface is used for communication between the above electronic device and other devices.

[0118] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0119] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0120] The implementation methods and beneficial effects of the components of the electronic device in the above embodiments to solve the problems can be found in Figure 2 The various steps in the illustrated embodiment are implemented, therefore, the specific working process and beneficial effects of the electronic device provided by the embodiment of the present application are not repeated here.

[0121] In another embodiment provided in the present application, a computer-readable storage medium is also provided, which stores instructions. When the computer-readable storage medium is run on a computer, the computer executes any one of the firmware generation methods and terminal firmware online upgrade methods in the above embodiments.

[0122] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any one of the firmware generation methods and terminal firmware online upgrade methods in the above embodiments.

[0123] Those skilled in the art will appreciate that the embodiments in the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt a complete hardware embodiment, a complete software embodiment, or a form of an embodiment combining software and hardware. Moreover, the present application may adopt a form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0124] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0127] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present application.

[0128] Obviously, those skilled in the art can make various changes and modifications to the embodiments in the present application without departing from the spirit and scope of the embodiments in the present application. Thus, if these modifications and variations of the embodiments in the present application fall within the scope of the claims and their equivalents in the embodiments of the present application, the embodiments of the present application are also intended to include these modifications and variations.

Claims

1. A firmware generation method, characterized in that: include: Obtaining a link script, wherein the link script is used to indicate that: the target constant data is set after the interrupt vector table, and the starting address of the target constant data is adjacent to the ending address of the interrupt vector table; Based on the link script, a firmware file is obtained in which the target constant data is set after the interrupt vector table.

2. The method according to claim 1, characterized in that Obtaining a link script, wherein the link script is used to indicate that the target constant data is set after the interrupt vector table, and the starting address of the target constant data is adjacent to the ending address of the interrupt vector table, and further comprising: The interrupt vector table and the target constant data are set at the file start position of the firmware file.

3. The method according to claim 1, characterized in that Obtaining a link script, wherein the link script is used to indicate that the target constant data is set after the interrupt vector table, and the starting address of the target constant data is adjacent to the ending address of the interrupt vector table, and further comprising: Obtaining the starting address of the interrupt vector table; Based on the starting address of the interrupt vector table and the data length of the interrupt vector table, an address offset is obtained, and the address offset is the address offset of the target constant data.

4. The method according to claim 1 or 2, characterized in that: Based on the link script, a firmware file is obtained in which the target constant data is set after the interrupt vector table, including: Get the first data block where the interrupt vector table is located; Obtaining a second data block where the target constant data is located; Based on the link script, the second data block is located after the first data block and adjacent to the first data block, so as to obtain a firmware file in which the target constant data is set after the interrupt vector table.

5. The method according to claim 1 or 2, characterized in that: The target constant data includes firmware version information, hardware configuration data and system parameters.

6. A terminal firmware online upgrade method, characterized in that: include: Acquire a new firmware file information package and acquire first firmware version information, wherein the new firmware file is obtained by the firmware generation method according to any one of claims 1 to 5, and the first firmware version information is firmware version information that the terminal is expected to upgrade; According to the size of the interrupt vector table of the new firmware file information packet, the firmware version information address offset is obtained to obtain the second firmware version information, wherein the second firmware version information is the version information of the new firmware file; A verification result is obtained based on the first firmware version information and the second firmware version information, and based on the verification result, it is determined that the terminal firmware is to be upgraded online.

7. The method according to claim 6, characterized in that Based on the verification results, determine that the terminal firmware is upgraded online, including: If the first firmware version information matches the second firmware version information, the terminal firmware is upgraded online.

8. The method according to claim 6, characterized in that The obtaining of the first firmware version information includes: Obtaining a configuration file corresponding to the new firmware file; The first firmware version information is read from the configuration file.

9. An electronic device, characterized in that: include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used to store computer programs; the processor is used to implement the method steps described in any one of claims 1 to 5 or any one of claims 6 to 8 when executing the program stored in the memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 5 or any one of claims 6 to 8 are implemented.