A Hardware Decoupling Method for Multi-Address Variable Management

By establishing a collection of key information at the application layer of the MCU platform, synchronous update and access of multiple access variables is solved, and the problem of global variable data is not synchronized in embedded systems is improved, and system stability and code maintenance efficiency are improved.

CN116541406BActive Publication Date: 2025-07-22HARBIN INST OF TECH AT WEIHAI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310647052.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-31
Publication Date
2025-07-22
Estimated Expiration
2043-05-31

AI Technical Summary

Technical Problem

In embedded systems developed on the MCU platform, global variables between multiple modules are easily modified simultaneously, resulting in data out of synchronization, affecting system stability, and complex code maintenance and high development resources.

Method used

The hardware-decoupled multi-access variable management method is adopted to establish a key information collection at the application layer to realize the synchronous update and access of multiple access variables, avoid relying on global variable management of the kernel layer, and use the message pool to lock the storage addresses of variables in different modules, and synchronous update and unlock the callback functions.

Benefits of technology

It effectively avoids the risk of data asynchronousness between multiple modules, simplifies code maintenance, and improves system stability and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116541406B_ABST
    Figure CN116541406B_ABST
Patent Text Reader

Abstract

The present application provides a hardware decoupled multi-address variable management method, including an editing operation of a key information set of a multi-address variable and an access operation of the multi-address variable; the multi-address variable is a variable that needs to be stored with synchronous updates at at least two storage addresses; the key information set includes information required to access its corresponding multi-address variable with synchronous updates; the access operation of the multi-address variable is performed in a hardware decoupled manner at the application layer of the MCU platform, including the step of accessing the multi-address variable corresponding to the key information set with synchronous updates based on the key information set. The management method provided by the present application can achieve software and hardware decoupling during the access process of multi-address variables, effectively eliminating the risk of data asynchronization caused by interrupt competition between multiple modules during the operation of the embedded system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of embedded systems. Specifically, a multi-address variable management method with hardware decoupling is provided. Background Art

[0002] The MCU (Microcontroller Unit) is also known as a single-chip microcomputer. As an important part of the embedded system, the MCU integrates a central processing unit, memory, counter, A / D conversion, driving circuit, and peripheral interface circuit, etc. on a single chip to form a chip-level computer. Embedded system products developed based on the MCU platform have the advantages of real-time response, safety and reliability, low power consumption, and low cost. Currently, they have been widely used in industrial, military, and civilian fields. In the embedded system developed on the MCU platform, when variables such as the status information of each peripheral change, they are generally obtained by the main control program through receiving interrupts. At the same time, in some cases where multiple peripherals need to cooperate, the above variables need to be synchronized among multiple modules / application programs.

[0003] The synchronization of the above variables can theoretically be achieved by using global variables (variables declared by extern). However, although most embedded systems developed based on the MCU platform have been layered at levels such as software application / driver / module / hardware kernel, etc., in the final development (especially in the software application layer), it is still easy for global variables to be called in multiple files / application programs, and even modified simultaneously in multiple places, resulting in data asynchronization problems among various modules, seriously affecting the stable operation of the system, and even causing the system to crash.

[0004] To solve the above problems, it is generally necessary to artificially design semaphores and other methods to coordinate uniformly among each peripheral or module of the MCU platform. When there are many peripherals or modules involved in the MCU platform, the development and maintenance of the control programs for each peripheral and module are often carried out by different teams, and the development and maintenance progress are different. Coordinating global variables among various programs will consume a large amount of development resources and make the code become more and more bloated. Summary of the Invention

[0005] The purpose of this application is to provide a multi-address variable management method with hardware decoupling to solve the problems existing in the above prior art.

[0006] The embodiments of this application can be implemented through the following technical solutions:

[0007] A hardware decoupled multi-address variable management method for managing multi-address variables on an MCU platform, including editing operations on the key information set of multi-address variables and access operations on multi-address variables; the multi-address variables are variables that need to be stored with synchronous updates at at least two storage addresses; the key information set includes information required to access its corresponding multi-address variable with synchronous updates; the access operation of the multi-address variable is performed in a hardware-decoupled manner at the application layer of the MCU platform, including an operation of accessing the multi-address variable corresponding to the key information set with synchronous updates based on the key information set.

[0008] Further, the access operation of the multi-address variable includes a read operation of the multi-address variable and an update operation of the multi-address variable.

[0009] Further, the key information set includes: the locked state of the multi-address variable corresponding to the key information set; the index of the multi-address variable corresponding to the key information set; the current value of the multi-address variable corresponding to the key information set; a list of storage addresses of the multi-address variable corresponding to the key information set, and the list of storage addresses includes at least two storage addresses of the multi-address variable.

[0010] Further, the read operation of the multi-address variable includes the following steps:

[0011] Determine the corresponding key information set based on the multi-address variable to be read;

[0012] Query the locked state of the multi-address variable from the key information set. If the locked state of the multi-address variable is unlocked, directly proceed to the next step. If the locked state of the multi-address variable is locked, wait until the locked state of the multi-address variable becomes unlocked and there is no earlier read or update operation on the multi-address variable, and then proceed to the next step;

[0013] Set the locked state of the multi-address variable to locked.

[0014] Obtain the list of storage addresses of the multi-address variable from the key information set;

[0015] Determine the storage address for reading the multi-address variable from the list of storage addresses, and read the multi-address variable from the storage address, or read the multi-address variable from the key information set;

[0016] Set the locked state of the multi-address variable to unlocked.

[0017] Further, the update operation of the multi-address variable includes the following steps:

[0018] Obtain the latest value of the multi-address variable to be updated;

[0019] Determine the corresponding key information set based on the multi-address variable to be updated;

[0020] Query the locked state of the multi-address variable from the key information set. If the locked state of the multi-address variable is unlocked, directly proceed to the next step. If the locked state of the multi-address variable is locked, wait until the locked state of the multi-address variable becomes unlocked and there is no earlier read or update operation on the multi-address variable, and then proceed to the next step;

[0021] Set the locked state of the multi-address variable to locked;

[0022] Obtain the list of storage addresses of the multi-address variable from the key information set;

[0023] Update the multi-address variable at all storage addresses of the multi-address variable using the latest value, and set the current value of the multi-address variable in the key information set to the latest value;

[0024] Set the locked state of the multi-address variable to unlocked.

[0025] Preferably, the latest value is determined by any program or function having the permission to update the multi-address variable, or obtained from any received interrupt that triggers the change of the multi-address variable.

[0026] Preferably, the update operation of the multi-address variable is executed through a callback function; the key information set further includes a pointer to the callback function for updating the multi-address variable corresponding to the key information set.

[0027] Preferably, the key information set further includes the refresh frequency information of the current value of the multi-address variable corresponding to the key information set.

[0028] Furthermore, the editing operation of the key information set of the multi-address variable includes the establishment operation, modification operation, and deletion operation of the key information set. Among them, the modification operation of the key information set includes the operations of appending, modifying, and deleting the list of storage addresses of the multi-address variable corresponding to the key information set.

[0029] Preferably, the hardware decoupled multi-address variable management method further includes the operation of sending the key information set of the multi-address variable to the peripherals of the MCU platform.

[0030] A method for managing multi-address variables with hardware decoupling provided by an embodiment of the present application changes the existing global management mechanism for accessing multi-address variables accessed by multiple modules in an embedded system. By establishing a set of key information corresponding to the multi-address variables, and then accessing the multi-address variables synchronously and updated using the set of key information at the application layer. Using the management method provided by the present application, it is possible to achieve software and hardware decoupling during the access process of multi-address variables, thereby effectively eliminating the risk of data asynchronization caused by interrupt competition between multiple modules during the operation of the embedded system. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is a schematic diagram of the system framework of an embedded system developed based on an MCU platform;

[0032] Figure 2 It is a schematic diagram of an existing global variable update mechanism on an MCU platform;

[0033] Figure 3 It is a schematic diagram of an ideal multi-address variable update mechanism on an MCU platform;

[0034] Figure 4 It is a schematic diagram of operations included in the multi-value variable management method with hardware decoupling provided by an embodiment of the present application;

[0035] Figure 5 It is a schematic flowchart of the read operation of the multi-address variable provided by an embodiment of the present application;

[0036] Figure 6 It is a schematic flowchart of the update operation of the multi-address variable provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0037] Hereinafter, the present application will be further described based on preferred embodiments with reference to the accompanying drawings. The embodiments described below are only a part of the embodiments of the present application, rather than all of the embodiments, and should not be construed as a limitation on the scope of the technical solutions claimed in the present application.

[0038] In addition, the terms used in this specification, such as "comprising", "having" and their cognates, are only used to denote specific features, variables, values, steps, elements or combinations of the above, and should not be construed as excluding the possibility of the existence of at least one other feature, variable, value, step, element or combination of the above; and the terms such as "first", "second" used in this specification are only for distinguishing descriptions and should not be construed as indicating or implying relative importance.

[0039] Unless otherwise defined, the meanings of the technical terms and scientific terms used in this specification are the same as those generally understood by those skilled in the art.

[0040] To make the description of the specific embodiments of this application clear and easy to understand, the following definitions are provided.

[0041] A storage address refers to the location where data such as constants and variables is stored in the storage medium of a computer system according to a set data structure (such as in the form of a single data, an array, an object, etc.).

[0042] A multi-address variable refers to a variable that has multiple storage addresses, and the variable values of the multi-address variable stored in each storage address can be the same or different.

[0043] Synchronous update means that for a multi-address variable, the variable values stored in all or part of its storage addresses change in the same way.

[0044] Figure 1 The figure shows a schematic diagram of the architecture of a specific embedded system developed based on the MCU platform, as Figure 1 shown. This embedded system includes a chip architecture layer, a kernel layer, a driver layer, an operating system, application programs, and peripherals, etc. When the operating system runs, it calls various control programs through the main thread to read, write, and other operations on the data of various peripherals, such as the operating status, so as to achieve the control of each peripheral.

[0045] Since the status of the same peripheral may be accessed by different programs or modules, a coordination mechanism needs to be provided to keep the same status quantity of the same peripheral consistent in each program or module.

[0046] Figure 2 The figure shows an existing implementation method of data update in multiple modules through global variables, as Figure 2 shown. The global variable is used to represent a specific data of a specific peripheral. For example: the rotation speed data of a certain motor connected to the embedded system, or the attitude data of a certain attitude sensor connected to the embedded system. The data structure of this data can be a single variable, a one-dimensional or multi-dimensional array, or a structure composed of different types of data, etc.

[0047] In Figure 2In the illustrated embodiment, when a global variable is declared, a total of three modules (Module 1, Module 2, and Module 3) can access it (i.e., have the permission to read and update it). In some specific embodiments, the above three modules can respectively represent different application programs or functions, which need to access the same global variable during their operation, such as obtaining the value of the global variable or having the permission to update the value of the global variable. The situation where different modules access the same global variable is common in embedded systems where different peripheral control programs / functions need to obtain the signals collected by the same sensor, such as pose signals, speed signals, acceleration signals, etc.; or different application programs / functions all have the permission to update the value of the same global variable, such as setting the motor speed value or the servo angle value, etc.

[0048] Specifically, each module respectively allocates a storage space for the global variable inside it to store the value of the global variable. Obviously, the global variable has its own storage address in Module 1, Module 2, and Module 3 respectively (for example: the first storage address, the second storage address, and the third storage address).

[0049] When the state of the peripheral or the system changes, the variable value of the global variable can be updated by triggering the reception of an interrupt. In addition, the value of the variable stored in each storage address can also be updated by using an assignment function in the control program, etc. During the above various processes of accessing the variable values of the global variable at different storage locations, if a new reception interrupt is generated by the system when accessing a certain storage address, different storage addresses may be triggered by different reception interrupts at this time, and different values are used to update the variables stored in them, resulting in different values of the same global variable in different modules. When different modules are developed by multiple development teams, if the code developed by each team cannot be coordinated, the occurrence of the above problems is almost inevitable, and it is very likely to cause the system to freeze or crash due to inconsistent global variables during operation.

[0050] Obviously, a variable management mechanism with hardware decoupling is needed. This management mechanism should not rely on global variables involving the kernel layer, but should manage multi-address variables that need to be stored at multiple addresses in the application layer, such as maintaining the storage addresses of multi-address variables and ensuring that the values of multi-address variables stored in each storage address can be updated synchronously.

[0051] Figure 3 Shows an update mechanism for variables that can be accessed by multiple modules and is superior to the prior art, as Figure 3As shown, in this update mechanism, global variables are cancelled, and instead, a message pool (MSG_Pool) is used to manage the storage addresses and specific values of variables in different modules. When the value of a variable needs to be updated for any reason, the addresses are locked, and only the callback function with write permission updates the values of the variables in each storage address. After synchronous update, the storage addresses are unlocked.

[0052] In the above mechanism, the update operation of variables stored in multiple addresses is implemented at the application layer. By locking the storage addresses in the address list → synchronous update by the callback function → unlocking, it can ensure that when updating the value of a variable in a certain storage address, new incoming interrupts or assignment operations that may cause changes to the values of variables in other storage addresses are blocked, and it also avoids potential impacts on the operating system or kernel layer caused by setting global variables, truly realizing the decoupling of software and hardware in the variable management process.

[0053] Obviously, when using the above - better variable management mechanism, the data structure of the variables and their access operations need to be correspondingly modified. For this reason, this application provides a multi - address variable management method with hardware decoupling through embodiments. Figure 4 shows a schematic diagram of the operations performed by this management method in some embodiments, as Figure 4 As shown, this management method includes the editing operation of the key information set of multi - address variables and the access operation of multi - address variables.

[0054] In the embodiments of this application, as described above, a multi - address variable is a variable that needs to be stored with synchronous update in at least two storage addresses. Specifically, as described above, the storage addresses of this multi - address variable can be located in different modules running on an embedded system, and the number of storage addresses of this multi - address variable can change with the change of the modules that need to access this multi - address variable.

[0055] In the embodiments of this application, for each multi - address variable, a corresponding key information set is bound to it, and this key information set contains the information required to access this multi - address variable with synchronous update.

[0056] Table 1 shows the data structure of the key information set bound to a multi - address variable in some preferred embodiments.

[0057] Table 1 Data structure of the key information set corresponding to a multi - address variable

[0058] Data item Optional type Value Index int / string Index value of multi-address variable Value Unlimited Current value of multi-address variable Location Array List of storage addresses of multi-address variable LockState Semaphore Locking state of multi-address variable

[0059] As shown in Table 1, the key information set corresponding to the multi - address variable can be a composite data structure composed of different types of data items, where:

[0060] The Index corresponds to the index value of the multi-address variable and is used to uniquely determine the multi-address variable. For example, it can be a number of int type or long type, or a variable name of string type, etc.;

[0061] The Value corresponds to the current value of the multi-address variable. In the embodiments of the present application, this item is used to store the current value of the multi-address variable. Therefore, its data structure is consistent with the data structure of the multi-address variable. For example, it can be a variable of int, long, or float type, or a one-dimensional or multi-dimensional array type variable, or a pointer variable, or a struct (structure) type variable formed by combining the above various types of variables, etc.;

[0062] The Location corresponds to the storage address list of the multi-address variable. For example, it can be an array type variable arranged in sequence according to the subscript, and the value of each element in the array is a storage address of the multi-address variable;

[0063] The LockState corresponds to the locked state of the multi-address variable. When a multi-address variable is in an unlocked state, all programs or functions with access rights are entitled to read or update it. When a multi-address variable is in a locked state, except for the program / function that has currently entered the read or update operation, other programs / functions that need to access the multi-address variable wait in line for the switching of the locked state; specifically, in some embodiments, a semaphore used to coordinate thread synchronization in an embedded system can be used as the LockState and used to lock and unlock the multi-address variables in the present application.

[0064] In the embodiments of the present application, the editing operations of the key information set of the multi-address variable include the establishment operation, modification operation, and deletion operation of the key information set. Specifically, when a new multi-address variable needs to be generated, first create the key information set corresponding to the multi-address variable, specify an index value or variable name for it, and assign an initial value to it, and then create a storage address list for it and specify a callback function pointer, thereby completing the establishment of the key information set.

[0065] In the embodiments of the present application, the modification operations of the key information set include operations of appending, modifying, and deleting the list of storage addresses of the multiple access variables corresponding to the key information set. Specifically, during the operation of the embedded system, when the module with the update permission for a multiple access variable changes, for example, when a module that has the right to read and update the multiple access variable appears, it is necessary to append the storage address of the multiple access variable stored in this module to the list of storage addresses. Or, when the storage address of an original module that has the right to read and update the multiple access variable changes, or when this module is deleted or demoted, correspondingly, it is necessary to perform the modification and deletion operations on the list of storage addresses.

[0066] In the embodiments of the present application, the access operations for multiple access variables are decoupled from the application layer hardware of the MCU platform, and include operations of accessing the multiple access variables corresponding to the key information set by synchronously updating based on the key information set.

[0067] Specifically, as Figure 4 shown, the access operations for multiple access variables include the read operation for multiple access variables and the update operation for multiple access variables. Some embodiments will be combined with the accompanying drawings and specific examples to elaborate on the read operation and update operation for multiple access variables in detail.

[0068] Figure 5 shows a schematic flow diagram of the read operation for multiple access variables in some preferred embodiments. As Figure 5 shown, the read operation for multiple access variables includes the following steps:

[0069] Step 110, determine the corresponding key information set based on the multiple access variable to be read;

[0070] Step 120, query the locked state of the multiple access variable from the key information set. If the locked state of the multiple access variable is unlocked, directly proceed to Step 130. If the locked state of the multiple access variable is locked, wait until the locked state of the multiple access variable becomes unlocked and there is no earlier read or update operation for this multiple access variable, and then proceed to Step 130;

[0071] Step 130, set the locked state of the multiple access variable to locked;

[0072] Step 140, obtain the list of storage addresses of the multiple access variable from the key information set;

[0073] Step 150, determine the storage address for reading the multiple access variable from the list of storage addresses, and read the multiple access variable from this storage address, or read the multiple access variable from the key information set;

[0074] Step 160, set the locked state of the multiple access variable to unlocked.

[0075] Specifically, when a program or function needs to read a multi-address variable, it first queries whether the multi-address variable is locked. If it is in the locked state, it means that other programs / functions are performing read or update operations on the multi-address variable. At this time, it enters the queue for read or update operations on the multi-address variable until all the read or update operations in front of the queue are completed and the locked state becomes unlocked. Then, the program / function relocks the multi-address variable to prevent other programs / functions from entering the update operation during the read operation. Then, it obtains the set of key information corresponding to the multi-address variable to be read, then obtains the current value of the multi-address variable, and finally unlocks the multi-address variable after the read operation is completed, so that other programs / functions have the right to access the multi-address variable.

[0076] Specifically, the reading of the multi-address variable can be realized by obtaining the current value of the multi-address variable stored in the set of key information. In addition, as Figure 5 shown, a specific storage address can also be obtained, such as the value in storage address i, to realize the reading of the multi-address variable.

[0077] Through the above steps, it can be ensured that during the process of reading the current value of the multi-address variable, the variable value stored in any storage address will not change, thus avoiding the problem of data conflict caused by the update of a certain storage address during the reading process.

[0078] Figure 6 FIG. shows a schematic flow diagram of the update operation of the multi-address variable in some preferred embodiments. In the embodiments of the present application, the current value of the multi-address variable corresponding to the set of key information is updated based on any received interrupt that triggers the change of the multi-address variable. The received interrupt is an important mechanism for updating variables in an embedded system. For example, when the state of a certain peripheral changes, or the data received by a certain sensor exceeds a preset threshold, it will trigger the main thread to enter the received interrupt and perform operations such as variable update therein.

[0079] Specifically, as Figure 6 shown, the update operation of the multi-address variable includes the following steps:

[0080] Step 210, obtain the latest value of the multi-address variable to be updated;

[0081] Step 220, determine the corresponding set of key information based on the multi-address variable to be updated;

[0082] Step 230: Query the locked state of the multi-address variable from the key information set. If the locked state of the multi-address variable is unlocked, directly proceed to Step 240. If the locked state of the multi-address variable is locked, wait until the locked state of the multi-address variable becomes unlocked and there are no earlier read or update operations on the multi-address variable, and then proceed to Step 240;

[0083] Step 240: Set the locked state of the multi-address variable to locked;

[0084] Step 250: Obtain the list of storage addresses of the multi-address variable from the key information set;

[0085] Step 260: Update the multi-address variable at all storage addresses of the multi-address variable using the latest value, and set the current value of the multi-address variable in the key information set to the latest value;

[0086] Step 270: Set the locked state of the multi-address variable to unlocked.

[0087] In the above steps, when the value of the multi-address variable stored in any one of the storage addresses changes, a receive interrupt is triggered, and then the update operation of the multi-address variable is entered. In addition, in some other embodiments, the update of the multi-address variable may also be performed by a program or function that has the update permission for the multi-address variable. For example, a function that controls the speed of a motor or the angle of a servo.

[0088] Specifically, as Figure 6 shown, when an update to a multi-address variable is required, the program or function that performs the update first queries whether the multi-address variable is locked. If it is in the locked state, it means that other programs / functions are performing read or update operations on the multi-address variable. At this time, it enters the queue for read or update operations on the multi-address variable until all the read or update operations in front of the queue are completed and the locked state becomes unlocked. Then, the program / function relocks the multi-address variable to prevent other programs / functions from entering the update operation during the update operation. Then, it performs the update of each storage address and the current value in the key information set. Finally, after the update is completed, the multi-address variable is unlocked to enable other programs / functions to access the multi-address variable.

[0089] In some preferred embodiments, the synchronous update of the values in multiple storage addresses in Step 270 can be performed through a callback function. For this purpose, a pointer to the callback function needs to be added to the data structure of the key information set. Table 2 below shows the data structure of the key information set in some preferred embodiments that implement the synchronous update of multi-address variables through callback functions.

[0090] Table 2 Data Structure of Key Information Set in Some Preferred Embodiments

[0091]

[0092] As shown in Table 2, the key information set further includes a pointer Callback to a callback function for synchronously updating the multiple access variable corresponding to the key information set. After reading the latest value of the multiple access variable in the module that causes the reception interruption, the callback function can be called to synchronously update each storage address.

[0093] Furthermore, in some preferred embodiments, as shown in Table 2, the key information set further includes refresh frequency information Refresh_Rate of the current value of the multiple access variable corresponding to the key information set. The refresh frequency information can be a Float-type variable to count the refresh frequency of the last update, or it can be an array-type variable to sequentially retain the refresh frequency at each update. By analyzing the refresh frequency of the multiple access variable, the operating states of various parts (such as peripherals) of the embedded system can be further diagnosed. For example, when a multiple access variable that reflects attitude or power has not been updated for a long time, it is necessary to further monitor whether the corresponding device is abnormal.

[0094] Furthermore, in some preferred embodiments, the management method of the hardware-decoupled multiple access variable further includes an operation of sending the key information set of the multiple access variable to a peripheral of the MCU platform. By using serial communication or other means to send the key information set to peripherals such as a monitor or an external storage device, the specific value and update situation of the multiple access variable can be analyzed online or offline to analyze and monitor the operating state of the embedded system.

[0095] The specific embodiments of the present application have been introduced in detail above. For those skilled in the art of this technology, without departing from the principle of the present application, several improvements and modifications can still be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.

Claims

1. A hardware decoupled multi-address variable management method for managing multi-address variables on an MCU platform, characterized in that: It includes the editing operation of the key information set of the multi-address variable and the access operation of the multi-address variable; The multi-address variable is a variable that needs to be stored with synchronous updates at at least two storage addresses; The key information set includes the information required to synchronously update and access its corresponding multi-address variable; The access operation of the multi-address variable is performed in a hardware decoupled manner at the application layer of the MCU platform, including the operation of synchronously updating and accessing the multi-address variable corresponding to the key information set based on the key information set; The key information set includes: the locking state of the multi-address variable corresponding to the key information set; the index of the multi-address variable corresponding to the key information set; the current value of the multi-address variable corresponding to the key information set; a list of storage addresses of the multi-address variable corresponding to the key information set, and the list of storage addresses includes at least two storage addresses of the multi-address variable; The update operation of the multi-address variable includes the following steps: Obtain the latest value of the multi-address variable to be updated; Determine the corresponding key information set based on the multi-address variable to be updated; Query the locking state of the multi-address variable from the key information set. If the locking state of the multi-address variable is unlocked, directly proceed to the next step. If the locking state of the multi-address variable is locked, wait until the locking state of the multi-address variable becomes unlocked and there is no earlier read or update operation on the multi-address variable and then proceed to the next step; Set the locking state of the multi-address variable to locked; Obtain the list of storage addresses of the multi-address variable from the key information set; Use the latest value to update the multi-address variable at all storage addresses of the multi-address variable, and set the current value of the multi-address variable in the key information set to the latest value; Set the locking state of the multi-address variable to unlocked.

2. The hardware decoupled multi-address variable management method according to claim 1, characterized in that: The access operation of the multi-address variable includes the read operation and the update operation of the multi-address variable.

3. The hardware decoupled multi-address variable management method according to claim 1, characterized in that The read operation of the multi-address variable includes the following steps: Determine the corresponding key information set based on the multi-address variable to be read; Query the locking state of the multi-address variable from the key information set. If the locking state of the multi-address variable is unlocked, directly proceed to the next step. If the locking state of the multi-address variable is locked, wait until the locking state of the multi-address variable becomes unlocked and there is no earlier read or update operation on the multi-address variable and then proceed to the next step; Set the locking state of the multi-address variable to locked; Obtain the list of storage addresses of the multi-address variable from the key information set; Determine the storage address for reading the multi-address variable from the list of storage addresses, and read the multi-address variable from the storage address, or read the multi-address variable from the key information set; Set the locking state of the multi-address variable to unlocked.

4. The hardware decoupled multi-address variable management method according to claim 1, characterized in that: The latest value is determined by any program or function having the permission to update the multi-address variable, or obtained from any reception interruption that triggers a change in the multi-address variable.

5. The hardware decoupled multi-address variable management method according to claim 1, wherein: The update operation of the multi-address variable is executed through a callback function; The key information set further includes a pointer to a callback function for performing an update operation on the multi-address variable corresponding to the key information set.

6. The hardware decoupled multi-address variable management method according to claim 1, wherein: The key information set further includes refresh frequency information of the current value of the multi-address variable corresponding to the key information set.

7. The hardware decoupled multi-address variable management method according to claim 1, wherein: The editing operation of the key information set of the multi-address variable includes the establishment operation, modification operation and deletion operation of the key information set. Among them, the modification operation of the key information set includes the operations of appending, modifying and deleting the list of storage addresses of the multi-address variable corresponding to the key information set.

8. The hardware decoupled multi-address variable management method according to claim 1, wherein: It further includes an operation of sending the key information set of the multi-address variable to the peripherals of the MCU platform.

Citation Information

Patent Citations

  • IO port configuration device and method and PLC configuration software

    CN112415943A

  • Runtime address disambiguation in acceleration hardware

    US20180188983A1