An Embedded System Application Update Method, Device, and Storage Medium
By using Lua to write programs in embedded systems to dynamically load updated application dynamic library files, the cumbersome update process in the existing technology is solved, the update without restarting the system is achieved, and the R&D efficiency is improved.
Patent Information
- Application Number
- CN202211109622.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-13
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2042-09-13
AI Technical Summary
The update process of existing embedded system applications is cumbersome and requires frequent compilation, linking, downloading and restarting of the system, which greatly limits the R&D efficiency.
Use Lua to write programs in the host computer, dynamically load updated application dynamic library files into system memory, avoid restarting the system, and use a plug-in framework to update the system.
It realizes the ability to run updated applications without restarting the system, improves development efficiency, and simplifies the management and maintenance of various application module versions.
Smart Images

Figure CN115437671B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method, device and storage medium for updating an embedded system application program, and belongs to the technical field of embedded systems. Background Art
[0002] Embedded systems are widely popularized and applied. Their flexibility is reflected in that when configuring relevant hardware devices in a specific field, the system software can be trimmed and the R & D application software can be configured, so that the embedded product after integrating hardware and software resources can be adapted to specific application scenarios, and customization can be achieved using general components.
[0003] Since the software and hardware resources of an embedded system are trimmed and customized according to the actual application scenario, the modification or update work involved in the R & D process or actual application of the embedded system will be very complex. After the embedded system is trimmed and optimized according to the hardware resources of the product, the basic functions such as interrupt processing and task scheduling are generally solidified and there is generally no frequent modification or update; however, it is very likely that multiple application software Apps running in the system need to be modified or updated.
[0004] During the R & D process of an embedded system, especially an industrial-grade embedded system, on the one hand, when a certain application program needs to be continuously modified, compiled, debugged and tested, the target program needs to be repeatedly written into the memory of the embedded device; on the other hand, when the operating condition requirements change and the application function needs to be updated, when a module with a new sensor is replaced, the corresponding software application must be modified to adapt to the change in the sampling data accuracy, so that the hardware and software must be updated at the same time. It can be seen that for an embedded system product device, the update of application software often occurs. In the modular processing of embedded application programs, the coupling degree between applications is very low, which is suitable for separate maintenance and update.
[0005] The update scheme of the application program must be formulated according to the system framework. Common embedded software system frameworks such as Figure 1As shown in the figure. The software system includes the embedded device master control system Sys_MC, the device human-machine interaction system Sys_HMI, and the database configuration management system Sys_DB. Among them, the device master control system Sys_MC and the human-machine interaction system Sys_HMI run on the embedded device. The device master control system Sys_MC runs on the master CPU module, and the human-machine interaction system Sys_HMI runs on the HMI module. They communicate with each other through the internal serial port or Ethernet of the device. The device interface can display the operating status of the device and operate the device through devices such as industrial touch screens. The database configuration management system Sys_DB of the upper computer is a desktop application software running on the upper computer, such as the industrial control upper computer system software, which performs database configuration management on the embedded system and communicates with the device human-machine interaction system through the serial port or Ethernet. The embedded device can run independently after the database is configured by the upper computer software, or it can run online with the upper computer to read the device operation data in real time.
[0006] If the application program in the master control system software needs to be updated, the corresponding interface control and data display programs in the human-machine interaction system software also need to be updated, and the corresponding database configuration program in the database configuration management system of the upper computer also needs to be updated. That is, the update of an application program in the embedded device master control system involves a series of update operations of three systems.
[0007] According to the above system framework, the existing update process of embedded system applications is very cumbersome, and the three system softwares need to be updated separately. As Figure 2 shown, the application program is compiled, linked, and run in the three systems, and the source code file generates a dynamic library file through the compiler.
[0008] For the application program of the embedded device master control system, the mainstream systems are all written in C language. After modifying the source codes AppA_mc.h and AppA_mc.c of the application on the host computer, the corresponding object file AppA_mc.o is generated after GCC preprocessing, compilation, and assembly. Then, AppA_mc.o is linked together with other unmodified.o files to generate an ELF executable file or generate a Sys_MC.bin file, which is downloaded to the storage device of the target device master CPU module and restarted for operation. The release version is based on the version of the finally generated Sys_MC.bin file. Therefore, it is necessary to detail in the version description what updates have been made to which application program.
[0009] For the application programs of the device human - machine interaction system, C++ language is generally used for writing (Qt is more popular). Similarly, after modifying the source code of the function files AppA_hmi.h and AppA_hmi.cpp related to the application AppA, the corresponding object file AppA_hmi.o is generated on the host computer after GCC pre - processing, compilation, and assembly. Then, AppA_hmi.o is linked together with other unmodified.o files to generate an ELF executable file or generate a Sys_HMI.bin file, which is downloaded to the target device HMI module and restarted for operation. The release version is based on the version of the finally generated Sys_HMI.bin file. Therefore, it must be detailed in the version description which application program has made what kind of update.
[0010] For the application programs of the database configuration management system of the host computer, Visual Studio or Qt is generally used to develop desktop applications under the host computer system. Modify the database configuration management application programs AppA_db.cpp and AppA_db.h related to the embedded application AppA (both Visual Studio and Qt will use C++ language for the development of desktop application programs). Modifications are required for both the hardware data of the device and the software data configuration management of the application AppA. After generating the corresponding dynamic - library file AppA_db.obj through Visual Studio, it is linked with other unmodified.obj files to generate the Sys_DB.exe executable file. The release version is based on the version of the finally generated Sys_DB.exe file. Therefore, it must be detailed in the version description which application program has made what kind of update.
[0011] When the above - mentioned three systems are jointly tested, frequent compilation, linking, downloading, and restarting of the programs greatly limit the R & D efficiency. Summary of the Invention
[0012] The purpose of the present invention is to overcome the deficiencies in the prior art and provide a method, device, and storage medium for updating application programs in an embedded system. By writing programs using Lua in the host computer, the updated application program dynamic - library files are dynamically loaded into the memory of each running system by the Lua program, and the system does not need to be restarted to run.
[0013] To achieve the above - mentioned purpose, the present invention is implemented by the following technical solutions:
[0014] In the first aspect, the present invention provides a method for updating application programs in an embedded system, including:
[0015] Obtain the version information of multiple embedded systems and the version information of the applications under their systems, and store them in the system memory, where the multiple embedded systems include an embedded device main control system, a device human - machine interaction system, and a database configuration management system;
[0016] Adopt a plug-in framework for multiple embedded systems, generate new applications respectively, and save the dynamic library files generated by each new application to a specified folder pre-generated.
[0017] Check whether the version information of each new application is consistent. If not, regenerate the dynamic library files with consistent versions.
[0018] When the embedded system runs online, load the dynamic library files with updated versions in the specified folder into the system memory through a Lua program, and then modify the update functions and upvalues in the updated application to complete the update.
[0019] Further, obtaining the version information of multiple embedded systems and the version information of the applications under these systems, and storing them in the system memory, includes:
[0020] Obtain the version information of the main control system Sys_MC of the embedded device and the version information of its applications AppA_MC and AppB_MC, and record them in the file system of the system Sys_MC.
[0021] Obtain the version information of the device human-machine interaction system Sys_HMI and the version information of its applications AppA_HMI and AppB_HMI, and record them in the file system of the system Sys_HMI.
[0022] Obtain the version information of the database configuration management system Sys_DB and the version information of AppA_DB and AppB_DB, and record them in the configuration file of Sys_DB.
[0023] Among them, the version information of the relevant programs AppA_MC, AppA_HMI, and AppA_DB of the same application is consistent in the three systems.
[0024] Further, the version information includes version number, version CRC, generation version time, and the version correspondence between the system and the application.
[0025] Further, adopting a plug-in framework for multiple embedded systems, generating new applications respectively, and saving the dynamic library files generated by each new application to a specified folder pre-generated, includes:
[0026] Adopt a plug-in framework for the main control system Sys_MC of the embedded device, generate the application AppA_DB.so in the corresponding host system, and save it to the plug-in specified folder Plugin_App of the upper computer.
[0027] The device human-machine interaction system Sys_HMI adopts a plug-in framework, generates the application AppA_HMI.so in the corresponding host system, and saves it to the plug-in specified folder Plugin_App of the upper computer;
[0028] The database configuration management system Sys_DB adopts a plug-in framework, generates the application AppA_DB.dll in the upper computer environment, and saves it to the plug-in specified folder Plugin_App of the upper computer.
[0029] Further, when the embedded system is running online, the updated version of the dynamic library file in the specified folder is loaded into the system memory through a Lua program, including:
[0030] The Lua program first checks whether the version information of the original application programs AppA_MC, AppA_HMI, and AppA_DB in the three systems is consistent. If it is inconsistent, it will not be updated. If it is consistent, the following updates will be carried out;
[0031] The Lua program creates a necessary buffer area in the Sys_MC system memory and loads the updated version of the dynamic library file AppA_MC.so in the folder Plugin_App into the Sys_MC system memory;
[0032] The Lua program creates a necessary buffer area in the Sys_HMI system memory and loads the updated version of the dynamic library file AppA_HMI.so in the folder Plugin_App into the Sys_HMI system memory;
[0033] The Lua program creates a necessary buffer area in the Sys_DB system memory and loads the updated version of the dynamic library file AppA_DB.dll in the folder Plugin_App into the upper computer Sys_DB memory.
[0034] Further, the Lua program creates a necessary buffer area in the Sys_MC system memory and loads the updated version of the dynamic library file AppA_MC.so in the folder Plugin_App into the Sys_MC system memory, including:
[0035] Use the Lua function debug.getupvalue to recursively traverse all functions and upvalues in the running original application, collect function and upvalue information, and save it to the original environment table;
[0036] Use the Lua function debug.getupvalue to recursively traverse all functions and upvalues in the updated application, and locate the functions and upvalues that need to be updated;
[0037] Use the Lua function `debug.upvaluejoin` to reference the updated function to all upvalues saved in the original environment table, and then replace the function to be updated with the updated function to ensure that the updated function can correctly replace the original function as the updated part of the application and run properly.
[0038] Furthermore, the Lua program creates necessary buffer areas in the Sys_HMI system memory and loads the updated version of the dynamic library file AppA_HMI.so in the folder Plugin_App into the Sys_HMI system memory, including:
[0039] Use the Lua function `debug.getupvalue` to recursively traverse all functions and upvalues in the running original application, collect function and upvalue information, and save it to the original environment table;
[0040] Use the Lua function `debug.getupvalue` to recursively traverse all functions and upvalues in the updated application to locate the functions and upvalues that need to be updated;
[0041] Use the Lua function `debug.upvaluejoin` to reference the updated function to all upvalues saved in the original environment table, and then replace the function to be updated with the updated function to ensure that the updated function can correctly replace the original function as the updated part of the application and run properly.
[0042] Furthermore, the Lua program creates necessary buffer areas in the Sys_DB system memory and loads the updated version of the dynamic library file AppA_DB.dll in the folder Plugin_App into the host computer Sys_DB memory, including:
[0043] Use the Lua function `debug.getupvalue` to recursively traverse all functions and upvalues in the running original application, collect function and upvalue information, and save it to the original environment table;
[0044] Use the Lua function `debug.getupvalue` to recursively traverse all functions and upvalues in the updated application to locate the functions and upvalues that need to be updated;
[0045] Use the Lua function `debug.upvaluejoin` to reference the updated function to all upvalues saved in the original environment table, and then replace the function to be updated with the updated function to ensure that the updated function can correctly replace the original function as the updated part of the application and run properly.
[0046] In a second aspect, the present invention provides an embedded system application program update device, including a processor and a storage medium;
[0047] The storage medium is used to store instructions;
[0048] The processor is used to operate according to the instructions to execute the steps of the method according to any one of the foregoing.
[0049] In a third aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the method according to any one of the foregoing are implemented.
[0050] Compared with the prior art, the beneficial effects achieved by the present invention:
[0051] The present invention provides an embedded system application program update method, device and storage medium. A program is written in Lua in the upper computer, and the updated application program dynamic library file is dynamically loaded into the memory of each running system by the Lua program, and it can run without restarting the system. Moreover, the plug-in system framework has good scalability, and Lua makes up for the deficiencies of C language in terms of dynamic data structure, robustness, debugging ability, etc.; it avoids repeatedly generating executable files, especially avoids repeatedly downloading files and frequently restarting the device in the embedded system, and improves development efficiency; the versions of each application module are easy to manage and maintain. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a schematic diagram of an embedded software system framework provided in the background art of the present invention;
[0053] Figure 2 It is a schematic diagram of the relationship between source code files and executable files of an application program in three systems provided in the background art of the present invention;
[0054] Figure 3 It is a schematic diagram of the relationship between source code files and dynamic library files of an application program in three systems provided in an embodiment of the present invention;
[0055] Figure 4 It is a schematic diagram of the application program update process flow provided in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0056] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention, and should not be used to limit the protection scope of the present invention.
[0057] Embodiment 1
[0058] As Figure 4 shown, this embodiment introduces an embedded system application program update method, including:
[0059] Obtain the version information of multiple embedded systems and the version information of the applications under these systems, and store them in the system memory. Among them, the multiple embedded systems include the main control system of the embedded device, the device human-computer interaction system, and the database configuration management system;
[0060] Adopt a plug-in framework for multiple embedded systems, generate new applications respectively, and save the dynamic library files generated by each new application to a pre-generated specified folder;
[0061] Check whether the version information of each new application is consistent. If not, regenerate the dynamic library files with consistent versions;
[0062] When the embedded system is running online, use the Lua program to load the dynamic library files with updated versions in the specified folder into the system memory, and then modify the update functions and upvalues in the updated application to complete the update.
[0063] The method for updating the embedded system application provided in this embodiment specifically involves the following steps in its application process:
[0064] 1. In this invention, a program is written in Lua on the host computer. The updated application program dynamic library files are dynamically loaded into the memory of each running system by the Lua program, and the system does not need to be restarted to run.
[0065] 2. The main control system Sys_MC, the human-computer interaction system Sys_HMI, and the database management configuration system Sys_DB involved in this invention distinguish the system versions and the versions of applications such as AppA and AppB under the system. Further, the test version and the final release version in the research and development of the application program should also be distinguished.
[0066] 2.1 In this invention, the version information of the embedded system Sys_MC and the version information of applications such as AppA_MC and AppB_MC are recorded in the file system of the system Sys_MC.
[0067] 2.2 In this invention, the version information of the embedded system Sys_HMI and the version information of applications such as AppA_HMI and AppB_HMI are recorded in the file system of the system Sys_HMI.
[0068] 2.3 In this invention, the version information of the host computer database configuration management system Sys_DB and the version information of applications such as AppA_DB and AppB_DB are recorded in the configuration file of Sys_DB.
[0069] 2.4 The version information of the relevant programs AppA_MC, AppA_HMI, and AppA_DB of the same application in the three systems is consistent.
[0070] 2.5 According to 2.4, the version information includes version number, version CRC, version generation time, the version correspondence between the system and the application, etc.
[0071] 3 The main control system Sys_MC, human-machine interaction system Sys_HMI, and database management and configuration system Sys_DB involved in the present invention respectively adopt a plug-in framework, and process the dynamic library files generated by the application as plug-ins. The dynamic library files are as Figure 3 shown. The version management of each application, that is, the plug-in, is easy to execute according to 2.
[0072] 3.1 In the present invention, the embedded main control system Sys_MC adopts a plug-in framework, generates the application AppA_DB.so in the corresponding host system and saves it to the plug-in designated folder Plugin_App of the upper computer.
[0073] 3.2 In the present invention, the embedded human-machine interaction system Sys_HMI adopts a plug-in framework, generates the application AppA_HMI.so in the corresponding host system and saves it to the plug-in designated folder Plugin_App of the upper computer.
[0074] 3.3 In the present invention, the upper computer database configuration management system Sys_DB adopts a plug-in framework, generates the application AppA_DB.dll in the upper computer environment and saves it to the plug-in designated folder Plugin_App of the upper computer.
[0075] 3.4 Check whether the updated versions of these three application programs are consistent. If they are not consistent, regenerate the dynamic library files with consistent versions. If they are consistent, then perform the following operations.
[0076] 4 When the above three systems are running online, run the Lua program to perform dynamic library file loading operations on the above three systems, and then modify the update functions and upvalues in the updated application.
[0077] 4.1 The Lua program first checks whether the version information of the original application programs AppA_MC, AppA_HMI, and AppA_DB in the three systems is consistent. If it is not consistent, it does not update. If it is consistent, the following updates are performed.
[0078] 4.2 Through the Lua program, allocate necessary buffer areas in the memory of the Sys_MC system, and load the updated version of the dynamic library file AppA_MC.so in the folder Plugin_App into the memory of the Sys_MC system.
[0079] Use the Lua function debug.getupvalue to recursively traverse all functions and upvalues in the running original application, collect function and upvalue information, and save it to the original environment table.
[0080] Use the Lua function debug.getupvalue to recursively traverse and update all functions and upvalues in the application, and locate the functions and upvalues that need to be updated.
[0081] Use the Lua function debug.upvaluejoin to reference the updated function to all the upvalues saved in the original environment table, and then use the updated function to replace the function to be updated, ensuring that the updated function can correctly replace the original function as the updated part of the application.
[0082] 4.3 Use a Lua program to allocate necessary buffer areas in the Sys_HMI system memory, and load the updated dynamic library file AppA_HMI.so in the Plugin_App folder into the Sys_HMI system memory.
[0083] Use the Lua function debug.getupvalue to recursively traverse all functions and upvalues in the running original application, collect function and upvalue information, and save it to the original environment table.
[0084] Use the Lua function debug.getupvalue to recursively traverse and update all functions and upvalues in the application, and locate the functions and upvalues that need to be updated.
[0085] Use the Lua function debug.upvaluejoin to reference the updated function to all the upvalues saved in the original environment table, and then use the updated function to replace the function to be updated, ensuring that the updated function can correctly replace the original function as the updated part of the application.
[0086] 4.4 Use a Lua program to allocate necessary buffer areas in the Sys_DB system memory, and load the updated dynamic library file AppA_DB.dll in the Plugin_App folder into the upper computer Sys_DB memory.
[0087] Use the Lua function debug.getupvalue to recursively traverse all functions and upvalues in the running original application, collect function and upvalue information, and save it to the original environment table.
[0088] Use the Lua function debug.getupvalue to recursively traverse and update all functions and upvalues in the application, and locate the functions and upvalues that need to be updated.
[0089] Use the Lua function debug.upvaluejoin to reference the updated function to all the upvalues saved in the original environment table, and then use the updated function to replace the function to be updated, ensuring that the updated function can correctly replace the original function as the updated part of the application.
[0090] The application update method designed by the present invention is suitable for running the update program without restarting the system during the R & D and testing process. The update program runs in the memory. If it is determined that the update program is a release version, it is still necessary to link the update program with other non-updated programs according to the traditional method ( Figure 2 as shown) to generate the target file and store it in the system hard disk.
[0091] Among them: Lua is a lightweight and compact scripting language, written in standard C language and open-sourced in source code form. Its design purpose is to be embedded in the application program to provide flexible extension and customization functions for the application program.
[0092] In the Lua language, non-local variables are called upvalues, which are non-local variables captured inside the closure.
[0093] Embodiment 2
[0094] This embodiment provides an embedded system application program update device, including a processor and a storage medium;
[0095] The storage medium is used to store instructions;
[0096] The processor is used to operate according to the instructions to execute the steps of the method described in any one of Embodiment 1.
[0097] Embodiment 3
[0098] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the steps of the method described in any one of Embodiment 1.
[0099] For the development of the upper computer desktop application, especially the industrial-level desktop application, the C++ language is generally used. In addition, languages such as C# and VB are also used. However, for the upper computer desktop system that communicates with the embedded system, currently most use C++. Moreover, the three systems involved in the present invention are developed as a whole, and unified C / C++ programming can be better integrated and implemented.
[0100] Since the Lua language is written in standard C language and supports the use of external C language code for extension, the Lua language has "naturally" good interactivity with C / C++. But it doesn't mean that the interactivity between Lua and C# is poor. XLua developed using the C# language is one of the relatively mature hot update frameworks. The implementation of Lua for hot update is widely used in the Web field. For example, the online game server performs online hot update on the client. However, in the embedded system, especially the industrial-level embedded device system and the upper computer system are quite different from the Web. The overall update technical solution of the embedded system proposed by the present invention cannot be replaced by the hot update frameworks such as XLua for online games.
[0101] The most prominent feature of the present invention is to utilize the special advantages of the safe runtime environment and automatic memory management of the Lua language to ensure the modification and update of the application programs running in the memory under the condition that the system is not powered off.
[0102] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the technical principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Claims
1. An update method for an embedded system application, characterized in that, it includes: Obtain the version information of multiple embedded systems and the version information of the applications under their systems, and store them in the system memory, including: obtaining the version information of the main control system Sys_MC of the embedded device and the version information of its applications AppA_MC and AppB_MC, and recording them in the file system of the system Sys_MC; Obtain the version information of the device human-computer interaction system Sys_HMI and the version information of its applications AppA_HMI and AppB_HMI, and record them in the file system of the system Sys_HMI; Obtain the version information of the database configuration management system Sys_DB and the version information of AppA_DB and AppB_DB, and record them in the configuration file of Sys_DB; Among them, the version information of the relevant programs AppA_MC, AppA_HMI, and AppA_DB of the same application in the three systems is consistent; the multiple embedded systems include the main control system of the embedded device, the device human-computer interaction system, and the database configuration management system; Adopt a plug-in framework for multiple embedded systems, generate new applications respectively, and save the dynamic library files generated by each new application to a pre-generated specified folder; including: Adopt a plug-in framework for the main control system Sys_MC of the embedded device, generate the application AppA_MC.so in the corresponding host system and save it to the plug-in specified folder Plugin_App of the upper computer; Adopt a plug-in framework for the device human-computer interaction system Sys_HMI, generate the application AppA_HMI.so in the corresponding host system and save it to the plug-in specified folder Plugin_App of the upper computer; Adopt a plug-in framework for the database configuration management system Sys_DB, generate the application AppA_DB.dll in the upper computer environment and save it to the plug-in specified folder Plugin_App of the upper computer; Check whether the version information of each new application is consistent. If it is inconsistent, regenerate the dynamic library file with a consistent version; When the embedded system is running online, load the updated version of the dynamic library file in the specified folder into the system memory through the Lua program, including: The Lua program first checks whether the version information of the original application programs AppA_MC, AppA_HMI, and AppA_DB in the three systems is consistent. If it is inconsistent, it will not be updated. If it is consistent, the following update will be carried out; Open a necessary buffer area in the Sys_MC system memory through the Lua program, and load the updated version of the dynamic library file AppA_MC.so in the folder Plugin_App into the Sys_MC system memory; Open a necessary buffer area in the Sys_HMI system memory through the Lua program, and load the updated version of the dynamic library file AppA_HMI.so in the folder Plugin_App into the Sys_HMI system memory; Use the Lua program to allocate necessary buffer areas in the memory of the Sys_DB system, and load the updated version of the dynamic library file AppA_DB.dll in the folder Plugin_App into the memory of the host computer Sys_DB; Then modify the update function and upvalues in the updated application to complete the update.
2. The method for updating an embedded system application program according to claim 1, characterized in that, the version information includes version number, version CRC, generation version time, and the version correspondence between the system and the application.
3. The method for updating an embedded system application program according to claim 1, characterized in that, the step of using the Lua program to allocate necessary buffer areas in the memory of the Sys_MC system and load the updated version of the dynamic library file AppA_MC.so in the folder Plugin_App into the memory of the Sys_MC system includes: Use the Lua function debug.getupvalue to recursively traverse all functions and upvalues in the running original application, collect function and upvalue information and save it to the original environment table; Use the Lua function debug.getupvalue to recursively traverse all functions and upvalues in the updated application to locate the functions and upvalues that need to be updated; Use the Lua function debug.upvaluejoin to reference the updated function to all upvalues saved in the original environment table, and then use the updated function to replace the function to be updated, ensuring that the updated function can replace the original function correctly as the updated part of the application.
4. The method for updating an embedded system application program according to claim 1, characterized in that, the step of using the Lua program to allocate necessary buffer areas in the memory of the Sys_HMI system and load the updated version of the dynamic library file AppA_HMI.so in the folder Plugin_App into the memory of the Sys_HMI system includes: Use the Lua function debug.getupvalue to recursively traverse all functions and upvalues in the running original application, collect function and upvalue information and save it to the original environment table; Use the Lua function debug.getupvalue to recursively traverse all functions and upvalues in the updated application to locate the functions and upvalues that need to be updated; Use the Lua function debug.upvaluejoin to reference the updated function to all upvalues saved in the original environment table, and then use the updated function to replace the function to be updated, ensuring that the updated function can replace the original function correctly as the updated part of the application.
5. The method for updating an embedded system application program according to claim 1, characterized in that, the step of using the Lua program to allocate necessary buffer areas in the memory of the Sys_DB system and load the updated version of the dynamic library file AppA_DB.dll in the folder Plugin_App into the memory of the host computer Sys_DB includes: Use the Lua function debug.getupvalue to recursively traverse all functions and upvalues in the running original application, collect function and upvalue information, and save it to the original environment table; Use the Lua function debug.getupvalue to recursively traverse all functions and upvalues in the updated application, and locate the functions and upvalues that need to be updated; Use the Lua function debug.upvaluejoin to reference the updated function to all the upvalues saved in the original environment table, and then use the updated function to replace the function to be updated, ensuring that the updated function can correctly replace the original function as the updated part of the application and run properly.
6. An embedded system application update device, Characterized in that: It includes a processor and a storage medium; The storage medium is used to store instructions; The processor is used to operate according to the instructions to execute the steps of the method according to any one of claims 1 to 5.
7. A computer-readable storage medium, on which a computer program is stored, Characterized in that: When the program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
An apparatus and embedded platform system for implementing embedded plug-ins
CN102270124A
LUA-based medical instrument data acquisition equipment hot update method
CN112802591A