Linux-based special transformer acquisition terminal firmware optimization method

By extracting static variable data, dynamically loading three-party libraries and selecting inactive modules during the firmware upgrade process of Linux terminals, combining version maintenance and protection mechanisms, the problem of low success rate of firmware upgrade at the energy controller terminal is solved, firmware optimization and automation upgrade are achieved, and the performance and maintainability of the equipment are improved.

CN119556955AInactive Publication Date: 2025-03-04QINGDAO ITECHENE TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411713280.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-03-04
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

During the remote firmware upgrade process, the energy controller terminal has a low success rate due to the excessive firmware size, and the firmware optimization method affects the upgrade speed of the equipment, the use of storage space and the maintainability of the code.

Method used

The special-variable terminal firmware optimization method based on Linux is adopted. By extracting static variable data into the bin file during the code compilation stage, the three-party library is dynamically loaded, and inactive modules are selected through the construction options during the construction stage, four types of upgrade packages are designed, and the firmware optimization and automated upgrade are achieved in combination with version maintenance and protection mechanisms.

Benefits of technology

It effectively reduces the size of the firmware, improves the success rate and speed of firmware upgrades, reduces storage space requirements, improves code maintainability, and ensures the security and stability of the upgrade.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119556955A_ABST
    Figure CN119556955A_ABST
Patent Text Reader

Abstract

The invention relates to the field of firmware upgrading methods, in particular to a Linux-based special transformer acquisition terminal firmware optimization method, which comprises a firmware optimization method and a version maintenance method, the firmware optimization method comprises the following steps: extracting static variable data into a bin file, using a dynamic three-party library, and realizing construction selection of inactive modules by adding construction options; the version maintenance method comprises the following steps: performing version identification on each module, so that various modules corresponding to the same version adopt the same version number, and the versions of the various modules are automatically synchronized; and comparing module versions and then automatically upgrading. The invention provides a universal firmware optimization scheme, the firmware optimization is realized by decoupling the modules with low activity in the firmware and extracting the three-party library, and the security and stability of upgrading are ensured by using a version maintenance and protection mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of firmware upgrade methods, and in particular to a Linux-based dedicated variable acquisition terminal firmware optimization method. Background Art

[0002] In actual field applications, the State Grid Energy Controller (ECU) needs to perform remote firmware upgrades (OTA) on a large number of terminals from time to time as needed to ensure equipment maintenance and function updates. Among them, the content of the firmware upgrade is mainly the application layer release program. Due to the scattered installation locations of energy controller terminals and the uneven network signal quality in the area, for example, some devices are installed in mountainous areas, and the remote upgrade success rate is often low because the firmware is too large. At the same time, the firmware optimization method indirectly affects the upgrade speed of the equipment, the use of storage space, and the maintainability of the code. Therefore, the firmware size optimization method and code version maintenance of the energy controller are particularly important for solving this problem. Summary of the invention

[0003] The present invention aims to solve the above problems and provides a method for optimizing the firmware of a dedicated transformer acquisition terminal based on Linux. The technical solution adopted is as follows: A Linux-based dedicated variable acquisition terminal firmware optimization method, including a firmware optimization method and a version maintenance method. The firmware optimization method comprises: A1. During the code compilation phase, search for static variable data with a predetermined size in the code and extract the data into a bin file, which is dynamically loaded into memory when the device is turned on; A2. The program uses dynamic third-party libraries, and the corresponding third-party libraries are loaded during program operation; A3. During the build phase, add build options to enable build selection of inactive modules. The version maintenance method includes: B1. During the code compilation phase, the bin files, third-party libraries, and user packages described in the firmware optimization method are versioned so that all modules corresponding to the same version use the same version number; B2. During the construction phase, the version numbers of the compiled bin files, third-party libraries, and user packages are synchronized to the text of the device upgrade script through an automated script to automatically synchronize the versions of various modules; B3. During the device upgrade phase, the upgrade script compares the current version of the module in the firmware with the version available for upgrade. If the version available for upgrade is higher than the current version, the corresponding module in the firmware is automatically upgraded.

[0004] On the basis of the above scheme, the construction selection of inactive modules is realized by designing four types of upgrade packages, and the upgrade packages include a. complete package, which includes the bin file formed in step A1, the third-party library package and the user package described in step A2; b. third-party library package and user package; c. user package; d. third-party library package.

[0005] Preferably, the version maintenance method also includes a method for updating and managing the code version, which includes: (1) During the code compilation phase, the script identifies code changes. If any code changes are found, the script checks whether the corresponding firmware version number has been updated. If the version number has not been updated, a prompt is given; (2) During the build phase, the modified program is added to the firmware, and the upgrade script identifies whether the firmware version number has been updated. If the version number has not been updated, a prompt will be given.

[0006] Preferably, the firmware optimization method further includes a protection mechanism, which is used to identify whether the device contains the module to be upgraded before the module is upgraded. (1) If the device contains the module to be upgraded, proceed directly to step B3; (2) If the device does not yet contain the module to be upgraded, place the module in the device before upgrading.

[0007] On the basis of the above scheme, if the protection mechanism recognizes that the device does not yet contain the module to be upgraded, it will provide information feedback, identify the specific missing module, and manually add the corresponding module to the device.

[0008] Preferably, the standard format of the version number is *.*.*.

[0009] The beneficial effects of the present invention are as follows: a general firmware optimization solution is provided, which optimizes the firmware by decoupling the modules with low activity in the firmware and extracting the third-party library. At the same time, a flexible construction solution is provided to generate a firmware image package that meets the requirements in response to the upgrade requirements of different scenarios; in order to achieve the optimal firmware optimization selection, the solution uses version maintenance and protection mechanisms to ensure the security and stability of the upgrade. The solution does not rely on additional hardware devices and does not affect the logic of the original code. It has universal applicability to terminal devices and effectively reduces the size of the upgraded firmware, greatly improving the success rate and upgrade speed of the firmware upgrade, reducing the storage space required for the firmware, and improving the maintainability of the code. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 : Flowchart of the firmware optimization method of the present invention; Figure 2 : Schematic diagram of implementation of the scheme of the present invention. DETAILED DESCRIPTION

[0011] The present invention will be further described below in conjunction with the accompanying drawings and embodiments: like Figure 2 As shown, this embodiment is based on the solution of burning the firmware program of the Nuvoton NUC972 main control chip. The terminal firmware using other chips or other types of functions can also be optimized using this solution.

[0012] A Linux-based dedicated variable acquisition terminal firmware optimization method, including a firmware optimization method and a version maintenance method. The firmware optimization method comprises: A1. During the code compilation phase, search for static variable data with a predetermined size in the code, and extract the data into a bin file, which is dynamically loaded into the memory when the device is turned on; so that the bin file can be upgraded separately; the static variable data, such as font data, can generally extract a data volume of several hundred k to several M bytes. The size of the extracted size is adjusted according to the specific manufacturer, code, and data type. The extracted bin file can be regarded as a third-party library.

[0013] A2. The program uses dynamic third-party libraries, and the corresponding third-party libraries are loaded during program operation; thereby reducing the linking of a large amount of code during the compilation stage and reducing the size of the firmware; A3. During the build phase, inactive modules can be selected by adding build options. For devices shipped out of the factory, some basic software does not participate in most upgrades, so building a decoupled firmware package can effectively reduce the size of the firmware package.

[0014] Specifically, the construction selection of inactive modules is achieved by designing four types of upgrade packages, which include a. a complete package, which includes the bin file formed in step A1, the third-party library package and the user package described in step A2; b. a third-party library package and a user package; c. a user package; d. a third-party library package.

[0015] Preferably, the firmware optimization method further includes a protection mechanism, which is used to identify whether the device contains the module to be upgraded before the module is upgraded. (1) If the device contains the module to be upgraded, proceed directly to step B3; (2) If the device has previously adopted other upgrade optimization methods, or has not yet been optimized and upgraded, and the device does not yet contain the module to be upgraded, the module should be placed in the device before upgrading. Specifically, if the protection mechanism recognizes that the device does not yet contain the module to be upgraded, it will provide information feedback, identify the specific missing module, clarify the reason for the inability to upgrade, and manually add the corresponding module to the device, so that the firmware optimization method is suitable for the automated upgrade of large quantities of equipment, and can ensure the normal use of the optimization plan and the normal operation of the equipment.

[0016] like Figure 1 As shown in the figure, <1 indicates an unoptimized version of the firmware, <1:0 indicates that the device lacks the module to be upgraded, <1:1 indicates that the device already contains the module to be upgraded, =1 indicates an optimized version, and >1 indicates an optimized version. According to the different upgrade requirements of the device, four types of upgrade packages, a, b, c, and d, are selected. The protection mechanism screens and classifies the existing modules in the device and selects the corresponding upgrade method.

[0017] During firmware upgrade and optimization, the versions of the extracted bin files, user packages, and third-party library packages need to correspond to ensure the normal operation of the device. Therefore, it is necessary to perform standardized version management on various files through version maintenance methods. The version maintenance method includes: B1. During the code compilation stage, the bin files, third-party libraries and user packages described in the firmware optimization method are version-marked so that various modules corresponding to the same version use the same version number; the standard format of the version number can be *.*.*, and the specific meaning can be project number-major version number-minor version number, etc.

[0018] B2. During the construction phase, the version numbers of the compiled bin files, third-party libraries, and user packages are synchronized to the text of the device upgrade script through an automated script to automatically synchronize the versions of various modules; B3. During the device upgrade phase, the upgrade script compares the current version of the module in the firmware with the version available for upgrade. If the version available for upgrade is higher than the current version, the corresponding module in the firmware is automatically upgraded.

[0019] The version maintenance method also includes a code version update management method to prevent human error from causing the version number to be not updated in time, which includes: (1) During the code compilation phase, the script identifies code changes. If any code changes are found, the script checks whether the corresponding firmware version number has been updated. If the version number has not been updated, a prompt is given; (2) During the build phase, the modified program is added to the firmware, and the upgrade script identifies whether the firmware version number has been updated. If the version number has not been updated, a prompt will be given.

[0020] The present invention is described above by way of examples, but the present invention is not limited to the above specific embodiments, and any changes or modifications made based on the present invention belong to the scope of protection claimed by the present invention.

Claims

1. A method for optimizing firmware of a dedicated acquisition terminal based on Linux, characterized in that: Including firmware optimization methods and version maintenance methods, The firmware optimization method comprises: A1. During the code compilation phase, search for static variable data with a predetermined size in the code and extract the data into a bin file, which is dynamically loaded into memory when the device is turned on; A2. The program uses dynamic third-party libraries, and the corresponding third-party libraries are loaded during program operation; A3. During the build phase, add build options to enable build selection of inactive modules. The version maintenance method includes: B1. During the code compilation phase, the bin files, third-party libraries, and user packages described in the firmware optimization method are versioned so that all modules corresponding to the same version use the same version number; B2. During the construction phase, the version numbers of the compiled bin files, third-party libraries, and user packages are synchronized to the text of the device upgrade script through an automated script to automatically synchronize the versions of various modules; B3. During the device upgrade phase, the upgrade script compares the current version of the module in the firmware with the version available for upgrade. If the version available for upgrade is higher than the current version, the corresponding module in the firmware is automatically upgraded.

2. According to a Linux-based dedicated transformer acquisition terminal firmware optimization method according to claim 1, it is characterized in that: The construction selection of inactive modules is realized by designing four types of upgrade packages, wherein the upgrade packages include a. a complete package, which includes the bin file formed in step A1, the third-party library package and the user package described in step A2; b. a third-party library package and a user package; c. a user package; d. Third-party library package.

3. The method for optimizing the firmware of a Linux-based dedicated acquisition terminal according to claim 1, characterized in that: The version maintenance method also includes a method for updating and managing the code version, which includes: (1) During the code compilation phase, the script identifies code changes. If any code changes are found, the script checks whether the corresponding firmware version number has been updated. If the version number has not been updated, a prompt is given; (2) During the build phase, the modified program is added to the firmware, and the upgrade script identifies whether the firmware version number has been updated. If the version number has not been updated, a prompt will be given.

4. The method for optimizing the firmware of a dedicated acquisition terminal based on Linux according to claim 2, characterized in that: The firmware optimization method also includes a protection mechanism, which is used to identify whether the device contains the module to be upgraded before the module is upgraded. (1) If the device contains the module to be upgraded, proceed directly to step B3; (2) If the device does not yet contain the module to be upgraded, place the module in the device before upgrading.

5. The method for optimizing the firmware of a Linux-based dedicated acquisition terminal according to claim 4, characterized in that: If the protection mechanism recognizes that the device does not yet contain the module to be upgraded, it will provide information feedback and identify the specific missing module, and manually add the corresponding module to the device.

6. The method for optimizing the firmware of a dedicated acquisition terminal based on Linux according to claim 1, characterized in that: The standard format of the version number is *.*.*.

Citation Information

Patent Citations

  • Method for realizing dynamic loading of program and method and equipment for generating mapping file

    CN101661397A

  • Smart watch OTA upgrading system and method

    CN113568636A

  • Manufacturing method and upgrading method based on terminal firmware upgrade package

    CN117519743A

  • Application program upgrading method and electronic equipment

    CN118981322A