Method and system for quickly upgrading engineering machinery controller software based on incremental compiling
By logically partitioning the Flash memory of the engineering machinery controller and configuring the dynamic function interface table, the decoupling compilation and incremental writing of the application program and the basic software are realized, which solves the problems of low efficiency and high risk in embedded controller software upgrades and improves development and maintenance efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-07
AI Technical Summary
In existing technologies, embedded controller software has a high degree of compilation coupling, low upgrade efficiency, and risks in the upgrade process, making it impossible to achieve independent development and version management of application programs and basic software.
An incremental compilation method is used to logically partition the Flash memory of the engineering machinery controller, configure the dynamic function interface table, and compile the basic software and application separately to generate independent local binary image files. Only the application partition is incrementally written.
It achieves physical and logical decoupling between application programs and underlying software, improves software development and maintenance efficiency, reduces upgrade time and risk, and supports parallel development of the application layer and the underlying software layer.
Smart Images

Figure CN121807349A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of embedded software technology, and specifically to a method and system for rapid upgrade of engineering machinery controller software based on incremental compilation. Background Technology
[0002] In the development of embedded controllers in fields such as engineering machinery, software complexity is increasing daily. Traditionally, the application program (application layer algorithms, business logic) and the underlying software (lower-level drivers, operating system, communication stack) are compiled into a complete firmware image. When the application layer needs to be modified or upgraded, even if the change is minor, the entire system must be fully compiled and flashed. This process is time-consuming and seriously affects the efficiency of development iteration and field maintenance. At the same time, full flashing also brings the risk of system instability due to unexpected changes in the underlying software. Chinese invention patent publication number CN114253574A discloses an embedded software upgrade method, which reduces data transmission through differential upgrade, but the software itself is still compiled as a whole, and the generation of the upgrade package still depends on the old version of the full firmware, and it does not fundamentally solve the problem of decoupling the application and the underlying layer during the compilation stage. Therefore, the existing technology has the following defects: (1) High compilation coupling: the application and the underlying software need to be compiled as a whole, and independent development and version management cannot be achieved; (2) Low upgrade efficiency: any minor change requires processing the entire firmware, and the compilation and flashing time is long; (3) Concentrated risk: the upgrade process involves the entire system, and the risk of the basic software being accidentally overwritten is high. Summary of the Invention
[0003] This invention aims to solve the problems of low efficiency and high risk in the compilation and upgrading of controller software in the prior art. It provides a method and system for rapid upgrading of engineering machinery controller software based on incremental compilation, which realizes the physical and logical separation of application programs and basic software on a general-purpose controller chip, supports separate compilation, independent linking and incremental flashing of the two, thereby greatly improving the efficiency and security of software development and maintenance.
[0004] To achieve the above objectives, the present invention employs the following solution: In a first aspect, the present invention provides a method for rapid upgrade of engineering machinery controller software based on incremental compilation, comprising: Logical partitioning of the Flash memory of the engineering machinery controller chip; Configure the dynamic function interface table and compile and link the application; The basic software and applications are compiled separately. For applications, a local binary image file containing only its own code and data is generated. Perform incremental flashing, only erasing and rewriting the application partition, to complete the rapid application upgrade.
[0005] Preferably, the logical partitioning of the Flash memory of the engineering machinery controller chip includes: Bootloader partition: Used to store the bootloader and is responsible for software updates, verification, and boot management; Basic software partition: Used to store stable code and data for the operating system, hardware abstraction layer, and communication drivers; Application partition: Used to store code and data that user application logic and control algorithms need to be frequently modified; Dynamic function interface table partition: A fixed memory area used to store function pointers for mutual calls between the application layer and the basic software layer. The function pointers are predefined at indexes or offset addresses in the interface table.
[0006] Preferably, the configuration dynamic function interface table includes: Define the service interfaces provided by the base software layer to the application layer, and the callback interfaces registered by the application layer to the base software layer; During system initialization, the basic software layer and the application layer register function pointers respectively. Specifically, when the system starts, the basic software fills the address of the service function into the function pointer position defined in the dynamic function interface table; when the application is initialized, it fills the address of its callback function into another function pointer position defined in the dynamic function interface table.
[0007] Preferably, the application compilation and linking configuration method is as follows: During compilation, the application does not directly link to the entity functions of the underlying software, but instead links to the corresponding function pointer locations in the dynamic function interface table.
[0008] Preferably, the separate compilation of the basic software and the application includes: The base software is compiled into a static library or a standalone executable unit, and its code and data segments are fixed to the base software partition by the linker script; The application's linker script explicitly specifies that its code segment and data segment are located in the application partition, and performs external references and address mappings for symbols in the dynamic function interface table. Finally, after the application is compiled, it generates an independent local binary image file that does not contain the underlying software code.
[0009] Preferably, the incremental write operation only involves erasing and writing to the application partition to complete the rapid application upgrade, including: After the bootloader starts, it checks if there are any new application images to be updated; If so, only the application partition will be erased, and the new application image will be written to that application partition; After the system is reset, the basic software is initialized and the dynamic function interface table is populated, and then execution jumps to the application entry address. The application calls the underlying services through the dynamic function interface table.
[0010] Preferably, after detecting that a new application image needs to be updated, it also includes: Perform integrity checks and authentication on the new application image.
[0011] Secondly, the present invention provides a rapid upgrade system for engineering machinery controller software based on incremental compilation, used to implement the aforementioned rapid upgrade method for engineering machinery controller software based on incremental compilation, the system comprising: The partitioning module is used to logically partition the Flash memory of the engineering machinery controller chip; The configuration module is used to configure the dynamic function interface table and application compilation and linking; The compilation module is used to compile the basic software and applications separately. For applications, it compiles to generate a local binary image file containing only its own code and data. The upgrade module is used for incremental flashing, which only erases and rewrites the application partition to complete the application upgrade quickly.
[0012] Thirdly, the present invention provides a computer-readable storage medium for storing one or more programs, the one or more programs including instructions that, when executed by a computing device, cause the computing device to perform any of the methods described above for the rapid upgrade method of engineering machinery controller software based on incremental compilation.
[0013] Fourthly, the present invention provides a computing device comprising one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising instructions for performing any of the methods described above in the method for rapid upgrade of engineering machinery controller software based on incremental compilation.
[0014] The beneficial effects of the technical solution of this invention are as follows: (1) This invention achieves complete decoupling of application programs and basic software in physical storage and logical linking through strict memory partitioning and dynamic function interface table. Application programs can generate independent image files that do not depend on the complete context of basic software. During on-site upgrades, only a small application layer image needs to be transmitted and written, resulting in less bandwidth and extremely short time.
[0015] (2) Improved development efficiency: In this invention, the application layer and the underlying layer teams can develop in parallel. After the application layer is modified, there is no need to wait for the entire system to be compiled, which greatly improves the iteration speed. The basic software layer remains stable, avoiding the risk of the underlying system's stability being compromised due to application layer upgrades.
[0016] (3) This method does not depend on a specific chip architecture and can be widely used in various embedded controllers. Attached Figure Description
[0017] Figure 1 This is a schematic diagram illustrating the logical partitioning of the Flash memory of the controller chip in this invention; Figure 2 This is a schematic diagram of the interaction between the various layers of the controller chip architecture in this invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments and accompanying drawings. Here, the illustrative embodiments and descriptions of this invention are used to explain the invention, but are not intended to limit the invention.
[0019] It should also be noted that, in order to avoid obscuring the invention with unnecessary details, only the structures and / or processing steps closely related to the solution according to the invention are shown in the accompanying drawings, while other details that are not closely related to the invention are omitted.
[0020] It should be emphasized that the term "including / comprises" as used herein refers to the presence of a feature, element, step, or component, but does not exclude the presence or addition of one or more other features, elements, steps, or components.
[0021] It should also be noted that, unless otherwise specified, the term "connection" in this article can refer not only to a direct connection, but also to an indirect connection involving an intermediary.
[0022] In the following description, embodiments of the invention will be illustrated with reference to the accompanying drawings. In the drawings, the same reference numerals represent the same or similar parts, or the same or similar steps.
[0023] It should be emphasized here that the step markers mentioned below are not a limitation on the order of the steps, but should be understood as meaning that the steps can be executed in the order mentioned in the embodiments, or in a different order than in the embodiments, or several steps can be executed simultaneously.
[0024] This invention provides a method for rapid upgrade of engineering machinery controller software based on incremental compilation, specifically including the following steps: S1. Logically partition the Flash memory of the controller chip. To achieve separate compilation and flashing, step S1 first logically partitions the controller chip's Flash memory, see [link to relevant documentation]. Figure 1 The partitions are as follows: Bootloader partition: Stores the bootloader and is responsible for software updates, verification, and startup management.
[0025] Basic Software (BSW) partition: stores stable code and data such as the operating system, hardware abstraction layer, and communication drivers.
[0026] Application (APP) partition: Stores code and data that need to be frequently modified, such as user application logic and control algorithms.
[0027] Dynamic function interface table partition: A fixed memory area used to store function pointers for mutual calls between the application layer and the basic software layer. The function pointers are predefined at indexes or offset addresses in the interface table.
[0028] S2. Software Interface Definition and Dynamic Linking Mechanism Interface standardization: Clearly define the service interfaces provided by the basic software layer to the application layer (such as COM_SendMsg, IO_SetPin) and the callback interfaces registered by the application layer to the basic software layer (such as App_Callback).
[0029] Interface table initialization: During system initialization, the basic software layer and the application layer register function pointers respectively. Specifically, when the system starts, the basic software fills the address of its service function into the function pointer position defined in the dynamic function interface table; when the application is initialized, it fills the address of its callback function into another function pointer position defined in the dynamic function interface table.
[0030] Compile-time decoupling: The application and underlying software are compiled separately. During compilation, the application does not directly link to the entity functions of the underlying software; instead, it links to the corresponding function pointer locations in the dynamic function interface table. This is achieved through a specific linker script.
[0031] The function pointer positions in the interface table are defined as follows: / / Common header file: interface_table.h typedef struct { / / Services provided by BSW (first 32) void (*ADC_Read)(uint8_t ch, uint16_t* value); / / Offset 0 void (*CAN_Send)(uint32_t id, uint8_t* data, uint8_t len); / / Offset 4 (32-bit system) void (*Timer_Start)(uint8_t timer_id, uint32_t period_ms); / / Offset 8 / / ... More BSW services / / Callbacks provided by the app (last 32) void (*App_FaultHandler)(uint8_t fault_code); / / Offset 128 void (*App_DataReadyCallback)(void); / / offset 132 / / ... More app callbacks InterfaceTable_t; / / Fix the address of this structure in the linker script extern InterfaceTable_t g_InterfaceTable __attribute__((section(".InterfaceTable"))); / / BSW initialization code snippet void BSW_Init(void) { / / Enter the BSW service function address into the specified location in the interface table. g_InterfaceTable.ADC_Read =&BSW_ADC_Read_Function; g_InterfaceTable.CAN_Send =&BSW_CAN_Send_Function; g_InterfaceTable.Timer_Start =&BSW_Timer_Start_Function; / / ... populate other services } / / App initialization code snippet void APP_Init(void) { / / Fill the APP callback function address into the specified location in the interface table. g_InterfaceTable.App_FaultHandler =&APP_FaultHandler_Function; g_InterfaceTable.App_DataReadyCallback =&APP_DataReady_Function; / / ... Fill in other callbacks }
[0032] Configuration and interaction flow at each layer are as follows Figure 2 As shown.
[0033] S3. Compile the basic software and applications separately. For applications, compile to generate a local binary image file containing only its own code and data. In step S3, the basic software is compiled into a static library or a standalone executable unit, and its code segment and data segment are fixed to the basic software partition by the linker script.
[0034] The application uses a separate project and linker script. The linker script explicitly specifies that its code and data segments are located in the application partition and performs external references and address mappings for symbols in the dynamic function interface table. Finally, the compiled application generates a separate, local binary image file that does not contain the underlying software code.
[0035] S4, incremental flashing, only erases and writes to the application partition, and performs security checks during the process, specifically including: Version check: After the bootloader starts, it checks if there are any new application images to be updated.
[0036] Verification and Security: Perform integrity verification and authentication on the new image.
[0037] Partition flush: Only erases the application partition and writes a new partial image of the application to that partition.
[0038] Startup and execution: After system reset, the basic software initializes and populates the dynamic function interface table, then jumps to the application's entry point for execution. The application calls basic services through the dynamic function interface table.
[0039] Based on the same inventive concept, this invention also provides a rapid upgrade system for engineering machinery controller software based on incremental compilation, used to implement the above-mentioned rapid upgrade method for engineering machinery controller software based on incremental compilation. The system includes: The partitioning module is used to logically partition the Flash memory of the engineering machinery controller chip; The configuration module is used to configure the dynamic function interface table and application compilation and linking; The compilation module is used to compile the basic software and applications separately. For applications, it compiles to generate a local binary image file containing only its own code and data. The upgrade module is used for incremental flashing, which only erases and rewrites the application partition to complete the application upgrade quickly.
[0040] Based on the same inventive concept, the present invention also provides a computer-readable storage medium for storing one or more programs, said one or more programs including instructions that, when executed by a computing device, cause the computing device to perform any of the methods described above for rapidly upgrading engineering machinery controller software based on incremental compilation.
[0041] Based on the same inventive concept, the present invention also provides a computing device, including one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for performing any of the methods described above in the method for rapid upgrade of engineering machinery controller software based on incremental compilation.
[0042] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied 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.
[0043] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0044] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0045] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0046] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for rapid upgrade of engineering machinery controller software based on incremental compilation, characterized in that, include: Logical partitioning of the Flash memory of the engineering machinery controller chip; Configure the dynamic function interface table and compile and link the application; The basic software and applications are compiled separately. For applications, a local binary image file containing only its own code and data is generated. Perform incremental flashing, only erasing and rewriting the application partition, to complete the rapid application upgrade.
2. The method for rapid upgrade of engineering machinery controller software based on incremental compilation according to claim 1, characterized in that, The logical partitioning of the Flash memory of the engineering machinery controller chip includes: Bootloader partition: Used to store the bootloader and is responsible for software updates, verification, and boot management; Basic software partition: Used to store stable code and data for the operating system, hardware abstraction layer, and communication drivers; Application partition: Used to store code and data that user application logic and control algorithms need to be frequently modified; Dynamic function interface table partition: A fixed memory area used to store function pointers for mutual calls between the application layer and the basic software layer. The function pointers are predefined at indexes or offset addresses in the interface table.
3. The method for rapid upgrade of engineering machinery controller software based on incremental compilation according to claim 2, characterized in that, The configuration dynamic function interface table includes: Define the service interfaces provided by the base software layer to the application layer, and the callback interfaces registered by the application layer to the base software layer; During system initialization, the basic software layer and the application layer register function pointers respectively. Specifically, when the system starts, the basic software fills the address of the service function into the function pointer position defined in the dynamic function interface table; when the application is initialized, it fills the address of its callback function into another function pointer position defined in the dynamic function interface table.
4. The method for rapid upgrade of engineering machinery controller software based on incremental compilation according to claim 3, characterized in that, The application compilation and linking configuration method is as follows: During compilation, the application does not directly link to the entity functions of the underlying software, but instead links to the corresponding function pointer locations in the dynamic function interface table.
5. The method for rapid upgrade of engineering machinery controller software based on incremental compilation according to claim 3, characterized in that, The separate compilation of basic software and applications includes: The base software is compiled into a static library or a standalone executable unit, and its code and data segments are fixed to the base software partition by the linker script; The application's linker script explicitly specifies that its code segment and data segment are located in the application partition, and performs external references and address mappings for symbols in the dynamic function interface table. Finally, after the application is compiled, it generates an independent local binary image file that does not contain the underlying software code.
6. The method for rapid upgrade of engineering machinery controller software based on incremental compilation according to claim 5, characterized in that, The incremental write operation, which only erases and rewrites the application partition to complete the rapid application upgrade, includes: After the bootloader starts, it checks if there are any new application images to be updated; If so, only the application partition will be erased, and the new application image will be written to that application partition; After the system is reset, the basic software is initialized and the dynamic function interface table is populated, and then execution jumps to the application entry address. The application calls the underlying services through the dynamic function interface table.
7. The method for rapid upgrade of engineering machinery controller software based on incremental compilation according to claim 6, characterized in that, After detecting that a new application image is pending update, the following is also included: Perform integrity checks and authentication on the new application image.
8. A rapid upgrade system for engineering machinery controller software based on incremental compilation, characterized in that, The system for implementing the rapid upgrade method for engineering machinery controller software based on incremental compilation as described in claim 1 includes: The partitioning module is used to logically partition the Flash memory of the engineering machinery controller chip; The configuration module is used to configure the dynamic function interface table and application compilation and linking; The compilation module is used to compile the basic software and applications separately. For applications, it compiles to generate a local binary image file containing only its own code and data. The upgrade module is used for incremental flashing, which only erases and rewrites the application partition to complete the application upgrade quickly.
9. A computer-readable storage medium for storing one or more programs, characterized in that, The one or more programs include instructions that, when executed by a computing device, cause the computing device to perform any of the methods in the rapid upgrade method for engineering machinery controller software based on incremental compilation according to claims 1 to 7.
10. A computing device, characterized in that, include, One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing any of the methods in the incremental compilation-based rapid upgrade method for engineering machinery controller software according to claims 1 to 7.
Citation Information
Patent Citations
Embedded software upgrading mode switching method and device, equipment and medium
CN114253574A