Flexible functional module loading method and device and electronic equipment

By compiling the function module code in the device to a general burned file and dynamically managing memory using the memory heap space, the flexible loading and unloading of the function modules under limited memory is achieved, solving the problem of limited device functions and high maintenance costs, and improving the flexibility and adaptability of the device.

CN119621083APending Publication Date: 2025-03-14SUZHOU CENTEC COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411709667.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

In limited memory scenarios, devices cannot load and run a large number of software modules at the same time, resulting in limited device functions. The traditional method of burning files lacks flexibility and high maintenance costs.

Method used

By compiling the code of the functional module into a general burned file, using the memory heap space dynamically applies and attaches memory space, the flexible loading and unloading of the functional module is achieved, and frequent downloads and replacements of burned files are avoided.

Benefits of technology

Under limited memory conditions, flexible loading of functional modules is achieved, improving the functional adaptability and flexibility of the device and reducing maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621083A_ABST
    Figure CN119621083A_ABST
Patent Text Reader

Abstract

The invention provides a function module flexible loading method and device and electronic equipment, codes of function modules related to the electronic equipment are compiled into a universal burning file, and the codes of all the function modules in the burning file are stored in a code segment or a storage medium in a memory of the electronic equipment. The method comprises the steps of determining a to-be-loaded function module in response to a function module loading operation, determining the size of a memory space required by the to-be-loaded function module, applying for obtaining a corresponding memory space from a heap space of a memory according to the size of the memory space, and hooking the applied memory space to a related identifier of the to-be-loaded function module. In the scheme, all the function modules share one burning file, the burning file does not need to be downloaded or replaced, the function modules can be loaded on the basis of requirements in a limited memory scene, the flexibility is high, and the implementation cost is low.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device and electronic device for flexibly loading functional modules. Background Art

[0002] Many devices, such as switch devices, control devices, and display devices, need to have more software modules to meet the needs of different users. For example, the number of layer 2 and 3 software protocol modules in various industries reaches dozens or even hundreds, and different users and different device roles have different requirements for software modules. For example, some focus on security and have requirements for IPsec, 802.1X, etc. Some focus on layer 2 forwarding and have requirements for QOS, MAC base vlan, etc., while some focus on layer 3 and have requirements for OSPF, BGP, etc.

[0003] However, some devices, due to cost constraints, price sensitivity and other reasons, use a small memory solution, which makes it impossible to load all software modules into the memory and run them. Users need to select and start running from them. The operation of software modules requires corresponding stack space and heap space to ensure normal operation, and these need to be obtained from the memory. However, the memory is limited and cannot meet the operation allocation of all software modules, thus limiting the number of software modules installed on the device.

[0004] In the traditional processing method, for the same equipment and different requirements, a variety of different burning files are customized for burning. After the manufacturer leaves the factory, the customer's software module combination requirements may not be fully collected. Even if all combination requirements can be obtained, publishing and maintaining numerous burning files will consume a lot of manpower and material resources, which lacks flexibility.

[0005] In order to solve the problems in the above traditional processing methods, the method of dynamically downloading the required software modules into the memory and installing them or modifying the kernel module symbol table loading mechanism is currently adopted. However, the first method depends on the network, which will limit the use of functions in the case of network failure or network restriction, while the maintenance of the symbol table in the second method will generate a lot of workload and high maintenance cost. Summary of the invention

[0006] The purpose of the embodiments of the present application is to provide a method, device and electronic device for flexible loading of functional modules, so as to realize demand-based loading of functional modules in a limited memory scenario, with high flexibility and low cost.

[0007] In a first aspect, the present application provides a method for flexibly loading a functional module, which is applied to an electronic device, wherein the codes of the functional modules related to the electronic device are compiled into a universal burning file, and the codes of all the functional modules in the burning file are stored in a code segment or a storage medium in the memory of the electronic device;

[0008] The method comprises:

[0009] In response to the function module loading operation, determining the function module to be loaded;

[0010] Determine the memory space required by the functional module to be loaded;

[0011] Applying for corresponding memory space from the heap space of the memory according to the size of the memory space;

[0012] The applied memory space is mounted to the relevant identifier of the functional module to be loaded.

[0013] In an optional embodiment, the method further comprises:

[0014] In response to the function module running operation, running the state machine of the corresponding function module and determining the relevant identification of the function module;

[0015] The generated operation data is stored in the memory space of the relevant identification mounted on the functional module.

[0016] In an optional implementation, the step of determining the size of the memory space required by the functional module to be loaded includes:

[0017] Determine the memory-consuming module components required by the functional module to be loaded;

[0018] The memory space size required by the functional module to be loaded is obtained according to the memory space size required by each of the module components.

[0019] In an optional implementation manner, the step of storing the generated operation data in a memory space of a related identifier mounted on the functional module includes:

[0020] Obtaining a data type of the generated operating data, and determining a memory space type corresponding to the data type;

[0021] Obtaining module components included in the functional module corresponding to the memory space type;

[0022] The operation data is stored in the memory space corresponding to the relevant identification of the module component.

[0023] In an optional embodiment, the method further comprises:

[0024] In response to the function module uninstallation operation, determining the function module to be uninstalled;

[0025] Determine other functional modules that have an interactive relationship with the functional module to be uninstalled, and release the interactive relationship between the functional module to be uninstalled and the other functional modules;

[0026] The memory space corresponding to the function module to be uninstalled is released to the heap space of the memory.

[0027] In an optional embodiment, the method further comprises:

[0028] Displaying the name of each functional module, the size of the memory space required to be occupied, and the operation options on the operation interface of the electronic device;

[0029] Counting the actual amount of memory occupied by all currently loaded functional modules and displaying it on the operation interface;

[0030] The remaining amount is obtained based on the actual amount and the total amount of the memory, and the remaining amount is displayed on the operation interface.

[0031] In an optional embodiment, the method further comprises:

[0032] After running the corresponding function module, the name of the running function module is recorded in a configuration file of the storage medium, wherein after the electronic device is restarted, the name in the configuration file is read, and the function module corresponding to the read name is automatically loaded.

[0033] In an optional embodiment, the method further comprises:

[0034] After the electronic device is restarted, the memory space required by the designated function module in the burning file is applied for from the heap space of the memory, the designated function module is automatically loaded, and the applied memory space is mounted to the relevant identifier of the designated function module.

[0035] In a second aspect, the present application provides a functional module flexible loading device, which is applied to an electronic device, wherein the codes of the functional modules related to the electronic device are compiled into a universal burning file, and the codes of all the functional modules in the burning file are stored in a code segment or storage medium in the memory of the electronic device;

[0036] The device comprises:

[0037] A response module, used for determining a function module to be loaded in response to a function module loading operation;

[0038] A determination module, used to determine the size of the memory space required by the functional module to be loaded;

[0039] An application module, used for applying for corresponding memory space from the heap space of the memory according to the size of the memory space;

[0040] The mounting module is used to mount the applied memory space to the relevant identifier of the functional module to be loaded.

[0041] In a third aspect, the present application provides an electronic device, comprising a processor and a memory, wherein the memory is used to store executable instructions of the processor, wherein the processor is configured to execute the method described in any one of the aforementioned embodiments by executing the executable instructions.

[0042] The present application provides a method, device and electronic device for flexibly loading functional modules, wherein the codes of the functional modules related to the electronic device are compiled into a universal burning file, and the codes of all the functional modules in the burning file are stored in a code segment or storage medium in the memory of the electronic device. By responding to the function module loading operation, the function module to be loaded is determined, the size of the memory space required for the function module to be loaded is determined, and the corresponding memory space is applied for from the heap space of the memory according to the size of the memory space, and the applied memory space is mounted to the relevant identifier of the function module to be loaded. In this solution, all functional modules share a burning file, and there is no need to download or replace the burning file. It can realize the loading of functional modules based on demand in a limited memory scenario, which is flexible and low in cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] 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.

[0044] Figure 1 A flowchart of a method for flexibly loading functional modules provided in an embodiment of the present application;

[0045] Figure 2 This is a schematic diagram of the area division of the memory in the embodiment of the present application;

[0046] Figure 3 A flowchart of the operation method involved in the flexible loading method of the functional module provided in the embodiment of the present application;

[0047] Figure 4 for Figure 1 Flow chart of the sub-steps included in step S12;

[0048] Figure 5 for Figure 3 Flow chart of the sub-steps included in step S16;

[0049] Figure 6 A flowchart of a display method involved in a flexible loading method for a functional module provided in an embodiment of the present application;

[0050] Figure 7 This is a schematic diagram of the operation interface in the embodiment of the present application;

[0051] Figure 8 A schematic diagram of a display interface in an embodiment of the present application;

[0052] Fig. 9 A flowchart of an unloading method involved in a flexible loading method for a functional module provided in an embodiment of the present application;

[0053] Fig.10 A functional module block diagram of a functional module flexible loading device provided in an embodiment of the present application;

[0054] Fig.11 A structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to solve the problem of different users having different requirements for functional modules in a limited memory scenario, there are mainly two solutions in the prior art.

[0056] In the first method, for some devices, such as control devices and switch devices, the initial environment only provides basic functions, and the advanced functions required by users are dynamically downloaded into the memory in the form of plug-ins for installation. In this method, plug-in downloading depends on the network. If there is a communication failure between the device and the server, or if the intranet cannot access the Internet due to special confidentiality reasons, the use of functions will be limited. Secondly, there is a problem that the version matching between the initial environment and the plug-in cannot be guaranteed, and there are compatibility issues between the device environment and the newly downloaded plug-in, which has an adverse impact on the stable operation of the environment. Furthermore, the downloaded plug-in needs to provide a verification mechanism to prevent attacks by malicious plug-ins, which complicates the implementation process.

[0057] In the second method, a dynamic symbol table loading mechanism is adopted. By modifying the kernel module symbol table loading mechanism, only the symbols exported by the required basic function declarations are loaded into the global symbol table when the system starts loading the kernel. When the system starts loading an exception, the symbol table with the loading exception is found in the current kernel memory according to the exception address, and the exception address is converted into the offset address of the kernel module where it is located, and the symbol loading is completed according to the offset address.

[0058] In this way, kernel modification is complicated, and symbol table maintenance caused by module changes requires a certain amount of work. If the address mapping relationship is damaged in memory during operation, it will cause search failure and inability to load. Secondly, there are many types and versions of operating systems, and the symbol mapping implementation methods are different, so this method has poor universal portability.

[0059] Based on the above research findings, the present application provides a flexible functional module loading solution, in which all functional modules share one burning file. There is no need to download or replace the burning file. Functional modules can be loaded based on demand in a limited memory scenario, which is highly flexible and has a low implementation cost.

[0060] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0061] See also Figure 1 , is a flow chart of a flexible function module loading method provided in an embodiment of the present application, and the flexible function module loading method can be applied to an electronic device, and the electronic device can be a switch device, a control device, a display device, etc. Among them, the codes of the function modules related to the electronic device are compiled into a common burning file, and the codes of all the function modules in the burning file are stored in a code segment or a storage medium in the memory of the electronic device.

[0062] The specific implementation steps of the functional module flexible loading method provided in this embodiment are as follows:

[0063] S11, in response to the function module loading operation, determining the function module to be loaded.

[0064] S12, determining the memory space size required by the functional module to be loaded.

[0065] S13, applying for corresponding memory space from the heap space of the memory according to the size of the memory space.

[0066] S14, attaching the applied memory space to the relevant identifier of the functional module to be loaded.

[0067] In this embodiment, the electronic device-related functional modules include multiple ones, which may include some network protocol software modules, protection mechanism software modules, etc., for example, IGMP, ERPS, 802.1X, LLDP, STP and other functional modules. The electronic device-related functional modules are compiled into a unified burning file, so that there is no need to download the functional modules again later, thereby avoiding the problem of being limited by network conditions. The code in the burning file is stored in a code segment or storage medium in the memory of the electronic device, such as in flash.

[0068] In addition, when the version is updated, all functional modules will be updated to ensure compatibility between functional modules.

[0069] In actual scenarios, not all users or electronic devices need to load and run all functional modules when they are in all device roles. Each user or electronic device may only need to load and run some of the functional modules when it is in various device roles.

[0070] Based on this, in this embodiment, the user can select the function module to be loaded according to his own needs, and the selection method can be to operate on the operation interface displaying information of all function modules, such as by checking, dragging, etc. Alternatively, the selection can be made by inputting relevant operation commands on the operation interface, which is not limited in this embodiment.

[0071] After detecting a function module loading operation initiated by a user, the electronic device can respond to the function module loading operation and determine the function module to be loaded based on specific operation information. The function module to be loaded may be one or more. If there are more than one function modules to be loaded, each function module to be loaded can be traversed in turn and the loading process can be performed until all the function modules to be loaded are processed.

[0072] In this embodiment, the memory consumed by each functional module can be known and fixed in the design stage. Therefore, after determining the functional module to be loaded, the size of the memory space required by the functional module to be loaded can be determined, for example, it can be 5KB, 6KB, etc.

[0073] Please refer to Figure 2 , the memory of the electronic device is divided into regions, and the memory can be divided into a kernel, a stack space, a heap space, a data segment and a code segment. In this embodiment, the codes of the functional modules in the burning file of the electronic device are all stored in the code segment of the memory.

[0074] The memory space consumed by the function module operation is mainly the heap space. Therefore, the corresponding memory space can be applied for from the heap space according to the memory space required by the function module to be loaded. The heap space is a memory area that can be dynamically allocated and released, and is used to store objects and data structures created when the function module is running. The management of the heap space is often manual, and memory needs to be allocated and released explicitly. The management of the stack space is automatic, and is used to manage the context and local variables of the function call when the function module is running.

[0075] Therefore, it is necessary to apply for the required memory space from the heap space, while the memory space in the stack space is automatically managed and does not need to be allocated.

[0076] After applying for the memory space, the memory space is mounted to the relevant identifier of the function module to be loaded, which indicates that the memory space is associated with the function module to be loaded, that is, the memory space can provide the space required for the operation of the function module to be loaded. Among them, the relevant identifier can be understood as a pointer set in advance for the function module to be loaded. When the memory space is not mounted, the pointer is not pointed to a valid address, and after the memory space is mounted, the pointer is initialized and points to the memory space address. In this way, the relevant data generated after the function module to be loaded is run can be stored in the mounted memory space.

[0077] The flexible function module loading method provided in this embodiment aims at the problem that many function modules need to be run but the memory is limited in a small memory device environment. Based on the needs of the user, the required function modules to be loaded are determined, and the corresponding memory space is applied in the memory, and the memory space is mounted to the relevant identifier of the function module to be loaded. In addition, all the function modules are installed in a universal burning file, and there is no need to download them temporarily, and the required function modules can be flexibly selected for operation, which is highly flexible and has low implementation cost.

[0078] See also Figure 3 Based on the above, the functional module flexible loading method provided in this embodiment may further include the following steps:

[0079] S15, in response to the function module running operation, running the state machine of the corresponding function module, and determining the relevant identification of the function module.

[0080] S16, storing the generated operation data in the memory space of the relevant identifier mounted on the functional module.

[0081] In this embodiment, for the function module loaded into the memory, when the function module is triggered to run, for example, it is triggered to run based on the user's operation, or it is triggered to run under the triggering of a certain triggering event, or it is triggered to run when a certain triggering moment is reached. In this case, the state machine of the corresponding function module is run, and the state machine refers to a mathematical model used to describe the transition of the function module between different states, such as the condition or mode of the function module at a specific moment, the signal or action that triggers the state transition, and the operation performed during the state transition.

[0082] After the function module is run, corresponding operation data will be generated, and the operation data should be stored in the memory. Specifically, the relevant identification of the running function module, such as a pointer, is obtained, and the memory space attached to the relevant identification is determined based on the relevant identification, that is, it can be understood as finding the address of the corresponding memory space based on the pointer. Then the generated operation data is stored in the memory space.

[0083] See also Figure 4In this embodiment, the step of determining the memory space required by the function module to be loaded can be implemented in the following manner:

[0084] S121, determining the memory-consuming module components required by the function module to be loaded.

[0085] S122, obtaining the memory space size required by the function module to be loaded according to the memory space size required by each of the module components.

[0086] In this embodiment, the module components that consume memory and are needed by each functional module to be loaded may include global variables, data structures, clocks, locks, etc., and each module component needs to consume a certain amount of memory space.

[0087] Among them, global variables refer to variables that can be accessed by the function module throughout the program. Their scope is global, and any function or method in the program can read or modify the value of the global variable. It can be used to store data that needs to be shared between different parts of the program.

[0088] Data structure refers to the way of organizing and storing data, defining the relationship between data elements and the operations that can be performed on the data. For example, common ones include arrays, linked lists, stacks, queues, trees, graphs, etc., which are used to efficiently store and access data and support specific algorithmic operations.

[0089] A clock is a mechanism or variable used to track time in a functional module. For example, in a scheduling task, a timer or caller uses a clock to decide when to execute a task, measure the execution time of a code segment, or record the time when an event occurs. A clock can be a system clock, a timer, or a simulated clock variable in software.

[0090] A lock is a synchronization mechanism used to control access to a shared resource to prevent multiple threads or processes from modifying the data at the same time, thus avoiding race conditions.

[0091] Therefore, each of the above module components of the functional module needs to consume a certain amount of memory space. By adding up the memory space required by each module component, the total memory space required by the functional module can be obtained.

[0092] See also Figure 5 On this basis, the above step of storing the generated operation data in the memory space of the relevant identifier attached to the functional module can be implemented in the following way:

[0093] S161, obtaining a data type of the generated operating data, and determining a memory space type corresponding to the data type.

[0094] S162, obtaining module components included in the functional module corresponding to the memory space type.

[0095] S163, storing the operation data in the memory space corresponding to the relevant identifier of the module component.

[0096] The operation data generated by the functional module during operation may include multiple types of data. When applying for memory space in advance, corresponding memory space can be applied for each module component in the functional module. Therefore, each applied memory space can be linked to the relevant identifier of the corresponding module component.

[0097] On this basis, for the operation data of each data type generated, the corresponding memory space type can be determined, that is, the operation data of different data types can be stored in the memory space of the corresponding memory space type. Different memory space types have corresponding module components, so the memory space corresponding to the relevant identifier of the module component can be obtained, and then the operation data of the corresponding data type can be stored in the memory space.

[0098] In this way, operating data of different data types can be stored in different areas, which is convenient for data management and data search.

[0099] In order to facilitate the user to intuitively understand the loading status of each functional module, the memory usage and remaining status, etc., the functional module flexible loading method provided in this embodiment may also include the following steps, please refer to Figure 6 :

[0100] S21, displaying the name of each functional module, the size of the memory space required to be occupied, and the operation options on the operation interface of the electronic device.

[0101] S22, counting the actual amount of memory occupied by all currently loaded functional modules, and displaying it on the operation interface.

[0102] S23, obtaining a remaining amount based on the actual amount and the total amount of the memory, and displaying the remaining amount on the operation interface.

[0103] In this embodiment, the operation interface of the electronic device can be as follows: Figure 7 As shown in , the name of each functional module, the size of the memory space required, and the operation options can be displayed on the operation interface. For example, Figure 7As shown schematically in the figure, the function modules include IGMP, ERPS, Mirror, QOS, 802.1X, LLDP, STP, DHCP, and LACP. The size of the memory space required by each function module is displayed at the back end, for example, IGMP requires 3KB, ERPS requires 1KB, and so on.

[0104] In addition, each functional module backend has operation options, such as Figure 7 The operation options are operated by checking a box. Schematically, the function modules currently checked and loaded include IGMP, ERPS, 802.1X, LLDP, and STP.

[0105] On this basis, the actual amount of memory occupied by all currently loaded function modules is counted and displayed on the operation interface. For example, the actual amount of memory occupied by the currently checked loaded function modules is 26KB. The total amount of memory is 31KB, and the remaining amount is calculated to be 5KB, which is displayed on the operation interface.

[0106] In this way, the user can intuitively understand the memory space required by each functional module, the total actual amount currently occupied, the remaining amount, etc. If the user needs to load other functional modules on this basis, he can judge whether the memory space required by the functional module to be loaded is greater than the remaining amount based on the memory space required by the other functional modules and the current remaining amount, thereby reducing the probability of loading failure.

[0107] In addition, in this embodiment, after the user chooses to load a function module, the size of the memory space required for the function module can be compared with the remaining amount of the current memory space. If the size of the memory space required is greater than the remaining amount, indicating that the current memory space is insufficient, an alarm message can be issued to prompt that the loading cannot be done. For example, an alarm prompt can be given through a pop-up window.

[0108] For example, Figure 7 Taking the scenario shown as an example, if on this basis, the user newly clicks on the Mirror function module, the memory space required for the function module is 6KB, while the current remaining amount is 5KB, indicating that the current remaining memory space is insufficient and an alarm prompt may be issued.

[0109] In order to ensure the normal operation of the basic functions of the electronic device, the functional module flexible loading method provided in this embodiment may also include the following steps:

[0110] After the electronic device is restarted, the memory space required by the designated function module in the burning file is applied for from the heap space of the memory, the designated function module is automatically loaded, and the applied memory space is mounted to the relevant identifier of the designated function module.

[0111] Each time the electronic device is restarted (including the first boot), the specified function modules in the burning file can be automatically loaded. Among them, the specified function modules include basic modules such as software upgrade module, system restart module, port configuration module, VLAN module, FDB module, etc. These basic modules are used to ensure the use of basic functions of the electronic device.

[0112] The system can automatically calculate the size of the memory space required by the specified functional module, and then apply for the corresponding memory space from the heap space, and attach the applied memory space to the relevant identifier of the specified functional module, such as a pointer. In this way, the automatic loading of the specified functional module is realized.

[0113] In this embodiment, the designated function module is automatically loaded after the electronic device is restarted, thereby ensuring that the basic functions of the electronic device can run normally.

[0114] On this basis, the user can select the function modules to be loaded based on his / her own needs, and load the function modules selected by the user according to the above processing method.

[0115] Considering that after the electronic device is restarted, the loading information may be lost, and thus the continued operation of the functional modules loaded before the restart cannot be guaranteed.

[0116] Based on this, in this embodiment, after running the corresponding functional module, the name of the running functional module can be recorded in the configuration file of the storage medium, wherein after the electronic device is restarted, the name in the configuration file is read and the functional module corresponding to the read name is automatically loaded.

[0117] Since the information recorded in the storage medium, such as the configuration file of the flash, is not lost after the electronic device is restarted, the configuration file still retains the names of the function modules that have been loaded and run before the restart after the restart. In this way, the corresponding function modules can be directly and automatically loaded.

[0118] In this embodiment, by storing the names of the function modules that have been running and loaded in the configuration file, it is possible to avoid the problem of poor user experience caused by the need to load the function modules based on the user's selection operation after the electronic device is restarted.

[0119] In addition, in this embodiment, when the functional module is loaded, the front-end interface display is automatically refreshed and synchronized with the back-end code, that is, the information of the currently loaded and running functional modules can be displayed on the display interface, such as Figure 8The information of the unloaded function modules is not displayed on the display interface. Thus, only the information of the function modules that have been successfully loaded is displayed. The unloaded function modules are invisible to the user on the display interface. Thus, the user can avoid the erroneous operation of the unloaded function modules on the display interface.

[0120] In the solution provided in this embodiment, the function modules to be loaded can be selected based on the user's own needs. In addition, the function modules to be uninstalled can also be selected based on the user's needs. Fig. 9 The method provided in this embodiment may also include the following steps:

[0121] S31, in response to a function module uninstallation operation, determining a function module to be uninstalled.

[0122] S32, determining other functional modules that have an interactive relationship with the functional module to be uninstalled, and releasing the interactive relationship between the functional module to be uninstalled and the other functional modules.

[0123] S33, releasing the memory space corresponding to the function module to be uninstalled into the heap space of the memory.

[0124] When the user chooses to uninstall a function module, the uninstall operation can be triggered by unchecking the option on the operation interface or by inputting a control command. When the electronic device detects the function module uninstall operation initiated by the user, it can determine the function module to be uninstalled. The function module is uninstalled by running a cleanup function.

[0125] Since a functional module may have an interactive relationship with other functional modules during operation, for example, it is necessary to execute related functions based on data provided by other functional modules, it is necessary to provide the generated operation data to other functional modules, etc. Therefore, for the functional module to be uninstalled, it is necessary to determine other functional modules that have an interactive relationship with it, and release the interactive relationship with other functional modules.

[0126] In addition, the memory space corresponding to the function module to be uninstalled is released to the heap space of the memory, and the display interface of the front end is notified to delete the relevant information of the function module to be uninstalled. In this way, the uninstallation of the function module is completed.

[0127] The flexible function module loading method provided in this embodiment can provide a mechanism for online selection of function module loading or unloading during the normal operation of the electronic device. For the selected function module to be loaded, the memory space is applied from the memory based on the required memory space size that has been fixed in the design stage, and the memory space is mounted to the relevant identifier of the function module, and after the function module is run, the running data is stored in the memory space.

[0128] When selecting to uninstall a functional module, it is determined that the functional module to be uninstalled has other functional modules with which it interacts, and the interactive relationship is released, and the memory space of the functional module to be uninstalled is released into the memory.

[0129] In this solution, the codes of all functional modules are compiled into the burning file, and the codes in the burning file are stored in the code segment of the memory. It is only necessary to flexibly select the functional modules to be loaded or unloaded based on the user's needs, so as to achieve the purpose of loading the functional modules into the memory or releasing them from the memory. This solution is highly flexible and has a low implementation cost.

[0130] Based on the same application idea, please refer to Fig.10 , an embodiment of the present application also provides a functional module schematic diagram of a functional module flexible loading device. This embodiment can divide the functional modules of the functional module flexible loading device according to the above method embodiment. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic, which is only a logical function division, and there may be other division methods in actual implementation.

[0131] For example, when each functional module is divided into corresponding functional modules, Fig.10 The functional module flexible loading device shown is only a schematic diagram of the device, wherein the functional module flexible loading device may include a response module, a determination module, an application module and a mounting module, and the functions of each functional module of the functional module flexible loading device are described in detail below.

[0132] A response module, used for determining a function module to be loaded in response to a function module loading operation;

[0133] A determination module, used to determine the size of the memory space required by the functional module to be loaded;

[0134] An application module, used for applying for corresponding memory space from the heap space of the memory according to the size of the memory space;

[0135] The mounting module is used to mount the applied memory space to the relevant identifier of the functional module to be loaded.

[0136] It can be understood that the above-mentioned response module, determination module, application module and attachment module can be used to execute the above-mentioned S11 to S14. The detailed implementation method of the response module, determination module, application module and attachment module can refer to the relevant contents of the above-mentioned S11 to S14.

[0137] In a possible implementation, the above response module may also be used to:

[0138] In response to the function module running operation, running the state machine of the corresponding function module and determining the relevant identification of the function module;

[0139] The generated operation data is stored in the memory space of the relevant identification mounted on the functional module.

[0140] In a possible implementation, the above-mentioned determination module may be specifically used for:

[0141] Determine the memory-consuming module components required by the functional module to be loaded;

[0142] The memory space size required by the functional module to be loaded is obtained according to the memory space size required by each of the module components.

[0143] In a possible implementation, the above response module may be specifically used for:

[0144] Obtaining a data type of the generated operating data, and determining a memory space type corresponding to the data type;

[0145] Obtaining module components included in the functional module corresponding to the memory space type;

[0146] The operation data is stored in the memory space corresponding to the relevant identification of the module component.

[0147] In a possible implementation, the above response module may also be used to:

[0148] In response to the function module uninstallation operation, determining the function module to be uninstalled;

[0149] Determine other functional modules that have an interactive relationship with the functional module to be uninstalled, and release the interactive relationship between the functional module to be uninstalled and the other functional modules;

[0150] The memory space corresponding to the function module to be uninstalled is released to the heap space of the memory.

[0151] In a possible implementation, the functional module flexible loading device further includes a display module, which can be used to:

[0152] Displaying the name of each functional module, the size of the memory space required to be occupied, and the operation options on the operation interface of the electronic device;

[0153] Counting the actual amount of memory occupied by all currently loaded functional modules and displaying it on the operation interface;

[0154] The remaining amount is obtained based on the actual amount and the total amount of the memory, and the remaining amount is displayed on the operation interface.

[0155] In a possible implementation, the functional module flexible loading device may further include a recording module, which may be used to:

[0156] After running the corresponding function module, the name of the running function module is recorded in a configuration file of the storage medium, wherein after the electronic device is restarted, the name in the configuration file is read, and the function module corresponding to the read name is automatically loaded.

[0157] In a possible implementation, the functional module flexible loading device may further include an automatic loading module, and the automatic loading module may be used to:

[0158] After the electronic device is restarted, the memory space required by the designated function module in the burning file is applied for from the heap space of the memory, the designated function module is automatically loaded, and the applied memory space is mounted to the relevant identifier of the designated function module.

[0159] See also Fig.11 The embodiment of the present application further provides an electronic device, which includes a storage device and a processor, wherein the storage device stores executable instructions, and the processor implements the following steps when executing the executable instructions:

[0160] In response to the function module loading operation, determining the function module to be loaded;

[0161] Determine the memory space required by the functional module to be loaded;

[0162] Applying for corresponding memory space from the heap space of the memory according to the size of the memory space;

[0163] The applied memory space is mounted to the relevant identifier of the functional module to be loaded.

[0164] The memory involved in this application includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the technical field.

[0165] The electronic device provided in the embodiment of the present application may also include an input port connected to the processor, a display unit and a communication module. The input port is used to transmit commands input from the outside to the processor, the display unit is used to display the processing results of the processor to the outside, and the communication module is used to realize the communication between the software modular device and the outside.

[0166] The display unit can be a display panel, a laser scanning display, etc. The communication method adopted by the communication module includes but is not limited to mobile high-definition link technology (HML), universal serial bus (USB), high-definition multimedia interface (HDMI), wireless connection: wireless fidelity technology (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, and communication technology based on IEEE802.11s.

[0167] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0168] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0169] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0170] It should be noted that if the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM) random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0171] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0172] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for flexible loading of functional modules, characterized in that: Applied to electronic devices, the codes of the functional modules related to the electronic devices are compiled into a universal burning file, and the codes of all the functional modules in the burning file are stored in a code segment or storage medium in the memory of the electronic devices; The method comprises: In response to the function module loading operation, determining the function module to be loaded; Determine the memory space required by the functional module to be loaded; Applying for corresponding memory space from the heap space of the memory according to the size of the memory space; The applied memory space is mounted to the relevant identifier of the functional module to be loaded.

2. The method for flexible loading of functional modules according to claim 1, characterized in that: The method further comprises: In response to the function module running operation, running the state machine of the corresponding function module and determining the relevant identification of the function module; The generated operation data is stored in the memory space of the relevant identification mounted on the functional module.

3. The method for flexible loading of functional modules according to claim 2, characterized in that: The step of determining the memory space size required by the function module to be loaded includes: Determine the memory-consuming module components required by the functional module to be loaded; The memory space size required by the functional module to be loaded is obtained according to the memory space size required by each of the module components.

4. The method for flexible loading of functional modules according to claim 3, characterized in that: The step of storing the generated operation data in the memory space of the relevant identifier mounted on the functional module includes: Obtaining a data type of the generated operating data, and determining a memory space type corresponding to the data type; Obtaining module components included in the functional module corresponding to the memory space type; The operation data is stored in the memory space corresponding to the relevant identification of the module component.

5. The method for flexible loading of functional modules according to claim 1, characterized in that: The method further comprises: In response to the function module uninstallation operation, determining the function module to be uninstalled; Determine other functional modules that have an interactive relationship with the functional module to be uninstalled, and release the interactive relationship between the functional module to be uninstalled and the other functional modules; The memory space corresponding to the function module to be uninstalled is released to the heap space of the memory.

6. The method for flexible loading of functional modules according to claim 1, characterized in that: The method further comprises: Displaying the name of each functional module, the size of the memory space required to be occupied, and the operation options on the operation interface of the electronic device; Counting the actual amount of memory occupied by all currently loaded functional modules and displaying it on the operation interface; The remaining amount is obtained based on the actual amount and the total amount of the memory, and the remaining amount is displayed on the operation interface.

7. The method for flexible loading of functional modules according to claim 2, characterized in that: The method further comprises: After running the corresponding function module, the name of the running function module is recorded in a configuration file of the storage medium, wherein after the electronic device is restarted, the name in the configuration file is read, and the function module corresponding to the read name is automatically loaded.

8. The method for flexible loading of functional modules according to claim 1, characterized in that: The method further comprises: After the electronic device is restarted, the memory space required by the designated function module in the burning file is applied for from the heap space of the memory, the designated function module is automatically loaded, and the applied memory space is mounted to the relevant identifier of the designated function module.

9. A functional module flexible loading device, characterized in that: Applied to electronic devices, the codes of the functional modules related to the electronic devices are compiled into a universal burning file, and the codes of all the functional modules in the burning file are stored in a code segment or storage medium in the memory of the electronic devices; The device comprises: A response module, used for determining a function module to be loaded in response to a function module loading operation; A determination module, used to determine the size of the memory space required by the functional module to be loaded; An application module, used for applying for corresponding memory space from the heap space of the memory according to the size of the memory space; The mounting module is used to mount the applied memory space to the relevant identifier of the functional module to be loaded.

10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store executable instructions of the processor, wherein the processor is configured to perform the method according to any one of claims 1 to 8 by executing the executable instructions.