Data processing method and related apparatus

CN122963647APending Publication Date: 2026-10-23SHANGHAI LONGSYS DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510507201.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-21
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

并且嵌入式系统中通常不使用相对地址,一方面编译器支持不友好,其次效率相对较低,不符合嵌入式系统实时的特性

Benefits of technology

[0008]本申请的有益效果是:由于在数据存储区中存储的功能代码组中,第一功能代码组中存在至少两个功能代码和第二功能代码组中的功能代码相同,且第一功能代码组对应的编译地址为第一动态内存区,第二功能代码组对应的编译地址为第二动态内存区,则当嵌入式系统加载存在依赖关系的两个功能代码时,若存在依赖关系的功能代码在第一功能代码组和第二功能代码组中均存在,则可以在第一动态内存区和第二动态内存区分别加载这两个功能代码中的一个,通过上述方法减少了存在依赖关系的功能代码均只存在于同一功能代码组中、只能加载至同一动态内存区的可能,有助于减少动态内存区的程序运行期间进行功能代码切换的次数,提高数据处理性能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122963647A_ABST
    Figure CN122963647A_ABST
Patent Text Reader

Abstract

The application discloses a data processing method and related device. The method comprises the following steps: obtaining an execution command; loading a first target function code in a first target function code group from a data storage area to a first dynamic memory area based on the execution command to perform the first target function code; in the process of executing the first target function code, when the first target function code calls other function codes, selecting a second target function code corresponding to the other function codes from a second function code group; loading the second target function code from the data storage area to a second dynamic memory area to perform the second target function code. Through the above method, the number of memory data switching times in the embedded system can be reduced, and the data processing performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular to a data processing method and related apparatus. Background Technology

[0002] In embedded systems, RAM space is limited, and due to the typically numerous functionalities, memory shortages and resource constraints are common. Unlike large operating systems like Windows and Linux, embedded systems lack APIs and dynamic loading technologies, making it impossible to use DLL-like methods to dynamically load code into memory and save space. Furthermore, embedded systems typically do not use relative addresses; this is due to poor compiler support and relatively low efficiency, which does not align with the real-time nature of embedded systems. In embedded systems, since a dynamic memory area can only load one piece of code at a time, when the loaded code has dependencies, the dynamic memory area must remove the dependent code and load it before execution continues. When multiple code dependencies exist, the dynamic memory area needs to frequently load and switch between different code types during execution to ensure proper functioning. Summary of the Invention

[0003] The main objective of this application is to provide a data processing method and related apparatus that can reduce the number of memory data switching operations in embedded systems and improve the data processing performance of the system.

[0004] The first technical solution adopted in this application is to provide a data processing method. This method is applied to an embedded system. An embedded system includes a dynamic memory area and a data storage area. The data storage area stores at least two functional code groups, including a first functional code group and a second functional code group. Each of the first and second functional code groups includes multiple functional codes. At least two functional codes in the first functional code group are identical to functional codes in the second functional code group. The dynamic memory area is used to store the compilation addresses of functional codes in the corresponding functional code groups. All functional codes in the same functional code group have the same compilation address. The dynamic memory area includes at least a first dynamic memory area and a second dynamic memory area. The first dynamic memory area corresponds to the compilation address of functional codes in the first functional code group, and the second dynamic memory area corresponds to the compilation address of functional codes in the second functional code group. The method includes: obtaining an execution command; loading a first target functional code from the data storage area into the first dynamic memory area for execution based on the execution command; during the execution of the first target functional code, when the first target functional code calls other functional codes, selecting a second target functional code corresponding to the other functional codes from the second functional code group; and loading the second target functional code from the data storage area into the second dynamic memory area for execution.

[0005] The second technical solution adopted in this application is: providing an embedded system, the embedded system including a data storage area, the data storage area storing at least two functional code groups, the at least two functional code groups including a first functional code group and a second functional code group, each of the first functional code group and the second functional code group including multiple functional codes, at least two functional codes in the first functional code group being identical to functional codes in the second functional code group; a dynamic memory area, the dynamic memory area being used to correspond to the compilation addresses of functional codes in the functional code groups, all functional codes in the same functional code group having the same compilation address, the dynamic memory area including at least a first dynamic memory area and a second dynamic memory area, the first dynamic memory area corresponding to the compilation address of functional codes in the first functional code group, and the second dynamic memory area corresponding to the compilation address of functional codes in the second functional code group; the dynamic memory area and the data storage area are connected to implement the method described in the first technical solution.

[0006] The third technical solution adopted in this application is: to provide an electronic device. This electronic device includes the embedded system described in the second technical solution to implement the method described in the first technical solution.

[0007] The fourth technical solution adopted in this application is: providing a computer-readable storage medium / computer program product. This computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method described in the first technical solution. The computer program product includes program data that can be executed by a processor to implement the method described in the first technical solution.

[0008] The beneficial effects of this application are as follows: Since at least two functional codes in the first functional code group and the functional codes in the second functional code group are the same in the functional code group stored in the data storage area, and the compilation address corresponding to the first functional code group is the first dynamic memory area, and the compilation address corresponding to the second functional code group is the second dynamic memory area, when the embedded system loads two functional codes with dependencies, if the functional codes with dependencies exist in both the first and second functional code groups, one of the two functional codes can be loaded in the first and second dynamic memory areas respectively. The above method reduces the possibility that functional codes with dependencies exist only in the same functional code group and can only be loaded into the same dynamic memory area, which helps to reduce the number of functional code switching during the program execution in the dynamic memory area and improves data processing performance. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 This is a schematic diagram of the structure of an embodiment of an embedded system;

[0011] Figure 2 This is a schematic diagram of the structure of another embodiment of an embedded system;

[0012] Figure 3 This is a schematic diagram of an embedded system embodiment to which the method of this application is applied;

[0013] Figure 4 This is a flowchart illustrating the first embodiment of the data processing method of this application;

[0014] Figure 5 This is a schematic diagram of an embedded system embodiment to which the method of this application is applied;

[0015] Figure 6 This is a schematic diagram of an embedded system embodiment to which the method of this application is applied;

[0016] Figure 7 This is a flowchart illustrating the second embodiment of the data processing method of this application;

[0017] Figure 8 This is a flowchart illustrating the third embodiment of the data processing method of this application;

[0018] Figure 9 This is a flowchart illustrating the switching process of the dynamic memory area function code in this application;

[0019] Figure 10 This is a flowchart illustrating the fourth embodiment of the data processing method of this application;

[0020] Figure 11 This is a flowchart illustrating the switching process of the dynamic memory area function code in this application;

[0021] Figure 12 This is a flowchart illustrating the fifth embodiment of the data processing method of this application;

[0022] Figure 13 This is a flowchart illustrating the switching process of the dynamic memory area function code in this application;

[0023] Figure 14 This is a schematic diagram of the structure of an embodiment of the embedded system of this application;

[0024] Figure 15 This is a schematic diagram of the structure of an embodiment of the electronic device of this application;

[0025] Figure 16 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0026] The embodiments of the technical solution of this application will now be described in detail with reference to the accompanying drawings. These embodiments are only used to more clearly illustrate the technical solution of this application and are therefore merely examples, and should not be used to limit the scope of protection of this application.

[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms "comprising" and "having" and any variations thereof in the specification, claims and foregoing description of the drawings are intended to cover non-exclusive inclusion.

[0028] In this document, the reference to "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0029] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.

[0030] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.

[0031] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).

[0032] In the description of the embodiments of this application, the technical terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing the embodiments of this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the embodiments of this application.

[0033] In the description of the embodiments of this application, unless otherwise expressly specified and limited, the technical terms "installation," "connection," "joining," "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.

[0034] Before introducing the technical solution of this application, a brief introduction to the relevant technologies will be given first.

[0035] Reference Figure 1 , Figure 1 This is a schematic diagram of an embodiment of an embedded system.

[0036] In a typical embedded system, there are memory areas and data storage areas. The memory area can be RAM, and the data storage area can be Flash memory. The memory area includes dynamic memory and ordinary memory. Ordinary memory stores code, data, and stack elements required during program execution, while dynamic memory stores user-defined functional code. Dynamic memory dynamically loads different functional code from the data storage area as needed to ensure the normal operation of the device. This dynamic memory area can also be understood as an overlay area. Different functional code is stored in the data storage area. Before being stored in the data storage area, the functional code is compiled by the compiler to determine its compilation address. Once the appropriate compilation address for the functional code is determined, it is stored in the data storage area. When loading the functional code subsequently, it will be loaded according to the previously determined compilation address.

[0037] Figure 1 The example demonstrates code switching within a single dynamic memory area. In this scenario, there is only one dynamic memory area. The various functional code snippets in the data storage area have different addresses, but their compilation addresses are the same, and they are all loaded into this dynamic memory area. Since only one functional code snippet can be loaded and executed at a time for a single dynamic memory area, when there are dependency calls between code snippets, this dynamic memory area needs to frequently switch between functional code snippets during program execution, leading to a decrease in program efficiency.

[0038] Reference Figure 2 , Figure 2 This is a schematic diagram of another embodiment of an embedded system.

[0039] exist Figure 2 In this embedded system, more dynamic memory areas are included. If there are two dynamic memory areas, each capable of loading and running several functional code segments, this configuration can further improve program execution efficiency when there are dependencies between the functional code segments.

[0040] For example, if function code 1 and function code 6 are interdependent, then it is only necessary to load function code 1 into dynamic memory area 1 and function code 6 into dynamic memory area 2. During program execution, function code 1 and function code 6 have both been loaded into the dynamic memory area and can be called and executed. Therefore, there is no need to switch function codes between dynamic memory area 1 and dynamic memory area 2.

[0041] However, if function code 1 and function code 2 are interdependent, frequent switching of function code in dynamic memory area 1 will still occur. This is because the corresponding compilation address is already calculated in the compiler during the storage of function code into the data storage area. Function code 1, function code 2, function code 3, and function code 4 stored in storage area A are compiled to dynamic memory area 1. Function code 5, function code 6, function code 7, and function code 8 stored in storage area B are compiled to dynamic memory area 2. Therefore, function code 1 to 4 can only be loaded into dynamic memory area 1, and function code 5 to 8 can only be loaded into dynamic memory area 2. Even if dynamic memory area 2 is free, function code 2 cannot be loaded into it. Therefore, when all dependent function codes are compiled and adapted to the same dynamic memory area, such as function code 1 and function code 2 being interdependent and both adapted to dynamic memory area 1, frequent switching of function code in dynamic memory area 1 will still occur, resulting in low operating efficiency.

[0042] To address the problem mentioned above of the frequent switching of functional code in the dynamic memory area of ​​embedded systems, which affects program execution efficiency, this application proposes a data processing method, as detailed in the following embodiments.

[0043] The method described in this application embodiment is applied to an embedded system. The embedded system includes a dynamic memory area and a data storage area. The data storage area stores at least two functional code groups, including a first functional code group and a second functional code group. Each of the first and second functional code groups includes multiple functional codes. At least one functional code in the first functional code group is identical to a functional code in the second functional code group. The dynamic memory area is used to store the compilation addresses of the functional codes in the corresponding functional code groups. All functional codes in the same functional code group have the same compilation address. The dynamic memory area includes at least a first dynamic memory area and a second dynamic memory area. The first dynamic memory area corresponds to the compilation address of the functional codes in the first functional code group, and the second dynamic memory area corresponds to the compilation address of the functional codes in the second functional code group.

[0044] Reference Figure 3 , Figure 3 This is a schematic diagram of an embedded system embodiment to which the method of this application is applied. Figure 3In the code, the data storage area stores a first functional code group and a second functional code group. The functional codes in the first functional code group have their compilation address determined to be in dynamic memory area 1 at storage time. The functional codes in the second functional code group have their compilation address determined to be in dynamic memory area 2 at storage time. Functional code 1-1 is identical to functional code 1, functional code 2-1 is identical to functional code 2, and functional code 3-1 is identical to functional code 3. There is no functional code in the second functional code group identical to functional code 4. Functional codes 1-1, 2-1, and 3-1 in the second functional code group and functional codes 1, 2, and 3 in the first functional code group can be considered as backups of each other. The descriptions of functional codes 1-1 and 1 only indicate that their compilation addresses are different; similar descriptions of other similar functional codes also only indicate that their compilation addresses are different. When a functional code calls another functional code, it can be considered as calling that other functional code or its backup. For example, when functional code 1 calls functional code 2, it can be considered as calling functional code 2 or calling functional code 2-1. Function code 2 and function code 2-1 perform the same function. (See reference...) Figure 4 , Figure 4 This is a schematic flowchart of the first embodiment of the data processing method of this application. It includes, but is not limited to, the following steps.

[0045] S11: Obtain the execution command.

[0046] The execution command is a command issued to the embedded system. The embedded system can determine which programs to run and which function codes to call based on the execution command.

[0047] S12: Based on the execution command, load the first target function code in the first target function code group from the data storage area into the first dynamic memory area for execution.

[0048] When the function code to be called is determined based on the execution command, the corresponding function code is loaded into the first dynamic memory area.

[0049] For example, with Figure 3 Taking an embedded system as an example, when the executed command calls function code 1, the embedded system loads function code 1 into the dynamic memory area. Loading function code 1 into dynamic memory area 1, or loading function code 1-1 into dynamic memory area 2, is acceptable. Both will achieve the functionality of function code 1.

[0050] S13: During the execution of the first target function code, when the first target function code calls other function codes, the second target function code corresponding to the other function codes is selected from the second function code group.

[0051] When the first target function code has dependencies on other function codes, and the execution of the first target function code requires calling other function codes, the function code that is identical to the other function codes is determined from the second function code group. Here, "identical" means that the code is the same.

[0052] For example, with Figure 3 Taking an embedded system as an example, when a command is executed to call function code 1, function code 1 is loaded from the first function code group into dynamic memory area 1. When function code 1 needs to call function code 2, since dynamic memory area 1 is already occupied by function code 1 and is being executed, to avoid frequent switching of function data in dynamic memory area 1, function code 2-1, which is identical to function code 2, is selected from the second function code group. Function code 2-1 has the same code as function code 2, only the loaded dynamic memory address is different.

[0053] S 14: Load the second target function code from the data storage area into the second dynamic memory area for execution.

[0054] The loading address corresponding to the function code in the second function code group is the second dynamic memory area. After determining the second target function code, the second target function code is loaded into the second dynamic memory area.

[0055] In this embodiment, since at least two functional codes in the first functional code group and the functional codes in the second functional code group are the same in the functional code group stored in the data storage area, and the compilation address corresponding to the first functional code group is the first dynamic memory area, and the compilation address corresponding to the second functional code group is the second dynamic memory area, when the embedded system loads two functional codes with dependencies, if the functional codes with dependencies exist in both the first and second functional code groups, one of the two functional codes can be loaded in the first and second dynamic memory areas respectively. The above method reduces the possibility that functional codes with dependencies exist only in the same functional code group and can only be loaded into the same dynamic memory area, which helps to reduce the number of functional code switching during program execution in the dynamic memory area.

[0056] In one embodiment, all function codes in the first function code group are identical to all function codes in the second function code group. Here, "identical" means the codes are identical. For example... Figure 5 As shown, Figure 5This is a schematic diagram of an embedded system embodiment to which the method of this application is applied. If all function codes in the first function code group and the second function code group are identical, the embedded system can minimize the number of function code switching times in the dynamic memory area. This is because the more identical function codes there are, the greater the likelihood that dependent function codes exist in both the first and second function code groups, thus increasing the potential for reducing the number of function code switching times.

[0057] In the embodiments of this application, when there are multi-level calling relationships in the function code, such as function code 1 calling function code 2, function code 2 calling function code 3, etc., the number of function code switching can be reduced by increasing the number of function code groups and dynamic memory areas.

[0058] In one embodiment, all functional codes in all functional code groups within the data storage area are identical. Ensuring that each functional code group includes all functional codes minimizes the number of functional code switches in the dynamic memory area, thereby improving data processing performance.

[0059] Reference Figure 6 , Figure 6 This is a schematic diagram of an embedded system embodiment to which the method of this application is applied.

[0060] When the embedded system receives an execution command and determines that function code 1 needs to be called, it loads function code 1 into dynamic memory area 1 for execution. When function code 1 needs to call function code 2, since function code 1 is already loaded and executing in dynamic memory area 1, it cannot use dynamic memory area 1 to load function code 2, otherwise it would increase the number of function code switching times in dynamic memory area 1. Therefore, dynamic memory area 2 is chosen to load function code 2-1. Function code 2-1 is identical to function code 2 and implements the same function. When function code 2-1 calls function code 3, since both dynamic memory areas 1 and 2 are already loaded and executing function code 1 and 2, it cannot use dynamic memory areas 1 and 2 to load function code, otherwise it would increase the number of function code switching times between dynamic memory areas 1 and 2. Therefore, dynamic memory area 3 is chosen to load function code 3-2.

[0061] When functional code has multi-level call relationships, more functional code groups and dynamic memory areas are set up. Each functional code group in the data storage area corresponds to a dynamic memory area, which serves as the compilation address for the functional code within the group. The dynamic memory areas corresponding to each functional code group are different. The more functional code that is the same across different functional code groups, the greater the possibility of reducing the number of times functional code switches in the dynamic memory area are needed during program execution.

[0062] When the maximum level of the function call relationship is less than or equal to the number of dynamic memory areas, the number of function code switches in the dynamic memory area can be minimized. When the maximum level of the function call relationship is greater than the number of dynamic memory areas, the smaller the difference, the greater the possibility of reducing the number of function code switches in the dynamic memory area.

[0063] Each level of function code call is similar to the first target function code calling the second target function code as described above.

[0064] Reference Figure 7 , Figure 7 This is a flowchart illustrating a second embodiment of the data processing method of this application. This method further defines the dynamic memory area loading function code. It includes, but is not limited to, the following steps.

[0065] S21: Determine the function code to be invoked.

[0066] The function code to be invoked is the function code that needs to be invoked based on the execution command or code call relationship.

[0067] S22: Determine whether the function code to be called is stored in the dynamic memory area.

[0068] Before these functional codes can be invoked, they need to be loaded into the dynamic memory area.

[0069] Before determining whether the function code to be called needs to be loaded into the dynamic memory area, it is first determined whether the function code to be called has already been loaded. Then, based on the result of the determination, it is decided whether the function code to be called needs to be loaded. If the function code to be called has already been loaded, step S23 is executed; if the function code to be called has not yet been loaded into the dynamic memory area, step S24 is executed.

[0070] S23: No need to load the code for the function to be called.

[0071] After checking all dynamic memory areas, if it is found that some dynamic memory areas have already loaded the function code to be called, then the function code to be called can be called directly through the dynamic memory area. There is no need to reload the function code to be called.

[0072] S24: Load the function code to be called from the data storage area to the dynamic memory area.

[0073] After checking all dynamic memory areas, it is found that the function code to be called is not loaded in any of them. Therefore, a dynamic memory area needs to be selected to load the function code for subsequent calls. The function code to be called that needs to be loaded becomes the function code to be loaded and needs to be loaded into the dynamic memory area.

[0074] In the embodiments of this application, by detecting whether the function code to be called has been loaded, redundant loading operations are avoided, the number of function code switching in the dynamic memory area is reduced, and data processing performance is improved.

[0075] Reference Figure 8 , Figure 8 This is a flowchart illustrating the third embodiment of the data processing method of this application. This method further defines the dynamic memory area loading function code. It includes, but is not limited to, the following steps.

[0076] S31: Records the loading time of the function code into the dynamic memory area.

[0077] S32: When the dynamic memory area is full and there is functional code to be loaded, delete the functional code with the earliest loading time in the dynamic memory area, so that the dynamic memory area can load the functional code to be loaded.

[0078] When switching between functional code in dynamic memory areas, since there are multiple dynamic memory areas, it is necessary to determine which dynamic memory area to switch between. This can improve the processing efficiency of the entire data processing flow and enhance the data processing performance of the system.

[0079] This embodiment determines the earliest loaded function code in the dynamic memory area based on the loading time of the function code, and uses this earliest loaded function code as the function code with the highest switching priority. When new function code needs to be loaded, the function code with the earliest loading time is selected to replace it.

[0080] by Figure 9 For example, Figure 9 This is a flowchart illustrating the switching process of function codes in the dynamic memory areas of this application. Initially, no function codes are loaded in any of the dynamic memory areas. Then, during data processing, function codes 1, 2-1, 3-3, and 4-2 are loaded sequentially. When a new function code 5 needs to be loaded, function code 1, which was loaded earliest, is selected and replaced.

[0081] Reference Figure 10 , Figure 10 This is a flowchart illustrating the fourth embodiment of the data processing method of this application. This method further defines the dynamic memory area loading function code in the above embodiments. It includes, but is not limited to, the following steps.

[0082] S41: Determine the function code to be invoked.

[0083] When recording the loading time of functional code, the loading time is recorded based on the storage status of the functional code in the dynamic memory area. First, the functional code to be called is determined, and then its loading time is updated according to its storage status in the dynamic memory area.

[0084] S42: When the function code to be called is stored in the dynamic memory area and does not need to be loaded, update the loading time of the function code to be called in the dynamic memory area.

[0085] To further improve the processing efficiency and data processing performance, this embodiment, based on the above embodiment, determines the least recently used function code by updating the loading time of the function code, and uses it as the function code with the highest switching priority.

[0086] If it's determined that the code to be loaded already exists in the dynamic memory area, then the code in the dynamic memory area will not be replaced since no new code needs to be loaded. However, the loading time of the existing code in the dynamic memory area will be updated, thereby lowering its switching priority. This reduces the likelihood of frequently used code being replaced, helping to improve processing efficiency and performance.

[0087] by Figure 11 For example, Figure 11 This is a flowchart illustrating the switching process of function codes in the dynamic memory area of ​​this application. Initially, no function codes are loaded in any of the dynamic memory areas. Then, during data processing, function codes 1, 2-1, 3-3, and 4-2 are loaded sequentially. When it is determined that function code 1 needs to be called, it is found that function code 1 already exists in the dynamic memory area, so the loading time of function code 1 is updated. Function code 2-1 then becomes the function code with the earliest loading time. Subsequently, when a new function code 5-1 needs to be loaded, function code 2-1 with the earliest loading time is selected and replaced.

[0088] The above-mentioned time records only record the function code that exists in the dynamic memory area. When the function code is deleted from the dynamic memory area, the corresponding record data is also deleted.

[0089] Reference Figure 12 , Figure 12 This is a flowchart illustrating the fifth embodiment of the data processing method of this application. This method further defines the dynamic memory area loading function code. It includes, but is not limited to, the following steps.

[0090] S51: Records the number of times the function code is loaded into the dynamic memory area.

[0091] S52: When the dynamic memory area is full and there is functional code to be loaded, delete the functional code that has been loaded the least in the dynamic memory area, so that the dynamic memory area can load the functional code to be loaded.

[0092] In some scenarios, the method of selecting replacement function code based on loading time is not entirely suitable. Therefore, this embodiment selects the function code with the fewest loading times as the function code with the highest switching priority. When new function code needs to be loaded, the function code with the fewest loading times is selected to replace it.

[0093] When there are multiple functional codes with the fewest loading times, the functional code that needs to be replaced is still determined based on the loading time. The functional code with the earliest loading time among these functional codes is selected as the functional code that needs to be replaced.

[0094] by Figure 13 For example, Figure 13 This is a flowchart illustrating the switching process of function codes in the dynamic memory areas of this application. Initially, no function codes are loaded in any of the dynamic memory areas. Then, during data processing, function codes 1, 2-1, 3-3, and 4-2 are loaded sequentially. Each of these is loaded once. When the program continues execution, function codes 1, 6-2, 7-3, and 8-1 are called sequentially. At this point, the load count of function code 1 is updated to 2, while the other function codes are loaded once. When a new function code 5-1 needs to be loaded, the function code with a load count of 1 needs to be selected for replacement. Among the function codes with a load count of 1, function code 6-2 was loaded earliest, therefore function code 6-2 is replaced. The load count of function code 5-1 is updated to 1.

[0095] like Figure 14 As shown, Figure 14 This is a schematic diagram of the structure of an embodiment of the embedded system of this application.

[0096] The embedded system includes a data storage area 110 and a dynamic memory area 120.

[0097] Data storage area 110 stores at least two function code groups, including a first function code group and a second function code group. Each of the first and second function code groups includes multiple function codes, and at least one function code in the first function code group is the same as a function code in the second function code group.

[0098] The dynamic memory area 120 is used for the compilation address of the functional code in the corresponding functional code group. All functional codes in the same functional code group have the same compilation address. The dynamic memory area includes at least a first dynamic memory area and a second dynamic memory area. The first dynamic memory area corresponds to the compilation address of the functional code in the first functional code group, and the second dynamic memory area corresponds to the compilation address of the functional code in the second functional code group.

[0099] The data storage area 110 and the dynamic memory area 120 are connected to implement the methods provided by any embodiment and possible combination of the data processing methods described above in this application.

[0100] like Figure 15 As shown, Figure 15 This is a schematic diagram of the structure of an embodiment of the electronic device of this application.

[0101] The electronic device includes a processor 210 and a memory 220.

[0102] Processor 210 controls the operation of electronic devices. Processor 210 can also be called a CPU (Central Processing Unit). Processor 210 may be an integrated circuit chip with signal sequence processing capabilities. Processor 210 can also be a general-purpose processor, a digital signal sequence processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor.

[0103] The memory 220 stores the instructions and program data required for the processor 210 to operate.

[0104] The processor 210 is used to execute instructions to implement the methods provided in any of the foregoing embodiments and possible combinations of the data processing methods of this application.

[0105] like Figure 16 As shown, Figure 16 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application.

[0106] One embodiment of the readable storage medium of this application includes a memory 310 that stores program data, which, when executed, implements the methods provided in any embodiment and possible combinations of the data processing methods of this application.

[0107] The memory 310 may include a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or other media that can store program instructions. Alternatively, it may be a server that stores the program instructions, which can send the stored program instructions to other devices for execution or execute the stored program instructions itself.

[0108] In summary, this application addresses the issue that, within the functional code groups stored in the data storage area, at least two functional codes in the first functional code group are identical to those in the second functional code group. Furthermore, the compilation address corresponding to the first functional code group is the first dynamic memory area, and the compilation address corresponding to the second functional code group is the second dynamic memory area. Therefore, when the embedded system loads two dependent functional codes, if the dependent functional codes exist in both the first and second functional code groups, one of these two functional codes can be loaded into the first and second dynamic memory areas respectively. This method reduces the possibility that dependent functional codes exist only in the same functional code group and can only be loaded into the same dynamic memory area, thus helping to reduce the number of functional code switching operations during program execution in the dynamic memory area and improving data processing performance.

[0109] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0110] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0111] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0112] If the integrated units in the other embodiments described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0113] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A data processing method, characterized in that, An embedded system is used, comprising a dynamic memory area and a data storage area. The data storage area stores at least two functional code groups, including a first functional code group and a second functional code group. Each of the first and second functional code groups includes multiple functional codes. At least two functional codes in the first functional code group are identical to those in the second functional code group. The dynamic memory area corresponds to the compilation addresses of the functional codes in the functional code groups. All functional codes in the same functional code group have the same compilation address. The dynamic memory area includes at least a first dynamic memory area and a second dynamic memory area. The first dynamic memory area corresponds to the compilation address of the functional codes in the first functional code group, and the second dynamic memory area corresponds to the compilation address of the functional codes in the second functional code group. The method includes: Obtain the execution command; Based on the execution command, the first target function code in the first target function code group is loaded from the data storage area into the first dynamic memory area for execution; During the execution of the first target function code, when the first target function code calls other function codes, the second target function code corresponding to the other function codes is selected from the second function code group; The second target function code is loaded from the data storage area into the second dynamic memory area for execution.

2. The method according to claim 1, characterized in that, All function codes in the first function code group are the same as all function codes in the second function code group.

3. The method according to claim 1, characterized in that, All function codes in all function code groups within the data storage area are identical.

4. The method according to claim 1, characterized in that, The functional code is loaded into the dynamic memory area in the following ways: Identify the function code to be invoked; Determine whether the function code to be invoked is stored in the dynamic memory area; If so, there is no need to load the code for the function to be invoked; If not, load the function code to be invoked from the data storage area into the dynamic memory area.

5. The method according to claim 1, characterized in that, The functional code is loaded into the dynamic memory area in the following ways: Record the loading time of the function code into the dynamic memory area; When the dynamic memory area is full and there is functional code to be loaded, delete the functional code with the earliest loading time in the dynamic memory area, so that the dynamic memory area can load the functional code to be loaded.

6. The method according to claim 5, characterized in that, The recording of the loading time of the functional code into the dynamic memory area includes: Identify the function code to be invoked; When the function code to be invoked is stored in the dynamic memory area and does not need to be loaded, the loading time of the function code to be invoked in the dynamic memory area is updated.

7. The method according to claim 1, characterized in that, The functional code is loaded into the dynamic memory area in the following ways: Record the number of times the functional code is loaded into the dynamic memory area; When the dynamic memory area is full and there is functional code to be loaded, delete the functional code that has been loaded the least in the dynamic memory area, so that the dynamic memory area can load the functional code to be loaded.

8. An embedded system, characterized in that, include: The data storage area stores at least two functional code groups, including a first functional code group and a second functional code group. Each of the first and second functional code groups includes multiple functional codes. At least two functional codes in the first functional code group are the same as the functional codes in the second functional code group. A dynamic memory area is provided, which corresponds to the compilation address of the functional code in the functional code group. All functional codes in the same functional code group have the same compilation address. The dynamic memory area includes at least a first dynamic memory area and a second dynamic memory area. The first dynamic memory area corresponds to the compilation address of the functional code in the first functional code group, and the second dynamic memory area corresponds to the compilation address of the functional code in the second functional code group. The dynamic memory area and the data storage area are connected to implement the method as described in any one of claims 1-7.

9. An electronic device, characterized in that, Includes the embedded system as described in claim 8, to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program data, which, when executed by a processor, implements the method as described in any one of claims 1-7.