A car gauge application layer visual code generation tool chain system

By identifying the affected execution segments and their associated range through a local write-back mechanism, the problems of high engineering modification costs and long iteration cycles in existing toolchain systems are solved, development efficiency and resource constraint consistency are improved, and the traceability of build results is enhanced.

CN123137641APending Publication Date: 2026-11-20SONKWO COM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611627448.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-21
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Existing toolchain systems cannot perform local location and incremental write-back based on compilation errors, actual execution time, actual stack usage, object binding relationships, and interface binding results in the compilation feedback processing, resulting in high engineering modification costs, long iteration cycles, and difficulties in problem localization.

Method used

The system employs an engineering parsing module, an execution fragment generation module, a scheduling and arrangement module, a code generation and compilation module, and a local write-back module. By identifying the affected execution fragments and their associated ranges, it re-executes the scheduling and arrangement and code generation only on the relevant parts, thus forming a local write-back mechanism.

Benefits of technology

It improves development efficiency, maintains consistency of resource constraints, enhances the traceability of build results, solves the problem of repeated builds of the overall project, and reduces modification costs and iteration cycles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123137641A_ABST
    Figure CN123137641A_ABST
Patent Text Reader

Abstract

The application discloses a kind of car regulation application layer visual code generation tool chain system, it is related to tool chain scheduling compilation technical field, including according to the engineering description file corresponding to current engineering version and the node type definition table consistent with tool chain version identification, form design record set and the corresponding relationship of node and trigger record;According to the corresponding relationship of design record set and the node and trigger record, trigger domain is divided, according to node behavior mark and connection attribute identification execution boundary, remove cross-cycle transfer connection line, feedback connection line and state write back connection line, form execution fragment, execution fragment front and rear relationship, data item start-stop position, data item attribute record, interface access record and execution duration record.The application improves development efficiency, maintains resource constraint consistency and enhances the effect of construction result traceability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of toolchain scheduling and compilation technology, and in particular to a visual code generation toolchain system for automotive-grade application layers. Background Technology

[0002] As the vehicle's electronic and electrical architecture continues to evolve towards domain centralization and software definition, the development method of automotive-grade application layer software has gradually shifted from traditional manual coding to model-based design, component-based development, and automated code generation. In existing technologies, developers typically first use graphical modeling tools to complete the description of control logic, state logic, and interface logic, and then use code generation tools to convert the model into business code, task configuration, and interface configuration in order to shorten the development cycle and improve software reusability.

[0003] Existing toolchain systems still have shortcomings. Many toolchains still use the method of regenerating and recompiling the entire project for compilation feedback processing. They cannot perform local location and incremental write-back based on compilation errors, actual execution time, actual stack usage, object binding relationships, and interface binding results. This results in high project modification costs, long iteration cycles, and long problem location chains, making it difficult to balance development efficiency, resource constraint consistency, and result traceability. Summary of the Invention

[0004] This invention provides a visual code generation toolchain system for automotive-grade application layers, comprising:

[0005] The engineering parsing module is used to form a design record set and a correspondence between nodes and trigger records based on the engineering description file corresponding to the current engineering version and the node type definition table that is consistent with the toolchain version identifier.

[0006] The execution fragment generation module is used to divide the trigger domain according to the design record set and the correspondence between nodes and trigger records, identify the execution boundary according to the node behavior mark and connection attribute, remove cross-cycle transmission connection, feedback connection and status write-back connection, and form execution fragment, execution fragment before and after relationship, data item start and end position, data item attribute record, interface access record and execution duration record;

[0007] The scheduling module is used to map execution segments to corresponding tasks, perform forward and backward searches on candidate release times, form the effective range of data items based on the start and end positions and attribute records of data items, and determine the final release time, local storage location and execution time limit by combining the execution duration record.

[0008] The code generation and compilation module is used to generate source code artifacts based on execution fragments, final release times, and local storage locations, and then compile them to obtain compilation results.

[0009] The local write-back module is used to determine the affected execution segments based on the compilation results, execution time limits, and local storage locations. It then re-executes the final release time determination, local storage location arrangement, source code artifact generation, and compilation only for the affected execution segments and the associated execution segments determined along the data dependency direction, to obtain the build result.

[0010] Preferably, the engineering analysis module includes:

[0011] Read the node record area, connection record area, trigger record area, parameter record area, interface binding record area, and version information area from the project description file;

[0012] Based on the record content in each record area, a node record set, a connection record set, a trigger record set, a parameter record set, and an interface binding record set are formed.

[0013] The correspondence between nodes and trigger records is formed based on the bound node numbers in the trigger record set;

[0014] Based on the node type definition table, the input port definition, output port definition, node behavior marker, parameter constraint field and interface access record corresponding to the node category are completed, and the completion results are associated with the node record set, connection record set, parameter record set and interface binding record set to form a design record set.

[0015] Preferably, the execution fragment generation module includes:

[0016] Based on the trigger source and execution cycle in the trigger record set, and combined with the correspondence between nodes and trigger records, the node record set is grouped to form trigger domains;

[0017] Within the trigger domain, the execution boundaries are determined based on the node behavior markers and connection attributes, including the positions of state-preserving nodes, delayed nodes, cross-cycle transmission connections, feedback loop connections, and state write-back positions.

[0018] After removing cross-cycle transit connections, feedback connections, and state write-back connections, perform topological sorting on the remaining cycle relationships;

[0019] Based on a continuous subgraph of nodes that do not cross execution boundaries, an execution segment and the relationship between the preceding and following execution segments are formed.

[0020] Preferably, the execution fragment generation module includes:

[0021] The input data items, output data items, status data items, and intermediate data items are formed based on the connection relationship between the two sides of the execution segment boundary;

[0022] Among them, the input data item is the data that enters the execution segment from outside the execution segment, the output data item is the data that is output from the execution segment to outside the execution segment, the status data item is the data formed by the status holding node, the cross-cycle transmission connection and the feedback write-back path, and the intermediate data item is the data generated within the same execution segment, which is available for other nodes within the same execution segment and is not used as the output data item or the status data item.

[0023] Record the position where each data item enters the execution segment or is generated within the execution segment, as well as the position where it was last read, written back, or output, to form the start and end positions of the data item;

[0024] An interface access record is formed based on the interface binding record set and the nodes contained in the execution fragment;

[0025] Data item attribute records are formed based on the port data type, bit width, and number of elements corresponding to the data item, and execution duration records are formed based on the execution order of the nodes.

[0026] Preferably, the scheduling module includes:

[0027] Read the task definition information provided by the target base, which includes task cycle, scheduling time base, task local storage limit and stack limit information, and map the execution fragment to a unique task;

[0028] For execution segments mapped to the same task, the initial release time is determined based on the relationship between the execution segments and the execution duration.

[0029] Within the task cycle, forward and backward searches are performed on candidate release times, with the scheduling time base as the step size.

[0030] Based on the start and end positions and attribute records of each data item, a valid range of data items is formed at the corresponding candidate release time.

[0031] Based on the valid range of the data item, the local storage occupation, task local storage occupation, and interface concurrent access are checked separately, and the candidate release time that simultaneously meets the local storage occupation constraint, task local storage occupation constraint, and interface concurrent access constraint is determined as the reserved candidate release time. The final release time is determined based on the reserved candidate release time.

[0032] Based on the valid range of data items and the attribute records of data items, the execution positions of each data item are arranged in the corresponding local storage area to determine the local storage location;

[0033] The execution time limit is determined by the order in which the execution segments within the same task are finally released.

[0034] Preferably, the code generation and compilation module includes:

[0035] Based on the execution fragment, final release time, local storage location, and execution time limit, and according to the code generation rule table corresponding to the node type definition table, business source files, task configuration files, interface configuration files, and link layout files are generated.

[0036] Compilation is performed by calling the cross-compilation toolchain corresponding to the target platform based on the build configuration file.

[0037] Establish a mapping relationship between the execution fragment and the source file functions and source file symbols;

[0038] Based on the compiled mapping file and symbol table, actual segment layout records, actual segment occupancy records, object location records, and object binding relationship records are generated. Based on the symbol table and interface configuration file, interface binding results are generated. Based on the disassembly results and target processor instruction cycle information, actual execution time is generated. Based on the stack analysis results, actual stack occupancy is generated. Based on the compilation log, compilation error information is generated.

[0039] Preferably, the local write-back module includes:

[0040] The compilation results are compared with the execution time limit corresponding to the execution segment, the storage area ownership or location constraints corresponding to the local storage location, the stack quota information, and the interface definition.

[0041] Execution segments that meet any of the filtering criteria are identified as affected execution segments:

[0042] The filtering conditions include the existence of compilation error information corresponding to the execution fragment, the execution cycle exceeding the corresponding execution time limit, the object binding relationship record not matching the storage area ownership or location constraints, the actual stack occupancy exceeding the corresponding stack limit information, or the interface binding result not matching the interface definition.

[0043] Starting with the affected execution segment, the associated execution segments are recursively expanded along the data dependency direction between execution segments until no new execution segments appear. Execution segments that are in the same task as the affected and associated execution segments and have scheduling overlap are merged into the associated execution segments.

[0044] Preferably, the local write-back module includes:

[0045] The final release time determination, local storage location arrangement, source code artifact generation and compilation are re-executed only for the affected execution segment and related execution segments, and the local write-back is repeatedly executed until the construction result is obtained;

[0046] The construction result is the result after satisfying the following conditions:

[0047] There are no error messages in the compilation log. The actual execution time of each execution segment does not exceed the corresponding execution time limit. The actual stack occupancy of each task does not exceed the corresponding stack limit information. The object binding relationship records satisfy the storage area ownership or location constraints. The interface binding results conform to the interface definition. And when there is a previous round result, the final release time and local storage location of the current round are consistent with those of the previous round.

[0048] The beneficial effects of this invention are as follows:

[0049] This invention constructs a local write-back mechanism oriented towards compilation results. It can identify the affected execution segments and their associated ranges based on compilation errors, actual execution time, actual stack usage, object binding relationships, and interface binding results. It then re-executes scheduling, code generation, and compilation only on the relevant parts. This solves the problems of high modification costs, long iteration cycles, and difficulty in problem localization caused by repeated construction of the entire toolchain project. It improves development efficiency, maintains consistency of resource constraints, and enhances the traceability of construction results. Attached Figure Description

[0050] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the 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.

[0051] Figure 1 This is a flowchart of the automotive-grade application layer visual code generation toolchain system in Example 1;

[0052] Figure 2 This is a schematic diagram illustrating the determination of the construction result in an example. Detailed Implementation

[0053] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0054] In this embodiment, all expressions involving constraints represent conditions that allow for direct comparison and judgment; all expressions involving two or more represent at least two; and all expressions involving selection employ pre-defined deterministic rules.

[0055] The basic data used in this implementation includes a node type definition table, an operator execution timetable, a task definition table, a local storage area capacity table, a stack quota table, an interface access constraint table, a processor instruction cycle table, and a code generation rule table.

[0056] The node type definition table is generated from the node metadata file in the node development package. During generation, the node category identifier, input port number, output port number, port data type, port width, number of elements, node behavior flag and parameter constraint fields corresponding to each node category are read one by one, and saved with the toolchain version identifier as the version key.

[0057] The operator execution schedule is generated by the calibration program. During generation, the target processor model, processor frequency, compiler version, compilation optimization level, target platform version, build configuration, interrupt masking status, and linking method are fixed first. Then, a test program containing only the processing logic of that node is generated for each node category. The test program is executed continuously while the above conditions remain unchanged, and the execution time is recorded once per round. When the maximum execution time recorded in two consecutive rounds is the same, execution stops. The maximum execution time obtained at the time of stopping is taken as the expected execution time of that node category and written into the operator execution schedule. The operator execution schedule includes the node category, target processor model, compilation optimization level, target platform version, and expected execution time.

[0058] The task definition table, local storage area capacity table, stack quota table, and interface access constraint table are exported from the target base configuration file. During export, the task configuration, storage area configuration, task stack configuration, and interface driver configuration are read and written according to the table entries.

[0059] The task definition table includes the task number, trigger source, task cycle, initial phase of the task, local running storage area number, and status storage area number.

[0060] The local storage area capacity table includes the storage area number, start address, and end address. If the capacity in bytes is given directly in the configuration file, that number of bytes is used as the upper limit of the capacity. If the capacity in bytes is not given directly, the upper limit of the storage area is the end address minus the start address plus one.

[0061] The stack quota table includes the task number and the corresponding task stack size. If the task stack size is given directly in the configuration file, this value is used as the stack quota. If the start address and end address of the task stack area are given in the configuration file, the end address minus the start address plus one is used as the stack quota.

[0062] The interface access constraint table includes the interface number, interface type, number of channels, and mutual exclusion flag. If the mutual exclusion flag is true, the maximum number of concurrent accesses allowed for the interface is 1; if the mutual exclusion flag is false, the maximum number of concurrent accesses allowed for the interface is the number of channels.

[0063] refer to Figure 1 and Figure 2The processor instruction cycle table is imported from the target processor instruction specification file. During import, entries are formed according to instruction name, addressing mode, and corresponding cycle number.

[0064] The code generation rule table is generated from the code template file in the node development package. During generation, each node category is written into the corresponding source code expansion template, parameter mapping rules, variable storage area mapping rules, interface call generation rules, and link layout generation rules one by one.

[0065] First, obtain the project description file corresponding to the current project version. The project description file includes a node record area, a connection record area, a trigger record area, a parameter record area, an interface binding record area, and a version information area. The version information area includes the project version number, the toolchain version identifier, and the save timestamp.

[0066] Read the node number and node category one by one from the node record area, and then use the toolchain version identifier in the version information area as the search key to search for the node category definition of the same version in the node type definition table. If no table entry matching the toolchain version identifier is found, mark the current project as version mismatch and terminate subsequent processing. If found, add the input port definition, output port definition, port data type, port width, number of elements, node behavior flag and parameter constraint fields corresponding to the node category to the corresponding node record.

[0067] Read the trigger record number, trigger source, execution cycle, and set of bound node numbers one by one from the trigger record area. For each trigger record, establish a correspondence between each node number in its set of bound node numbers and the trigger record number, forming a node-trigger correspondence record. If the same node number appears in the set of bound node numbers of two or more trigger records, mark the current project as having non-unique trigger binding and terminate subsequent processing.

[0068] Read the parameter number, bound node number, parameter name, parameter data type, parameter value or parameter initial value one by one from the parameter record area; when a range field exists, write the range field into the parameter record as well.

[0069] Read the binding node number, interface number, access direction, and interface type one by one from the interface binding record area.

[0070] Read the source node number, target node number, source port number, target port number, and connection attributes one by one from the connection record area, and write the cross-cycle transmission flag into the corresponding connection record.

[0071] After all records have been read, first form a set of node records, a set of connection records, a set of trigger records, a set of parameter records, and a set of interface binding records; then merge the completed node type definition fields into the set of node records; then attach the corresponding records of the node and the trigger to the corresponding node records; finally, write the above set of records into the design record set.

[0072] After completing the above processing, a design record set and corresponding records for nodes and triggers are formed. The design record set does not include execution order, execution boundaries, execution segments, absolute valid range of data items, local storage location, and execution time limit.

[0073] After the design record set and nodes are formed with the corresponding trigger records, the trigger domain, execution fragment, data item record and interface access record are generated.

[0074] Specifically, all node numbers are first grouped using the trigger source and execution cycle as grouping keys. During grouping, the trigger record number corresponding to a certain node is read, followed by the trigger source and execution cycle of that trigger record, and this tuple is written into the grouping key field of that node. After grouping all nodes, duplicates are removed according to the grouping key, resulting in several trigger fields; each different grouping key corresponds to one trigger field.

[0075] Within each trigger domain, a node relationship graph for the current period is constructed based on the source node number and target node number in the connection record.

[0076] For nodes whose behavior is marked as state-preserving or delay-type, the connection position between the node and its adjacent lines is recorded as the boundary position; for lines whose cross-cycle transmission is marked as true in the connection attribute, the line is recorded as the cross-cycle boundary line; the connection that forms a feedback relationship in the node relationship graph of the current cycle is identified and written into the feedback connection record; the connection that writes the calculation result of the current cycle into the state storage area and is read again by the state-preserving or delay-type nodes in the next cycle is identified and written into the state write-back connection record.

[0077] After boundary identification is completed, cross-cycle boundary connections, feedback connections, and state write-back connections are removed from the node relationship graph of the current cycle. The relationship graph after removal only retains the immediate execution connection of the current cycle.

[0078] Perform a topological sort on the removed relation graph. When there are two or more nodes with an in-degree of zero at the same time, sort them by node number from smallest to largest and start scanning sequentially from the first node after topological sorting. If the current node and the next node are still connected by the removed relation graph and there is no boundary line between them, then they are assigned to the same continuous node subgraph. If there is a boundary between them or no connection relationship, then end the current continuous node subgraph at the current node and start building a new continuous node subgraph from the next node. Each continuous node subgraph forms an execution segment, thereby obtaining the execution segment record set and the relationship record before and after the segment.

[0079] After the execution fragment is formed, data item records are generated:

[0080] For each execution segment, check the intersecting connections: if the source node is not in the execution segment but the target node is in the execution segment, it is recorded as an input data item; if the source node is in the execution segment but the target node is not in the execution segment, it is recorded as an output data item; if it is formed by state-preserving nodes, cross-cycle boundary connections, feedback connections, and state write-back connections, it is recorded as a state data item; if it is generated or consumed within the execution segment and does not belong to the aforementioned three categories, it is recorded as an intermediate data item.

[0081] Create start and end records for data items:

[0082] First, write sequence numbers to the nodes within the execution segment according to the topological order; then, find the expected execution time corresponding to each node category from the operator execution time table and write it into the node record; then, starting from the first node, sequentially accumulate to obtain the start time offset and end time offset of each node.

[0083] If a data item is input from outside the execution fragment, its effective start offset is taken as the node start time offset when the data item is first read by a node within the fragment;

[0084] If a data item is generated within an execution segment, its effective start offset is taken as the end time offset of the node that generated the data item;

[0085] If a data item is last read by a node within a fragment, its effective end offset is taken as the end time offset of the node that last read the data item.

[0086] If a data item is output or written back at the end of a fragment, its effective end offset is taken as the end time offset of the output node or the write-back node.

[0087] This results in the effective start time offset for each data item. and effective end time offset And write the start and end records of the data items.

[0088] In this embodiment, and These are all time offsets of the j-th data item, not node position indices.

[0089] Based on the set of interface binding records and the nodes contained in each execution segment, an interface access record is formed: Specifically, for each node in each execution segment, check whether there is a corresponding interface binding record; if there is, write the execution segment number, node number, interface number, access direction and interface type into the interface access record. Then, for all nodes in the same execution segment that access the same interface, take the start time offset of the earliest accessing node as the start offset of the interface access window, and take the end time offset of the latest accessing node as the end offset of the interface access window to form the relative access window of the execution segment to that interface.

[0090] The number of bytes for a data item is calculated based on the port width and number of elements in the node type definition table. When the product of the width and the number of elements is divisible by 8, the number of bytes is the product divided by 8; otherwise, the number of bytes is the number of bytes after padding. This forms the data item attribute record.

[0091] Based on the node type and the estimated execution time, the estimated execution time of each execution segment is accumulated node by node in topological sorting order to form an execution duration record.

[0092] After the execution fragment record set, fragment relationship record, data item start and end record, data item attribute record, interface access record, and execution duration record are formed, task mapping, candidate release time search, final release time determination, local storage area allocation, byte position arrangement, and execution time limit calculation begin.

[0093] For each execution segment, read the trigger source and execution cycle of its trigger domain; then search for task records with the same trigger source and the same task cycle in the task definition table; if only one is found, map the execution segment to the task; if two or more are found, sort by task number from smallest to largest and take the one with the smallest number, and write this selection rule into the task attribution record; if no one is found, mark the current project as a task mapping failure and terminate subsequent processing.

[0094] Within the same task, segments are sorted according to their sequential relationship. If the sequential relationship cannot be distinguished, the segments are sorted by their execution segment numbers from smallest to largest. The initial release time of the first segment after sorting is taken as the initial phase of the task. The initial release time of subsequent segments after sorting is taken as the sum of the initial release time of the previous segment and the expected execution time of the previous segment. If there are two or more segments that start concurrently, they are assigned the same initial release time according to their execution segment numbers from smallest to largest.

[0095] Subsequently, the time base is unified, and the task cycle and initial phase are converted into integer multiples of the scheduling time base Δ. The scheduling time base Δ is the largest time unit that can be divided by all task cycles and initial phases in the task definition table. If the configuration file has already given the scheduling time base, then that value is used directly.

[0096] The task cycle and initial phase are uniformly converted to integer multiples of the scheduling time base Δ. Let the total number of tasks participating in the scheduling calculation be P, and the integer multiple of the scheduling time base corresponding to the p-th task cycle be Δ. Then the superperiod H is:

[0097] ;

[0098] Where H represents the supercycle, It is the least common multiple. This represents the value of the p-th task cycle converted to an integer multiple of the scheduling time base, where p is the task number and P is the total number of tasks participating in the scheduling calculation. For scheduling time base;

[0099] For the i-th execution segment, the release time of the k-th execution within the supercycle is:

[0100] ;

[0101] in, Let i be the release time of the i-th execution segment during the k-th execution. Let i be the current candidate release time for the i-th execution segment. Let k be the task cycle of the task to which the i-th execution segment belongs, and k be the execution sequence number of the same execution segment within the supercycle.

[0102] Based on the start and end records of the data items, each data item is converted into a valid range using the following formula:

[0103] ;

[0104] in, Let j be the valid interval of data item j in the k-th execution. The effective starting offset of data item j relative to the release time of its execution segment. This is the effective end offset of data item j relative to the release time of its execution segment;

[0105] The formula for converting an execution segment into an execution interval is:

[0106] ;

[0107] in, Let i be the execution interval of the i-th execution segment in the k-th execution. Let be the estimated execution time of the i-th execution segment;

[0108] Local storage area allocation is performed based on the task ownership record and data item category: input data items, output data items, and intermediate data items are allocated to the local runtime storage area of ​​their respective tasks; status data items are allocated to the status storage area of ​​their respective tasks; if the task definition table does not distinguish between local runtime storage area and status storage area, then all data items are allocated to the local storage area uniquely associated with that task. The allocation result is written to the local storage area allocation record.

[0109] In this embodiment, the storage area ownership constraint means that a certain data item can only be written to the storage area specified in the local storage area allocation record; the position constraint means that the start byte position and end byte position of the data item in the specified storage area must be consistent with the byte position record, and the end byte position is not greater than the upper limit of the storage area capacity.

[0110] For each record in the interface access record, read the relative access window of the corresponding execution segment; then add the relative access window to the candidate release time of each execution of the execution segment within the supercycle to obtain the absolute access window of the interface in each execution, and write it into the interface access window record according to the interface number.

[0111] List all intermediate data items within the execution fragment and temporary data not mapped to state data items, and accumulate them according to the number of bytes in the data item attribute record. When the target base specifies that the object is aligned to a fixed number of bytes, pad the starting position of each object with the fixed alignment bytes, and then calculate the number of bytes occupied after padding. Write the accumulated result into the local automatic object occupancy record, denoted as […]. , indicating the number of bytes occupied by the object of the i-th execution segment;

[0112] The fixed alignment byte count is taken from the object alignment field in the target base configuration file; if not configured, it is 1 byte.

[0113] For each execution segment, starting from its initial release time, it is progressively shifted backward according to the scheduling time base Δ to form a forward candidate release time sequence. At each shift step, the absolute execution interval of each execution within the supercycle and the absolute valid interval of the data item to which the execution segment belongs are regenerated, and the following three checks are performed:

[0114] 1. Check peak usage of local storage areas;

[0115] II. Automatic peak occupancy check of local objects in the task;

[0116] 3. Check the number of concurrent accesses to the interface.

[0117] The local storage area occupancy constraint setting method is as follows: for each local storage area, at any check time within the over-cycle, the total number of bytes occupied by all valid data items must not exceed the capacity limit given by the capacity table of that local storage area.

[0118] The task local automatic object occupancy constraint setting method is as follows: for each task, at any check time within the overcycle, the total number of bytes of local automatic objects occupied by all currently executing execution segments must not exceed the stack limit given in the stack limit table.

[0119] The interface concurrent access constraint setting method is as follows: For each interface, at any check time within the supercycle, the number of execution fragments that simultaneously fall into the absolute access window of the interface shall not exceed the allowed concurrent access limit given in the interface access constraint table.

[0120] If all checks after this translation satisfy the above three constraints, then the translation step number is added to the forward feasible step set; if any constraint is not satisfied for the first time, the backward search stops, and the maximum number of steps in the forward feasible step set is recorded as . .

[0121] In the same manner, starting from the initial release time, the system is progressively shifted forward according to the scheduling time base Δ to form a sequence of backward candidate release times. The same interval reconstruction and constraint checks are performed for each shift step. The number of steps that satisfy the constraints is written into the backward feasible step set. The forward search stops when any constraint is first not satisfied, and the maximum number of steps in the backward feasible step set is recorded as... .

[0122] After the forward and backward searches are completed, a feasible step range is formed based on the initial release time. The midpoint offset of the feasible offset interval is taken as the candidate final offset; if the midpoint offset is not an integer multiple of the scheduling time base Δ, then the nearest integer multiple of the scheduling time base is taken from the earlier side; this offset is then added to the initial release time to obtain the final release time, as shown in the formula:

[0123] ;

[0124] in, Let i be the final release time of the i-th execution segment. Let i be the initial release time of the i-th execution segment. and These represent the maximum feasible forward offset steps and the maximum feasible backward offset steps. Let be the task cycle of the task to which the i-th execution segment belongs, and mod be the task cycle. Take the mold;

[0125] After the final release time of each execution segment is determined, first replace the original candidate release time field with the final release time field; then for each execution segment i, according to... Recalculate the release time for each execution within the supercycle, where, This is the final release time of the i-th execution segment in the k-th execution; then, for each data item j belonging to this execution segment, respectively... Substitution and Recalculate the effective interval This allows for the reconstruction of the valid range for all data items;

[0126] After reconstruction, byte position arrangement is performed on each local storage area. Specifically, it is first sorted by the start time of the absolutely valid interval from smallest to largest; if the start times are the same, it is sorted by the data item number from smallest to largest. For each sorted data item, starting from the start byte position of its local storage area, it is checked one by one whether the current candidate start byte position has spatial overlap with the already allocated data items that overlap in time. If an overlap occurs, the candidate start byte position is moved one byte to the right and the check continues until the first non-overlapping position is found, and this position is taken as the start byte position of the data item. This forms a byte position record.

[0127] Within the same task, execution segments are sorted in ascending order of their final release time. For each sorted execution segment, the final release time of the next execution segment is used as the completion time limit of the current execution segment. For the last sorted execution segment, the end time of the current cycle of the task to which it belongs is used as the completion time limit. The execution time limit of the execution segment is obtained by subtracting the final release time from the completion time limit. In this embodiment, the execution time limit is not a preset threshold, but a time difference calculated from the scheduling results.

[0128] After the execution fragment, interface access, data item attributes, execution duration, and scheduling and storage results are all formed, code generation and compilation result extraction begin.

[0129] First, expand the business source code one by one according to the execution fragment: For a certain execution fragment, according to the topological order of its internal nodes, search for the source code expansion template of the corresponding node category in the code generation rule table in turn; substitute the node parameters, input ports and output ports according to the template requirements to generate the source code statement of the node; then concatenate all the source code statements according to the node order to form the function body corresponding to the execution fragment.

[0130] Input data items, output data items, status data items, and intermediate data items are each generated with variable definitions according to the variable mapping rules in the code generation rule table; the type, length, and number of array elements of the variables are taken from the data item attribute records.

[0131] Based on the local storage area allocation record and byte position record, first generate a correspondence between storage area number, segment name, and starting byte position within the segment for each variable; then write the variable into the corresponding storage area declaration and link layout segment according to this correspondence.

[0132] Based on the task ownership record, final release time record, and execution time limit record, write the corresponding function of each execution segment into the entry function of the task to which it belongs, and write the task number, task cycle, initial phase, execution segment call order, and execution time limit into the task configuration file.

[0133] Based on the interface access records and interface access window records, generate interface declarations, parameter passing relationships, and interface call locations; when two or more execution fragments access the same interface, use the interface number as the aggregation key to merge and generate a unified configuration item for that interface.

[0134] At the same time, a mapping table is generated between the execution fragment and the source file functions and source file symbols.

[0135] After all source code artifacts are generated, the cross-compilation toolchain is invoked for compilation. Specifically, first, mapping file output, symbol table output, disassembly output, and stack analysis output are enabled in the build configuration file; then, the business source files, task configuration files, interface configuration files, link layout files, and build configuration files are sent together into the cross-compilation toolchain that is consistent with the target base; compilation, assembly, and linking are executed in sequence to obtain mapping files, executable files, symbol tables, disassembly results, stack analysis results, and compilation logs.

[0136] After compilation, the compilation results are extracted as follows: the actual segment occupancy record is extracted from the mapping file; the object binding relationship and interface binding result are extracted from the symbol table; the actual stack occupancy record is extracted from the stack analysis result; all instructions contained in the function corresponding to the execution segment are extracted from the disassembly result, and then the corresponding cycle number is searched one by one according to the processor instruction cycle table and accumulated to obtain the actual execution cycle of the execution segment; then the actual execution cycle is converted into the actual execution time according to the processor clock frequency.

[0137] Extract error and warning entries from the compilation log, with error entries used as compilation error information for subsequent comparisons.

[0138] In this implementation, the object of subsequent comparison with the execution time limit is uniformly the actual execution time, and the actual execution cycle is not used for direct comparison.

[0139] After the compilation results are generated, local write-back and local regeneration begin.

[0140] Specifically, the compilation error information, actual execution time, object binding relationships, actual segment occupancy records, actual stack occupancy records, and interface binding results in the compilation results are classified and compared. Among them: compilation error information is used to determine whether there is a compilation failure; the actual execution time is compared with the execution time limit of the corresponding execution segment; object binding relationships and actual segment occupancy records are compared with the storage area ownership or location constraints corresponding to the local storage location; actual stack occupancy records are compared with stack quota information; and interface binding results are compared with interface definitions. The interface definitions are taken from the interface definition items exported from the target base configuration file, including interface number, interface type, access direction, parameter data type, parameter bit width, peripheral number, and channel number.

[0141] Storage area ownership or location constraints are taken from local storage area allocation records and byte location records, stack quota information is taken from stack quota table, and execution time limits are taken from the execution time limit records formed by the aforementioned scheduling and arrangement steps.

[0142] Execution segments that meet at least one of the following conditions are identified as directly affected execution segments:

[0143] There are compilation error messages corresponding to the execution segment; the actual execution time of the execution segment exceeds its execution time limit; the object binding relationship or actual segment occupancy record does not meet the predetermined storage area ownership or location constraints; the actual stack occupancy record of the task to which the execution segment belongs exceeds the stack limit; the interface binding result involved in the execution segment is inconsistent with the interface definition.

[0144] Once the directly affected execution segments are determined, the affected scope is expanded along the data dependency direction. Specifically, the set of directly affected execution segments is used as the first round of input set. For each execution segment in this set, all its output data items are identified. Then, the execution segments that use the output data items as input data items are searched in the segment relationship record and data item record, and the found execution segments are added to the next round set. If new execution segments appear in the next round set, the next round of expansion continues. If no new execution segments appear after a certain round of expansion, the expansion stops, and execution segments that are in the same task as the affected set and have a scheduling overlap relationship in time are checked and merged into the affected set.

[0145] Perform a partial write-back on the affected set: Specifically, write the actual execution time of the affected execution segment back to the execution time record; write the object binding relationship and actual segment occupancy record corresponding to the affected data item back to the local storage area allocation record and byte position record; write the actual stack occupancy of the affected task to the actual stack occupancy record; and write the interface binding results involved in the affected execution segment back to the interface binding result record.

[0146] While keeping the final release time, local storage allocation results, and byte positions of unaffected execution segments unchanged, only the affected set is re-executed for scheduling and re-arranging, as well as the extraction of code generation and compilation results.

[0147] After each round of local write-back and regeneration, a convergence check is performed. The project is considered converged when the following conditions are met simultaneously:

[0148] The compilation error message is empty; the actual execution time of all execution segments does not exceed the corresponding execution time limit; the actual stack occupancy of all tasks does not exceed the corresponding stack limit; the actual occupancy of all local storage areas does not exceed the corresponding capacity limit; all interface binding results are consistent with the interface definition; and when there is a previous round result, the final release time record and byte position record of the current round are consistent with those of the previous round.

[0149] Once the above convergence conditions are met, the construction results are generated, including the updated source code artifact, the updated scheduling and storage result set, and the updated compilation result set.

[0150] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A visual code generation toolchain system for automotive-grade application layers, characterized in that, include: The engineering parsing module is used to form a design record set and a correspondence between nodes and trigger records based on the engineering description file corresponding to the current engineering version and the node type definition table that is consistent with the toolchain version identifier. The execution fragment generation module is used to divide the trigger domain according to the design record set and the correspondence between nodes and trigger records, identify the execution boundary according to the node behavior mark and connection attribute, remove cross-cycle transmission connection, feedback connection and status write-back connection, and form execution fragment, execution fragment before and after relationship, data item start and end position, data item attribute record, interface access record and execution duration record; The scheduling module is used to map execution segments to corresponding tasks, perform forward and backward searches on candidate release times, form the effective range of data items based on the start and end positions and attribute records of data items, and determine the final release time, local storage location and execution time limit by combining the execution duration record. The code generation and compilation module is used to generate source code artifacts based on execution fragments, final release times, and local storage locations, and then compile them to obtain compilation results. The local write-back module is used to determine the affected execution segments based on the compilation results, execution time limits, and local storage locations. It then re-executes the final release time determination, local storage location arrangement, source code artifact generation, and compilation only for the affected execution segments and the associated execution segments determined along the data dependency direction, to obtain the build result.

2. The automotive-grade application layer visual code generation toolchain system as described in claim 1, characterized in that, The engineering analysis module includes: Read the node record area, connection record area, trigger record area, parameter record area, interface binding record area, and version information area from the project description file; Based on the record content in each record area, a node record set, a connection record set, a trigger record set, a parameter record set, and an interface binding record set are formed. The correspondence between nodes and trigger records is formed based on the bound node numbers in the trigger record set; Based on the node type definition table, the input port definition, output port definition, node behavior marker, parameter constraint field and interface access record corresponding to the node category are completed, and the completion results are associated with the node record set, connection record set, parameter record set and interface binding record set to form a design record set.

3. The automotive-grade application layer visual code generation toolchain system as described in claim 2, characterized in that, The execution fragment generation module includes: Based on the trigger source and execution cycle in the trigger record set, and combined with the correspondence between nodes and trigger records, the node record set is grouped to form trigger domains; Within the trigger domain, the execution boundaries are determined based on the node behavior markers and connection attributes, including the positions of state-preserving nodes, delayed nodes, cross-cycle transmission connections, feedback loop connections, and state write-back positions. After removing cross-cycle transit connections, feedback connections, and state write-back connections, perform topological sorting on the remaining cycle relationships; Based on a continuous subgraph of nodes that do not cross execution boundaries, an execution segment and the relationship between the preceding and following execution segments are formed.

4. The automotive-grade application layer visual code generation toolchain system as described in claim 3, characterized in that, The execution fragment generation module includes: The input data items, output data items, status data items, and intermediate data items are formed based on the connection relationship between the two sides of the execution segment boundary; Among them, the input data item is the data that enters the execution segment from outside the execution segment, the output data item is the data that is output from the execution segment to outside the execution segment, the status data item is the data formed by the status holding node, the cross-cycle transmission connection and the feedback write-back path, and the intermediate data item is the data generated within the same execution segment, which is available for other nodes within the same execution segment and is not used as the output data item or the status data item. Record the position where each data item enters the execution segment or is generated within the execution segment, as well as the position where it was last read, written back, or output, to form the start and end positions of the data item; An interface access record is formed based on the interface binding record set and the nodes contained in the execution fragment; Data item attribute records are formed based on the port data type, bit width, and number of elements corresponding to the data item, and execution duration records are formed based on the execution order of the nodes.

5. The automotive-grade application layer visual code generation toolchain system as described in claim 4, characterized in that, The scheduling and arrangement module includes: Read the task definition information provided by the target base, which includes task cycle, scheduling time base, task local storage limit and stack limit information, and map the execution fragment to a unique task; For execution segments mapped to the same task, the initial release time is determined based on the relationship between the execution segments and the execution duration. Within the task cycle, forward and backward searches are performed on candidate release times, with the scheduling time base as the step size. Based on the start and end positions and attribute records of each data item, a valid range of data items is formed at the corresponding candidate release time. Based on the valid range of the data item, the local storage occupation, task local storage occupation, and interface concurrent access are checked separately, and the candidate release time that simultaneously meets the local storage occupation constraint, task local storage occupation constraint, and interface concurrent access constraint is determined as the reserved candidate release time. The final release time is determined based on the reserved candidate release time. Based on the valid range of data items and the attribute records of data items, the execution positions of each data item are arranged in the corresponding local storage area to determine the local storage location; The execution time limit is determined by the order in which the execution segments within the same task are finally released.

6. The automotive-grade application layer visual code generation toolchain system as described in claim 5, characterized in that, The code generation and compilation module includes: Based on the execution fragment, final release time, local storage location, and execution time limit, and according to the code generation rule table corresponding to the node type definition table, business source files, task configuration files, interface configuration files, and link layout files are generated. Compilation is performed by calling the cross-compilation toolchain corresponding to the target platform based on the build configuration file. Establish a mapping relationship between the execution fragment and the source file functions and source file symbols; Based on the compiled mapping file and symbol table, actual segment layout records, actual segment occupancy records, object location records, and object binding relationship records are generated. Based on the symbol table and interface configuration file, interface binding results are generated. Based on the disassembly results and target processor instruction cycle information, actual execution time is generated. Based on the stack analysis results, actual stack occupancy is generated. Based on the compilation log, compilation error information is generated.

7. The automotive-grade application layer visual code generation toolchain system as described in claim 6, characterized in that, The local write-back module includes: The compilation results are compared with the execution time limit corresponding to the execution segment, the storage area ownership or location constraints corresponding to the local storage location, the stack quota information, and the interface definition. Execution segments that meet any of the filtering criteria are identified as affected execution segments: The filtering conditions include the existence of compilation error information corresponding to the execution fragment, the execution cycle exceeding the corresponding execution time limit, the object binding relationship record not matching the storage area ownership or location constraints, the actual stack occupancy exceeding the corresponding stack limit information, or the interface binding result not matching the interface definition. Starting with the affected execution segment, the associated execution segments are recursively expanded along the data dependency direction between execution segments until no new execution segments appear. Execution segments that are in the same task as the affected and associated execution segments and have scheduling overlap are merged into the associated execution segments.

8. The automotive-grade application layer visual code generation toolchain system as described in claim 7, characterized in that, The local write-back module includes: The final release time determination, local storage location arrangement, source code artifact generation and compilation are re-executed only for the affected execution segment and related execution segments, and the local write-back is repeatedly executed until the construction result is obtained; The construction result is the result after satisfying the following conditions: There are no error messages in the compilation log. The actual execution time of each execution segment does not exceed the corresponding execution time limit. The actual stack occupancy of each task does not exceed the corresponding stack limit information. The object binding relationship records satisfy the storage area ownership or location constraints. The interface binding results conform to the interface definition. And when there is a previous round result, the final release time and local storage location of the current round are consistent with those of the previous round.