Safe function parameter transmission method based on static binding of layered structure body and RAM (Random Access Memory)
By constructing a three-layer function proprietary structure type and an exclusive OR verification mechanism with verification parameters, the memory layout is optimized and data and code life cycle synchronous management is achieved, the problems of large time overhead, memory fragmentation and insufficient data security in traditional function parameter transfer methods are solved, and the stability and security of embedded systems are improved.
Patent Information
- Application Number
- CN202510507420.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-08-22
AI Technical Summary
Traditional function parameter transfer methods have frequent stack entry and stack exit operations in embedded systems, resulting in large time overhead, limited register resources, memory fragmentation and insufficient data integrity guarantee, which is difficult to meet the efficiency and security requirements of real-time systems.
Construct a three-layer function proprietary structure type with verification parameters, optimize memory layout and adopt an XOR verification mechanism, and realize synchronous management of data and code life cycle through compiler instructions and link scripts, eliminate memory holes, and ensure the security and efficiency of parameter transfer.
Reduces the number of stack entry and output times, improves memory utilization, avoids memory fragmentation, improves system stability and reliability, and ensures the security and data integrity of parameter transfer.
Smart Images

Figure CN120523446A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of embedded system software design, and in particular to a function parameter security transfer method based on static binding of a hierarchical structure and RAM. Background Art
[0002] With the continuous development of digital signal processing technology, digital signal processors (DSP) are more and more widely used in embedded systems. TM The series, with its high-performance real-time processing capabilities and rich peripheral resources, occupies an important position in the fields of motor control, digital power supply, new energy, etc. In embedded systems, function parameter passing is a key technology to achieve modular programming and function reuse. However, the traditional parameter passing method has many shortcomings. For example, frequent stack push and pop operations will introduce additional time overhead, which will seriously reduce the efficiency of task switching in real-time systems with frequent interrupt responses; limited register resources cannot cope with the multi-parameter passing requirements of complex functions, resulting in a decrease in the utilization of effective instruction cycles; dynamic memory allocation mechanisms are prone to memory fragmentation problems in long-term embedded systems, which is manifested as the continuous accumulation of unavailability of continuous physical memory blocks, causing the system's effective memory capacity to show a nonlinear decay trend over time. Existing solutions mostly use static memory pre-allocation strategies, but this method sacrifices memory usage flexibility and is difficult to adapt to application scenarios of dynamic task creation. In terms of data integrity assurance during parameter passing, traditional methods lack hardware-level verification mechanisms, and rely on algorithms such as cyclic redundancy check implemented by software, which consumes additional computing resources. In real-time data interaction scenarios, this will lead to increased communication delays. This pure software verification method also has security risks that can be bypassed by malicious code and cannot meet the mandatory certification requirements for functional safety in the industrial control field.
[0003] To solve the above problems, the present invention proposes a method for secure function parameter transfer based on static binding of hierarchical structures and RAM. By constructing a three-layer function-specific structure type with verification parameters, the memory layout is optimized, memory holes are eliminated, and an XOR verification mechanism is adopted to ensure the security and efficiency of parameter transfer. At the same time, the synchronous management of data and code life cycles is achieved through compiler instructions and linker scripts, avoiding the fragmentation problem caused by dynamic memory allocation, and further improving the stability and reliability of the system. Summary of the Invention
[0004] The technical problem to be solved by the present invention is: by constructing a three-layer function-specific structure type with verification parameters, optimizing memory layout, eliminating memory holes, and adopting an XOR verification mechanism to ensure the security and efficiency of parameter passing. At the same time, through compiler instructions and linker scripts, synchronous management of data and code life cycles is achieved, avoiding fragmentation problems caused by dynamic memory allocation, and further improving the stability and reliability of the system.
[0005] The technical solution adopted by the present invention to solve the technical problem is: a method for securely transferring function parameters based on static binding of a hierarchical structure and RAM, comprising the following steps:
[0006] S1: Constructing a hierarchical function-specific structure type with check parameters based on the DSP platform. The structure type includes control parameters, monitoring parameters, and check parameters divided by function parameters. The control parameters are direct input variables, the monitoring parameters are running status variables, and the check parameters are data integrity verification fields. The member variables within the structure type only use native basic data types or fixed-length arrays, and the memory alignment of the structure type is optimized through compiler instructions.
[0007] S2: defining a structure data variable required for function execution using the structure type, using a pointer to the structure type as a function parameter to replace the traditional multi-parameter passing method, and simultaneously obtaining the data segment and code segment required for function execution;
[0008] S3: The names and memory areas of the data segment and code segment required for function execution are explicitly specified through compiler instructions, the base address and length of the fast RAM area are defined in the linker script, the data segment and the code segment are statically allocated to the same RAM area, and the data segment and the code segment are forcibly associated in the same RAM area to ensure that the data segment and the code segment have the same life cycle;
[0009] S4: Calculate the XOR check value of the control parameter data in the structure type before and after the function call, so as to determine the security and integrity of parameter transfer. If the check values are inconsistent, error handling and data recovery are triggered.
[0010] As a preferred technical solution of the present invention, the method of constructing a hierarchical function proprietary structure type with verification parameters based on the DSP platform in S1 specifically includes:
[0011] Based on the C2000 series DSP platform and the SVPWMS algorithm module, an in-depth analysis of function parameter variables is performed on the function function and behavioral logic. Function parameters are subdivided into direct input variables that affect function execution and intermediate variables and state variables required by the function during operation. A hierarchical function-specific structure type with verification parameters is constructed.
[0012] As an optimal technical solution of the present invention, the control parameters are direct input variables, including input variables that affect the function operation logic and results, and the data type is integer type, floating point type or fixed-length array. The monitoring parameters are operation status variables, including state variables generated during the operation process, which are used to monitor the operation status and process of the function, and the data type is integer type, floating point type or fixed-length array. The verification parameter is a data integrity verification field, including a dynamic verification code generated by an exclusive OR operation, which is used for data verification and integrity check, and the data type is an unsigned integer.
[0013] As a preferred technical solution of the present invention, the member variables inside the structure type in S1 only use native basic data types or fixed-length arrays and further include:
[0014] Pointer types or nested structures are prohibited within the structure type.
[0015] As a preferred technical solution of the present invention, the optimization of the memory alignment of the structure type by compiler instructions in S1 specifically includes:
[0016] The memory alignment of the structure type is optimized through compiler instructions, the memory alignment of the structure type is set to be memory compact, explicit padding fields are inserted inside the structure type to optimize the memory layout, and the structure type is compatible with a non-aligned access protection mechanism.
[0017] As a preferred technical solution of the present invention, the static allocation of the data segment and the code segment to the same RAM area in S3 specifically includes:
[0018] The memory area base address and the length of the memory area of the RAM area are defined in the link script, and the fast RAM area is defined.
[0019] As an optimal technical solution of the present invention, the data segment and the code segment are bound to the RAM area, and by forcibly associating the data segment and the code segment in the same RAM area, it is ensured that the data segment and the code segment have the same life cycle in the fast RAM area.
[0020] As a preferred technical solution of the present invention, the step of calculating the XOR check value of the control parameter data in the structure type before and after the function call in S4 specifically includes:
[0021] The XOR check value of the control parameter data in the structure type is calculated before and after the function call, the XOR check value of the control parameter in the structure type is calculated before the function call, the control parameter is XORed byte by byte to generate a check code, and the check code is stored in the check parameter verification field. After the function call, the XOR check value of the control parameter is calculated again and compared with the XOR check value before the function call to obtain a comparison result.
[0022] As an optimal technical solution of the present invention, if the comparison result shows that the check values are inconsistent, it is determined that the data has been tampered with or an error has occurred during the parameter transmission process, triggering corresponding error processing and data recovery. If the comparison result shows that the check values are consistent, it is determined that the data has not been tampered with or an error has occurred during the parameter transmission process, and the function logic processing data continues to be executed.
[0023] As a preferred technical solution of the present invention, the explicit fill field inserted inside the structure type is a placeholder with no actual function.
[0024] The beneficial effects of the present invention are embodied in:
[0025] 1. The present invention constructs a hierarchical function-specific structure type with verification parameters, subdivides the parameters in the function into control parameters, monitoring parameters and verification parameters, optimizes the organization and transmission method of function parameters, reduces the number of stacking and popping, reduces time overhead, and improves the real-time performance and efficiency of the system.
[0026] 2. The use of explicit padding fields and non-aligned access protection mechanism eliminates memory holes, improves memory utilization, and reduces memory fragmentation.
[0027] 3. Through compiler instructions and linker scripts, the data segment and code segment are statically allocated to the same fast RAM area and associated with their lifecycles, avoiding memory fragmentation caused by dynamic memory allocation, ensuring the validity and consistency of data during function execution, and improving system stability and reliability. It is particularly suitable for scenarios such as interrupt service function parameter passing.
[0028] 4. The control parameters in the function-specific structure type are verified through the XOR verification mechanism, which can promptly detect data tampering or errors and take error handling measures to ensure the security of parameter transmission and data integrity. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A flow chart of a method for securely transferring function parameters of a C2000 series DSP based on hierarchical structure encapsulation and fast RAM static binding according to an embodiment of the present invention;
[0030] Figure 2A flow chart of a type of proprietary structure for constructing a hierarchical function with check parameters according to an embodiment of the present invention;
[0031] Figure 3 A schematic diagram of the composition of a function-specific structure type is provided according to an embodiment of the present invention;
[0032] Figure 4 A schematic diagram of a display memory layout according to an embodiment of the present invention;
[0033] Figure 5 A schematic diagram of implementing synchronous management of data and code lifecycles according to an embodiment of the present invention;
[0034] Figure 6 The following is a logic flow chart of an XOR check mechanism provided according to an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The present invention will now be described in further detail with reference to the accompanying drawings.
[0036] A method for securely passing function parameters based on static binding of a hierarchical structure to RAM includes the following steps:
[0037] S1: Constructing a hierarchical function-specific structure type with verification parameters: Based on the DSP platform, a hierarchical function-specific structure type with verification parameters is constructed. The structure type includes control parameters, monitoring parameters, and verification parameters divided by function parameters. The control parameters are direct input variables, the monitoring parameters are operating status variables, and the verification parameters are data integrity verification fields.
[0038] Specifically:
[0039] Based on the C2000 series DSP platform and the SVPWMS algorithm module, the function parameter variables are deeply analyzed for their functionality and behavioral logic. Function parameters are subdivided into direct input variables that affect function execution, as well as intermediate variables and state variables required by the function during operation. A hierarchical function-specific structure type with verification parameters is constructed.
[0040] The control parameters are direct input variables, including input variables that affect the function's running logic and results, and the data type is an integer type, a floating-point type, or a fixed-length array. The monitoring parameters are running state variables, including state variables generated during the running process, which are used to monitor the running state and process of the function, and the data type is an integer type, a floating-point type, or a fixed-length array. The check parameter is a data integrity check field, including a dynamic check code generated by an XOR operation, which is used to perform data verification and integrity checking, and the data type is an unsigned integer.
[0041] The member variables within the structure type only use primitive basic data types or fixed-length arrays, and pointer types or nested structures are prohibited within the structure type;
[0042] Specifically:
[0043] The member variables within the structure type only use the following data types:
[0044] Integer types (such as int, short, long, long long and their unsigned forms);
[0045] Floating-point types (such as float, double, long double);
[0046] Fixed-length arrays (e.g., int
[10] , float[5]);
[0047] Furthermore, the following data types are prohibited from being used within the structure type:
[0048] Pointer type;
[0049] Nested structures (i.e., a structure cannot contain other structure types);
[0050] Optimizing the memory alignment of the structure type through compiler instructions;
[0051] Specifically:
[0052] Optimizing the memory alignment of the structure type through compiler instructions, performing memory compaction setting on the memory alignment of the structure type, inserting explicit padding fields inside the structure type to optimize memory layout, and being compatible with a non-aligned access protection mechanism, wherein the non-aligned access protection mechanism is compatible based on full consideration of differences between different hardware platforms and compiler settings, the explicit padding fields inserted inside the structure type are placeholders with no actual function, the placeholder data type is a uint8_t array, the length of which is dynamically determined according to memory alignment requirements, and is used to eliminate memory holes and optimize memory utilization;
[0053] S2: Function parameter transfer optimization: The structure data variable required for function execution is defined by the structure type, and the pointer of the structure type is used as the function parameter, replacing the traditional multi-parameter transfer method, and simultaneously obtaining the data segment and code segment required for function execution. Specifically, it replaces the traditional multi-parameter transfer method used when calling a function;
[0054] S3: Synchronous management of data and code lifecycles is achieved through forced binding using compiler directives and linker scripts: The names and memory areas of the data segment and code segment required for function execution are explicitly specified through compiler directives, the base address and length of the fast RAM area are defined in the linker script, the data segment and the code segment are statically allocated to the same RAM area, and the data segment and the code segment are guaranteed to have the same lifecycle by forcibly associating them in the same RAM area. Synchronous management of the data segment and the code segment lifecycles is achieved through forced binding using compiler directives and linker scripts, thus avoiding the fragmentation problem caused by dynamic memory allocation;
[0055] Specifically:
[0056] Defining a memory area base address and a length of the RAM area in the link script, and defining a fast RAM area;
[0057] Binding the data segment and the code segment to the RAM area, and ensuring that the data segment and the code segment have the same life cycle in the fast RAM area by forcing the data segment and the code segment to be in the same RAM area;
[0058] S4: Improve the security of function parameter passing through the XOR check mechanism: Calculate the XOR check value of the control parameter data in the structure type before and after the function call, so as to determine the security and integrity of parameter passing;
[0059] Specifically:
[0060] Calculating the XOR check value of the control parameter data in the structure type before and after the function call, respectively; calculating the XOR check value of the control parameter in the structure type before the function call, performing a byte-by-byte XOR operation on the control parameter to generate a check code, and storing the check code in the check parameter verification field; and after the function call, calculating the XOR check value of the control parameter again and comparing it with the XOR check value before the function call to obtain a comparison result;
[0061] If the checksum values are inconsistent, error handling and data recovery are triggered;
[0062] Specifically:
[0063] If the comparison result shows that the checksum values are inconsistent, it is determined that the data has been tampered with or an error has occurred during the parameter transmission process, triggering corresponding error processing and data recovery. The error processing measures include: recording the error log to the non-volatile memory system and triggering an alarm, terminating the current operation process to prevent the error from spreading; isolating the abnormal parameters to prevent contamination of other modules, and safely shutting down related functions according to preset policies to ensure that the system maintains the stability of core services and data integrity within a controllable range;
[0064] If the comparison result shows that the check values are consistent, it is determined that the data has not been tampered with or an error has occurred during the parameter transfer process, and the function logic continues to be executed to process the data.
[0065] Combined with attachment Figure 1-6 As shown, taking the TI C2000 series DSP28335 platform as an example, combined with the SVPWM algorithm module, the specific implementation method is as follows:
[0066] S1: Construct a hierarchical function-specific structure type with verification parameters;
[0067] Construct the proprietary structure type SVPWM_PARA of the SVPWM algorithm function, analyze the function's functionality and behavioral logic, and obtain the function parameter variables required for function execution, including real-time status parameters such as the α-axis voltage component (Ualfa), the β-axis voltage component (Ubeta), the DC bus voltage (Udc), the three-phase voltage vector (Va, Vb, Vc), the sector number (sector), and the conduction time (Ta, Tb, Tc). Among them, the variables Ualfa, Ubeta, and Udc are direct input variables that affect the function's operation;
[0068] The above function parameter variables are divided into functional layers, as follows Figure 2 As shown, it includes control parameters, monitoring parameters and verification parameters, thereby realizing the classification and encapsulation of parameters, which is convenient for management and transmission;
[0069] The specific layering and parameter type definitions are as follows:
[0070] Control parameters:
[0071] Ualfa: control variable, representing the α component of the voltage space vector, data type is float;
[0072] Ubeta: control variable, representing the β component of the voltage space vector, data type is float;
[0073] Udc: control variable, indicating DC bus voltage, data type is float;
[0074] Monitoring parameters:
[0075] Va, Vb, Vc: monitoring voltage values, used to monitor three-phase voltage, data type is float;
[0076] t1, t2: time parameters, used to calculate PWM duty cycle, data type is float;
[0077] Ta, Tb, Tc: time parameters, used to calculate the duty cycle of each phase, data type is float;
[0078] Tcm1, Tcm2, Tcm3: intermediate time parameters, used for calculating the final duty cycle, data type is float;
[0079] Sector: sector parameter, indicating the current voltage space vector sector, data type is uint8_t;
[0080] cTime1, cTime2: time adjustment parameters, used for time allocation in overmodulation, data type is float;
[0081] Verification parameters:
[0082] XorCheck: bitwise XOR check code, dynamically calculated and generated by control layer parameters, data type is uint16_t;
[0083] Memory holes are eliminated through explicit padding and unaligned access protection. Specifically, the memory alignment of the structure type is set through the compiler directive "#pragma pack". The first compiler directive is "#pragmapack(push,4)" placed before the structure type definition to set 4-byte alignment;
[0084] Subsequently, after the structure type is defined, the second compiler instruction "#pragmapack(pop)" is used to restore the default alignment, insert explicit padding fields inside the structure type, and optimize the memory layout. According to the member variables and data types inside the structure type in S1, the memory layout order of each member variable can be determined, showing the memory alignment as follows: Figure 3 As shown;
[0085] Specifically, explicit padding fields are inserted inside the structure type to optimize the memory layout. The first 14 float member variables in the structure (Ualfa to Tcm3) each occupy 4 bytes, with a total size of 56 bytes. The data type of sector is uint8_t, which occupies 1 byte, with a starting address of 56 and an ending address of 56. cTime1 needs to start from a 4-byte aligned address, so the starting address of cTime1 should be 57, but cTime1, as a float type, needs 4-byte alignment and should start from 60. It is necessary to add 3 bytes of padding "uint8_tpaddingSector[3]" between sector and cTime1; cTime1 and cTime2 each occupy 4 bytes, with end addresses of 63 and 67 respectively. XorSum is uint16_t, which needs 2-byte alignment and a starting address of 68. It is necessary to add 2 bytes of padding at the end to ensure that the total size is a multiple of 4 (72 bytes).
[0086] S2: function parameter passing optimization;
[0087] Define the structure data variable "svpwmPara" required for function execution through the function-specific structure type "SVPWM_PARA" in S1;
[0088] Furthermore, the SVPWM algorithm function "SVPWM_Calculate(SVPWM_PARA*Data)" is constructed, where "SVPWM_PARA*Data" is used as the function parameter. When the function is called, the algorithm calculation can be performed by passing the address of "svpwmPara" into the SVPWM_Calculate function. This replaces the traditional method of passing multiple parameters when calling functions, improves the readability and maintainability of the code, and also reduces the time and space overhead in the parameter passing process.
[0089] S3: Synchronize the lifecycle management of data and code segments through compiler directives and linker scripts.
[0090] According to S2, the data segment required for function execution is "SVPWM_Params" and the code segment required for function execution is "SVPWM_Calculate(SVPWM_Params*Data)";
[0091] Furthermore, compiler directives are used to explicitly specify the names and memory areas of the data segments and code segments required for function execution, and the data segments and code segments are statically allocated to the same fast RAM area. For the SVPWM algorithm function, the data segment "SVPWM_Params" and the code segment "SVPWM_Calculate(SVPWM_Params*Data)" are bound to the same fast RAM area through compiler directives. The binding directive for the data segment is "#pragma DATA_SECTION(data,"SVPWM_Data")", and the binding directive for the code segment is "#pragma CODE_SECTION(code,"SVPWM_Code")".
[0092] Furthermore, the memory area base address and length of the RAM area are defined in the linker script, and the fast RAM area is defined. The linker script is a .cmd file. SVPWM_Data and SVPWM_Code are bound to the RAM area, and their life cycles are forcibly associated to ensure that the data segment and the code segment have the same life cycle in the fast RAM. This avoids the problem of life cycle asynchrony caused by the data segment and the code segment being in different memory areas, and ensures the validity and consistency of the data during function execution.
[0093] S4: Improve the security of function parameter passing through XOR verification mechanism;
[0094] Specifically:
[0095] First, prepare for the function call. Before calling the function, initialize the member variables inside the function parameter SVPWM_Params structure.
[0096] At the same time, before the function is called, the XOR check value of the control parameters in the structure is calculated, and the values of Ualfa, Ubeta, and Udc are XORed bit by bit to generate a check code and store it in the XorCheck field in the structure;
[0097] After the function is called, the XOR check value of the control parameter is calculated again;
[0098] Compare the XOR checksums before and after the function call to see if they are consistent. If they are inconsistent, it is determined that the data may have been tampered with or an error occurred during the parameter passing process. The function will return an error code and perform data recovery operations.
[0099] If the checksums are consistent, the function logic continues to execute and process the data. Then, all operations of the function are completed and the function execution ends.
[0100] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions in the specification are only preferred examples of the present invention and are not intended to limit the present invention. Various changes and improvements may be made to the present invention without departing from the spirit and scope of the present invention. Such changes and improvements fall within the scope of the present invention as claimed. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for securely transferring function parameters based on static binding of a hierarchical structure to RAM, characterized by: The steps include: S1: Constructing a hierarchical function-specific structure type with check parameters based on the DSP platform. The structure type includes control parameters, monitoring parameters, and check parameters divided by function parameters. The control parameters are direct input variables, the monitoring parameters are running status variables, and the check parameters are data integrity verification fields. The member variables within the structure type only use native basic data types or fixed-length arrays, and the memory alignment of the structure type is optimized through compiler instructions. S2: defining a structure data variable required for function execution using the structure type, using a pointer to the structure type as a function parameter to replace the traditional multi-parameter passing method, and simultaneously obtaining the data segment and code segment required for function execution; S3: The names and memory areas of the data segment and code segment required for function execution are explicitly specified through compiler instructions, the base address and length of the fast RAM area are defined in the linker script, the data segment and the code segment are statically allocated to the same RAM area, and the data segment and the code segment are forcibly associated in the same RAM area to ensure that the data segment and the code segment have the same life cycle; S4: Calculate the XOR check value of the control parameter data in the structure type before and after the function call, so as to determine the security and integrity of parameter transfer. If the check values are inconsistent, error handling and data recovery are triggered.
2. The method for securely transferring function parameters based on static binding of a hierarchical structure to RAM according to claim 1, characterized in that: The hierarchical function proprietary structure type with verification parameters constructed based on the DSP platform in S1 specifically includes: Based on the C2000 series DSP platform and the SVPWMS algorithm module, an in-depth analysis of function parameter variables is performed on the function function and behavioral logic. Function parameters are subdivided into direct input variables that affect function execution and intermediate variables and state variables required by the function during operation. A hierarchical function-specific structure type with verification parameters is constructed.
3. The method for securely transferring function parameters based on static binding of a hierarchical structure to RAM according to claim 2, characterized in that: The control parameters are direct input variables, including input variables that affect the function's running logic and results, and the data type is integer type, floating-point type or fixed-length array. The monitoring parameters are running status variables, including status variables generated during the running process, which are used to monitor the running status and process of the function, and the data type is integer type, floating-point type or fixed-length array. The verification parameter is a data integrity verification field, including a dynamic verification code generated by an exclusive-OR operation, which is used for data verification and integrity checking, and the data type is an unsigned integer.
4. The method for securely transferring function parameters based on static binding of a hierarchical structure to RAM according to claim 1, characterized in that: The member variables within the structure type in S1 only use primitive basic data types or fixed-length arrays and further include: Pointer types or nested structures are prohibited within the structure type.
5. The method for securely transferring function parameters based on static binding of a hierarchical structure to RAM according to claim 1, characterized in that: Optimizing the memory alignment of the structure type by compiler instructions in S1 specifically includes: The memory alignment of the structure type is optimized through compiler instructions, the memory alignment of the structure type is set to be memory compact, explicit padding fields are inserted inside the structure type to optimize the memory layout, and the structure type is compatible with a non-aligned access protection mechanism.
6. The method for securely transferring function parameters based on static binding of a hierarchical structure to RAM according to claim 1, characterized in that: The static allocation of the data segment and the code segment to the same RAM area in S3 specifically includes: The memory area base address and the length of the memory area of the RAM area are defined in the link script, and the fast RAM area is defined.
7. The method for securely transferring function parameters based on static binding of a hierarchical structure to RAM according to claim 6, characterized in that: The data segment and the code segment are bound to the RAM area, and by forcibly associating the data segment and the code segment in the same RAM area, it is ensured that the data segment and the code segment have the same life cycle in the fast RAM area.
8. The method for securely transferring function parameters based on static binding of a hierarchical structure to RAM according to claim 1, characterized in that: The step of calculating the XOR check value of the control parameter data in the structure type before and after the function call in S4 specifically includes: The XOR check value of the control parameter data in the structure type is calculated before and after the function call, the XOR check value of the control parameter in the structure type is calculated before the function call, the control parameter is XORed byte by byte to generate a check code, and the check code is stored in the check parameter verification field. After the function call, the XOR check value of the control parameter is calculated again and compared with the XOR check value before the function call to obtain a comparison result.
9. The method for securely transferring function parameters based on static binding of a hierarchical structure to RAM according to claim 8, characterized in that: If the comparison result shows that the check values are inconsistent, it is determined that the data has been tampered with or an error has occurred during the parameter transmission process, triggering corresponding error processing and data recovery. If the comparison result shows that the check values are consistent, it is determined that the data has not been tampered with or an error has occurred during the parameter transmission process, and the function logic continues to process the data.
10. The method for securely transferring function parameters based on static binding of a hierarchical structure to RAM according to claim 5, characterized in that: The explicitly filled fields inserted inside the structure type are placeholders with no actual function.
