Cross-platform risc-v virtual machine seamless flow system

By using a cross-platform RISC-V virtual machine seamless transfer system, the timing boundaries of EtherCAT communication and motion control axis groups are coordinated, solving the uncertainty problem of migration and switching time in the prior art. This enables the complete transmission of EtherCAT process data frames and the accurate description of the motion control axis group state, ensuring the real-time performance and consistency of the control logic.

CN123164150APending Publication Date: 2026-11-24CHANGSHA RUITENG INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611658228.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-26
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing general virtual machine migration technology has difficulty coordinating migration switching times in industrial multi-protocol independent timing domain environments, resulting in EtherCAT process data frames being truncated, motion control axis group states being unable to be accurately described, and CANopen frames being lost, affecting the consistency and real-time performance of control logic.

Method used

It provides a seamless cross-platform RISC-V virtual machine migration system. Through migration negotiation module, state decoupling module, incremental synchronization module, critical point alignment module, state reconstruction module, and migration completion module, it coordinates the timing boundaries of EtherCAT communication and motion control axis group. It uses EtherCAT distributed clock and interrupts of motion control axis group to perform protocol-level transaction boundary alignment, freezes vCPU and records protocol I/O status, and ensures that state packets are transmitted within the protection band time slot of TSN switch.

Benefits of technology

It achieves complete transmission of EtherCAT process data frames during migration, provides accurate description of the motion control axis group status, reduces the uncertainty of migration waiting time, and maintains the real-time performance and consistency of control logic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123164150A_ABST
    Figure CN123164150A_ABST
Patent Text Reader

Abstract

This invention relates to the field of industrial virtual machine migration, and discloses a seamless cross-platform RISC-V virtual machine migration system. The source edge controller performs pre-copying and dirty page tracking of the virtual machine memory, and records the EtherCAT, CAN, digital I / O, and motion control states. During the migration preparation phase, it prevents new I / O transactions from being committed, and determines a coordination safety point by combining the EtherCAT distributed clock synchronization time with the motion control segment completion information. At this safety point, the vCPU is paused and a platform-independent state packet is formed. The target end reconstructs the virtual machine based on the platform-independent state packet, executes RISC-V client instructions through instruction set simulation or dynamic binary translation, and continues to access physical devices through the source I / O proxy service. For prematurely terminated motion segments, a compensating motion segment is generated based on the compensation deviation. This system is used to reduce the risk of inconsistencies in multi-protocol states and motion task interruptions during cross-platform migration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of real-time migration of industrial virtual machines, and in particular to a cross-platform RISC-V virtual machine seamless migration system. Background Technology

[0002] In the flexible manufacturing units of a smart factory, each workstation is equipped with an industrial edge controller based on the RISC-V architecture. A lightweight Type-1 virtual machine monitor runs on the edge controller. The virtual machine instance carries real-time control tasks and a digital twin model of the workstation, accessing physical peripherals such as EtherCAT slaves, CANopen nodes, digital I / O, and motion control axis groups through the virtio industrial equipment model. When process engineers conduct on-site debugging with a mobile debugging terminal, the RISC-V virtual machine instance on the edge controller needs to be seamlessly transferred to the debugging terminal. During this transfer, necessary periodic communication and output status of the field equipment must be maintained, and information such as digital I / O status, EtherCAT process data status, and motion segment status of the motion control axis group must remain consistent before and after the migration. This ensures that the migrated virtual machine can resume its original control tasks. After debugging is complete, the virtual machine status is transferred back to the edge controller, minimizing the impact of migration and switching on the operation of workshop equipment.

[0003] General-purpose virtual machine live migration technologies (such as QEMU live migration and Firecracker snapshot recovery) can handle the saving and restoration of CPU registers, memory pages, and some virtual device logical states. For device pass-through scenarios, existing solutions maintain I / O continuity during migration through device silencing, device register saving / restoration, and remote device agents. However, in industrial real-time control scenarios, virtual machines simultaneously manage multiple protocol transactions driven by independent hardware timing domains: EtherCAT process data loops are driven by a distributed clock with a fixed period; the pulse sequence of motion control axis groups is driven by the internal clock of the motion control card with a variable period; and CANopen node communication has asynchronous characteristics.

[0004] Existing general migration mechanisms have the following main problems in these multi-protocol environments: On the one hand, the selection of the migration critical point lacks a deterministic alignment mechanism with the protocol hardware timing. The EtherCAT process data loop, motion control segment completion interrupt, and CANopen frame transmission and reception exist in independent timing domains. If the migration critical point is misaligned with the protocol boundary, it may lead to EtherCAT process data frames being truncated during DMA transfer, motion control axis groups being located in the middle of segments and unable to accurately describe the speed curve state, and CANopen frames being lost during transmission or reception. Ultimately, this results in inconsistencies between the device state after migration and the CPU execution view, causing control logic misjudgments or peripheral communication interruptions. Existing methods use software timeouts to determine transaction boundaries, but there is no deterministic relationship between software timeouts and protocol hardware timing, and they may be triggered at any time. If the vCPU is directly frozen during the migration critical phase and then the protocol safety point is waited for, the entire waiting time is included in the virtual machine pause time, compromising the real-time performance of the migration.

[0005] On the other hand, the EtherCAT distributed clock cycle and the timing of the interruption at the completion of the motion segment of the motion control axis group do not have a definite phase relationship. The EtherCAT distributed clock cycle is typically a fixed multiple of 250μs to 1ms, while the motion control segment cycle depends on the velocity curve and may last for several milliseconds or even longer. If the migration is delayed until the motion segment completes naturally, the total waiting time may be much greater than multiple EtherCAT cycles, making the total waiting time at the migration critical point uncontrollable. If the motion control axis group is forcibly frozen before the segment is completed, the axis group is located in the middle of the segment, and its velocity curve state cannot be accurately described, potentially leading to position jumps after recovery. For multi-axis interpolation motion, if each axis stops independently and prematurely, the interpolation relationship between axes will be disrupted, resulting in trajectory mismatch after recovery.

[0006] Therefore, existing general virtual machine migration technologies still face challenges in industrial multi-protocol independent timing domain environments, such as difficulty in coordinating migration switching times, difficulty in controlling waiting times, and difficulty in connecting device states and motion tasks before and after migration. Summary of the Invention

[0007] This invention provides a cross-platform RISC-V virtual machine seamless migration system, which coordinates the timing boundaries of EtherCAT communication and motion control axis groups during virtual machine migration, and restores the virtual machine's running state and the control relationship of the corresponding industrial equipment after migration.

[0008] To achieve the above-mentioned objectives, the present invention provides the following technical solution: A cross-platform RISC-V virtual machine seamless workflow system is provided, including a source edge controller, a target debugging terminal, and a transmission network connecting the source edge controller and the target debugging terminal. The source edge controller runs a RISC-V virtual machine that carries industrial control tasks and manages EtherCAT devices, CAN devices, digital I / O devices, and motion control axis groups through an I / O agent service. The system also includes: The migration negotiation module is used to establish a migration channel between the source edge controller and the target debugging terminal. After exchanging at least the virtual machine configuration, platform characteristics, EtherCAT master station capabilities, motion controller capabilities, target instruction set execution capabilities, and CAN protocol type between the source edge controller and the target debugging terminal, it determines the platform-independent state encoding format. The state decoupling module is used to decouple the state of the source virtual machine into a CPU / memory layer, a device logic layer, and a protocol I / O proxy layer. The protocol I / O proxy layer records the EtherCAT process data image, object dictionary, motion segment state of motion control axis group, CAN frame state, and digital I / O shadow register value. The incremental synchronization module is used to perform dirty page tracking on the source memory pages, incrementally synchronize the initial memory snapshot, device logical status and protocol transaction log to the target debugging terminal, and request protection band time slots from the TSN switch for status packet transmission. The critical point alignment module is used to enable the source edge controller to enter the migration preparation state and prevent new I / O transactions from being committed. It performs protocol-level transaction boundary alignment based on EtherCAT distributed clock synchronization interrupt and motion segment completion interrupt of motion control axis group. It freezes vCPU at the determined coordination safety point, collects CPU register, memory consistency snapshot and protocol I / O proxy layer transaction log, encodes them into platform-independent state packets, and sends the final dirty page and the platform-independent state packets to the target debugging terminal through the guard band time slot. The state reconstruction module is used to enable the target debugging terminal to reconstruct the RISC-V virtual machine instance according to the platform-independent state packet, execute RISC-V client instructions through instruction set simulation or dynamic binary translation, establish a forwarding channel with the source I / O proxy service, convert client I / O requests into protocol semantic operation instructions and send them to the source edge controller's I / O proxy service for execution, and generate compensation motion segment commands according to the early termination compensation deviation in the platform-independent state packet. The migration completion module is used to enable the target debugging terminal to resume vCPU execution. After the forwarding channel is confirmed to be available, it notifies the source edge controller to release virtual machine memory and vCPU resources, and retains the I / O agent service to continue managing physical devices until the reverse migration.

[0009] In one embodiment of this application, the critical point alignment module includes: The migration preparation module is used to prevent new I / O transactions from being committed, add subsequent I / O requests to the queue to be committed, and record the EtherCAT process data image, the motion segment status of the motion control axis group, the CAN frame status, and the digital I / O shadow register value. The boundary alignment module is used to read the EtherCAT distributed clock configuration, obtain the candidate SYNC0 time sequence with a SYNC0 synchronization cycle interval, calculate the remaining time of natural segment completion prediction for the motion control axis group, and when the remaining time of natural segment completion prediction exceeds the predetermined maximum segment waiting time, send an online change endpoint command to the motion control drive, so that the corresponding motion control axis group decelerates to zero along the current motion direction according to the safety deceleration and reaches the new segment endpoint, triggering the segment completion interrupt, obtaining the segment completion prediction time, and comparing the segment completion prediction time with the candidate SYNC0 time sequence to select a coordinated safety point; The vCPU freeze module is used to put each vCPU into a paused state through the vCPU pause interface of the RISC-V virtual machine monitor when the coordinated safety point is reached, and to record the values ​​of the program counter, general-purpose registers, floating-point registers and control status registers. The snapshot acquisition module is used to acquire snapshots of the register status and memory consistency of each vCPU after the vCPU is frozen, and to merge the memory consistency snapshot with the frozen snapshot of the protocol I / O proxy layer into a set of states to be encoded. The semantic encoding module is used to encode the EtherCAT process data in the state set to be encoded according to the process data image, encode the CANopen request according to the object dictionary index / sub-index pair, encode the raw CAN request according to CANID, data length code and data field, encode the digital I / O shadow register value as peripheral status segment, and mark the pending transaction as pending retry status to obtain protocol semantic status data. The status packet transmission module is used to encode the protocol semantic state data and CPU / memory snapshot into a platform-independent status packet, reserve a protection band time slot with the TSN switch according to the coordinated security point, and send the platform-independent status packet to the target debugging terminal within the protection band time slot.

[0010] In one embodiment of this application, the boundary alignment module includes: The distributed clock timing calculation module is used to obtain the SYNC0 synchronization period and current phase from the distributed clock configuration and running clock information of the EtherCAT master station, and generate the candidate synchronization timing sequence at an interval of one SYNC0 synchronization period. The segment prediction and early termination module is used to obtain the current segment number, total number of segment pulses, number of pulses sent, current actual speed, acceleration, deceleration, and safe deceleration of each active motion control axis group. It calculates the predicted remaining time for each active motion control axis group from the current moment until the completion of the natural segment, and takes the maximum value as the axis group's predicted remaining time. When the predicted remaining time of the axis group exceeds the maximum segment waiting time represented by the SYNC0 synchronization cycle, it calculates the deceleration time required to decelerate to zero based on the current actual speed and safe deceleration. If the sum of the deceleration time and the command response time does not exceed the maximum segment waiting time, it sends an axis group-level online endpoint change command to the motion control drive, causing the corresponding motion control axis group to decelerate to zero along the current motion direction according to the safe deceleration and reach the new segment endpoint. It records the early termination compensation deviation between the original segment target position and the new segment endpoint and updates the axis group's predicted remaining time. If the sum of the deceleration time and the command response time exceeds the maximum segment waiting time, the migration preparation is canceled. The safety point calculation module is used to select the first candidate synchronization time from the candidate synchronization time sequence that simultaneously satisfies the condition of being no earlier than the sum of the current time and the predicted remaining time of the axis group, and that the interval from the current time to the candidate synchronization time does not exceed the maximum segment waiting time, as the migration trigger time; if there is no candidate synchronization time that meets the conditions, the migration preparation is canceled. The timing metadata recording module is used to record the migration trigger time, EtherCAT loop number, motion segment number of motion control axis group, position value of each axis, early termination compensation deviation and CAN pending frame identifier, and encode the recording results into the platform-independent status packet.

[0011] In one embodiment of this application, the state reconstruction module includes: The execution mechanism determination module is used to select instruction set simulation or dynamic binary translation as the execution mode of RISC-V guest instructions based on the target instruction set execution capability exchanged by the migration negotiation module. The virtual machine reconstruction module is used to write the CPU register values, memory consistency snapshots and device logical states in the platform-independent state packet into the target virtual machine monitor to build a RISC-V virtual machine instance. The device proxy channel module is used to establish a forwarding channel between the target device shadow proxy and the source I / O proxy service. The forwarding channel can reuse the migration channel or be established independently. The protocol conversion module intercepts I / O requests from the client and converts the requests into corresponding protocol semantic operation instructions based on the CAN protocol type exchanged by the migration negotiation module. Specifically, CANopen type is converted into object dictionary index / sub-index operation instructions, and raw CAN type is converted into CANID, data length code, and data field operation instructions. The protocol semantic operation instructions are then sent to the I / O proxy service of the source edge controller via the forwarding channel for execution. The protocol semantic operation instructions and the corresponding response messages contain the same transaction identifier. The target device shadow proxy matches the request and response based on the transaction identifier. The motion compensation module is used to read the early termination compensation deviation recorded in the motion control segment compensation segment of the status packet, obtain the early termination compensation deviation of each axis group, generate a motion compensation segment command by the motion control logic in the virtual machine and submit it for execution, so that the axis group moves from the new segment end point to the original segment target position.

[0012] In one embodiment of this application, the status packet transmission module includes: The byte order conversion module is used to perform byte order conversion on the structured state fields in the protocol semantic state data according to the byte order information in the platform characteristics exchanged by the migration negotiation module, and serialize the floating-point data according to the IEEE 754 standard to obtain platform-independent encoded data; the CPU / memory snapshot is migrated according to the original byte sequence and no byte order conversion is performed; The time slot reservation module is used to calculate the reservation start time and duration of the protection band time slot based on the time of the coordinated security point, and send a time slot reservation request to the TSN switch. The reservation start time is not earlier than the time of the coordinated security point, and the duration is determined based on the amount of data of the platform-independent encoded data. The status packet encapsulation module is used to encapsulate the platform-independent encoded data into a platform-independent status packet according to the version number, data segment type, data segment length and data segment content, write the serial number, total length and verification information into the platform-independent status packet, and send the platform-independent status packet to the target debugging terminal via the TSN network within the scheduled guard band time slot. The transmission confirmation module is used to listen for the reception confirmation message returned by the target end after the transmission is completed. If the reception confirmation message is not received within the predetermined confirmation waiting time, the platform-independent status packet is retransmitted in the next guard band time slot. The retransmission of the platform-independent status packet uses the original sequence number. The target end identifies and discards the duplicate status packet according to the sequence number.

[0013] In one embodiment of this application, the motion segment of the motion control axis group adopts a trapezoidal velocity curve. The current stage of the axis group is determined based on the relationship between the current actual velocity and the maximum velocity, as well as the signed acceleration along the current motion direction. Under the conditions that the velocity, acceleration, and deceleration used for kinematic formula calculations are all of magnitude and the remaining constant velocity pulse count is not less than zero, the remaining predicted duration of the natural segment completion for the axis group is calculated as follows: When the current actual speed is less than the maximum speed and the acceleration phase is under the following conditions

[0014]

[0015]

[0016]

[0017] Assuming the current actual speed equals the maximum speed and the speed is constant.

[0018]

[0019] When the current actual speed is less than the maximum speed and the vehicle is in the deceleration phase

[0020] in, To predict the remaining duration for each natural segment, This represents the remaining number of constant-speed pulses, i.e., the number of pulses that need to be sent at maximum speed after acceleration is complete. The remaining acceleration pulse count, i.e., the number of pulses required to accelerate from the current actual speed to the maximum speed. This refers to the number of pulses required for the deceleration phase, i.e., the number of pulses needed to decelerate from maximum speed to zero. This represents the maximum speed in the current segment of the speed curve for this shaft group. To retrieve the current actual speed of this shaft group, This refers to the acceleration in the velocity curve of the current segment of the shaft assembly. This refers to the deceleration in the current segment of the velocity curve of this shaft assembly. This represents the total number of pulses in the current segment of the axis group. This represents the number of pulses that have been sent within the current segment of this axis group.

[0021] In one embodiment of this application, the motion segment of the motion control axis group is a linear interpolation motion segment. When the axis group-level online variable endpoint command is executed, the motion control card synchronously transitions each axis in the axis group to the new segment endpoint according to the interpolation relationship, keeping the relative trajectory shape between axes unchanged, and triggering the axis group segment completion interruption when the new segment endpoint is reached.

[0022] In one embodiment of this application, the vCPU freeze module causes each vCPU to enter a paused state through the vCPU pause interface of the RISC-V virtual machine monitor, and records the values ​​of the program counter, general-purpose registers, floating-point registers and control status registers. The vCPU pause interface is a virtual interrupt injection interface or a direct vCPU stop interface provided by the virtual machine monitor.

[0023] In one embodiment of this application, when an EtherCAT loop is marked as a migration loop, the slave corresponding to the EtherCAT loop retains the output value of the previous loop in the migration loop.

[0024] In one embodiment of this application, the original segment is a linear interpolation motion segment, and the system processes the early termination compensation deviation in the following manner: For each active axis group, calculate the difference between the original target position and the early termination position to obtain the early termination compensation deviation. The early termination position is the new target position after modification by the axis group-level online variable endpoint command. The early termination compensation deviation of each axis group is encoded into the motion control segment compensation segment of the platform-independent state package on a unit basis. After the RISC-V virtual machine on the target debugging terminal recovers, the motion control logic within the virtual machine reads the motion control segment compensation segment, generates a linear compensation motion segment command with the early termination position as the starting point, the original segment target position as the ending point, and the velocity curve derived from the original segment parameters, and submits it for execution.

[0025] Beneficial effects: 1. By using the critical point alignment module, the source edge controller first enters the migration preparation state and prevents new I / O transactions from being committed. Protocol-level transaction boundary alignment is performed based on EtherCAT distributed clock synchronization interrupt and motion control axis group motion segment completion interrupt. The vCPU is frozen at the determined coordination safety point, which helps reduce the risk of EtherCAT process data frames being truncated during DMA transmission, motion control axis groups being frozen in the middle of a segment, or CANopen frames being lost during transmission and reception. At the same time, the vCPU freezing only occurs after the protocol-level transaction boundary alignment is completed, which helps to shorten the waiting time for the safety point.

[0026] 2. By using the segment prediction and early termination module in the boundary alignment module, when the predicted completion time of the natural segment of the motion control axis group exceeds the maximum segment waiting time represented by the SYNC0 synchronization cycle, an axis group-level online variable endpoint command is sent to the motion control drive. This actively constructs a predictable segment completion boundary with safe deceleration, which helps to limit the migration waiting time within a controllable range, while maintaining the inter-axis interpolation relationship unchanged. This reduces the risk of the velocity curve state being indescribable and the position jump after recovery caused by forced freezing in the segment.

[0027] 3. By reading the early termination compensation deviation recorded in the status packet through the compensation motion module, and generating a compensation motion segment command with the early termination position as the starting point and the original target position as the ending point, it is beneficial to enable the motion task that was truncated due to active early termination to continue to the original target position after the target end is restored, thus maintaining the continuity of the motion task before and after migration.

[0028] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0029] The accompanying drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the following detailed description to explain the embodiments of this application, but do not constitute a limitation on the embodiments of this application. In the drawings: Figure 1 This is a block diagram of the cross-platform RISC-V virtual machine seamless transfer system in the embodiments of this application.

[0030] Figure 2 This is a structural block diagram of the critical point alignment module in the cross-platform RISC-V virtual machine seamless transfer system in this embodiment of the application.

[0031] Figure 3 This is a structural block diagram of the boundary alignment module of the critical point alignment module in the cross-platform RISC-V virtual machine seamless transfer system in this application embodiment. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only for illustration and explanation of the embodiments of this application and are not intended to limit the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0033] It should be noted that the acquisition, transmission, storage, use, and processing of data in the technical solution of this application all comply with relevant laws and regulations. In the embodiments of this application, certain existing industry solutions such as software, components, and models may be mentioned. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solution of this application, and do not imply that the applicant has already used or necessarily used such solutions.

[0034] like Figure 1 As shown, the cross-platform RISC-V virtual machine seamless migration system 100 includes a migration negotiation module 10, a state decoupling module 20, an incremental synchronization module 30, a critical point alignment module 40, a state reconstruction module 50, and a migration completion module 60. Each module sequentially completes migration parameter negotiation, virtual machine state decoupling, incremental synchronization, coordination of safety point determination, target-side state reconstruction, and migration completion processing.

[0035] Specifically, the migration negotiation module establishes a secure migration channel between the source edge controller and the target debugging terminal. This channel completes the handshake based on the TLSoverTCP protocol: the source and target exchange digital certificates and negotiate encryption suites. After verifying the identity of the other party, both parties generate a session key. Subsequent migration control messages are transmitted encrypted with this key to ensure that the migration process is not eavesdropped on or tampered with. In a TSN network environment, the migration control message is encapsulated as a standard Ethernet frame, and its VLAN tag carries a priority field, enabling migration traffic and real-time control traffic to be differentiated and scheduled in time-sensitive network switches. On this basis, the source and target exchange at least the following information: virtual machine configuration (number of vCPUs, memory size, virtio device list and version), platform characteristics (byte order, floating-point format, RISC-VH extended version), EtherCAT master station capabilities (whether DC mode is enabled, SYNC0 synchronization cycle, number of slave stations in the current topology), motion controller capabilities (number of active axis groups, segment completion interrupt support, online variable endpoint support), and CAN protocol type (CANopen or bare CAN). Based on the information obtained through the exchange, both parties jointly determined a platform-independent state encoding format: This encoding format carries a version number field. Each data segment in subsequent state packets begins with a type identifier and a length field. The type identifier distinguishes CPU register segments, memory page segments, EtherCAT process data segments, object dictionary segments, motion segments of motion control axis groups, CAN frame segments, and digital I / O shadow segments. The field structure is similar to the Cap'nProto pattern definition method, achieving zero-resolution direct access through predefined field offsets. The state decoupling module executes in the source virtual machine monitor, dividing the virtual machine state into a CPU / memory layer, a device logic layer, and a protocol I / O proxy layer. The CPU / memory layer contains vCPU registers, page tables, and physical memory pages; the device logic layer contains virtio device queue indexes, enable bits, and feature negotiation results; the protocol I / O proxy layer is maintained by the device shadow proxy, recording state information directly associated with industrial protocols.The storage structure of the EtherCAT process data image is arranged according to the physical connection order of the slave stations. Each slave station occupies a continuous input area and output area, with the input area and output area indexed by byte offset. The object dictionary index / sub-index mapping table adopts a hash table structure. The key is a 32-bit integer composed of the object dictionary index and sub-index, and the value is the current data, data type, and access permissions of the object. The segment status snapshot of the motion control axis group includes the current segment number, total number of pulses in the segment, number of pulses sent, actual position of each axis, target position of each axis, and inter-axis interpolation relationship identifier. The queue structure of the CAN frame is a circular buffer. Each node maintains a transmit queue and a receive queue. The queue elements include frame header information (CANID, data length code) and data fields. In the bit mapping of the digital I / O shadow register, each output point corresponds to one bit, and the current output value and the hold flag during the migration are stored at the same time. The incremental synchronization module performs dirty page tracking on the source side, specifically employing a write protection mechanism: before entering the pre-copy phase of migration, write protection flags are set for all guest physical memory pages. When a vCPU performs a write operation, a page fault is triggered. The virtual machine monitor records the page as dirty in the page fault handling and removes the write protection to allow subsequent writes. Simultaneously, the corresponding bit in the dirty page bitmap is set. The dirty page bitmap is stored using a bit array that corresponds one-to-one with the guest physical page frame number, with each byte representing the dirty state of eight consecutive physical pages. The source edge controller incrementally synchronizes the initial memory snapshot, device logical state, and protocol transaction log to the target side. During synchronization, state packets are serialized and sent via the TSN network. Simultaneously, the source edge controller requests guard band time slots from the TSN switch for subsequent state packet transmission. These guard band time slots are allocated by the TSN switch's time-aware shaper, ensuring that state packets pass through without contention within a predetermined time window, and that the transmission delay has a deterministic upper bound. The critical point alignment module puts the source edge controller into a migration ready state and prevents new I / O transactions from being committed. After entering the ready state, the source end performs protocol-level transaction boundary alignment based on the EtherCAT distributed clock synchronization interrupt and the motion segment completion interrupt of the motion control axis group: it reads the SYNC0 synchronization period and current phase from the EtherCAT master driver and calculates the subsequent candidate synchronization time sequence; for each active motion control axis group, it calculates the remaining time of natural segment completion prediction according to the kinematic formula and compares it with the maximum segment waiting time represented by the SYNC0 synchronization period; if the remaining time of natural segment completion prediction exceeds the maximum segment waiting time, it sends an axis group-level online variable endpoint command to the motion control driver to actively construct a predictable segment completion boundary with safe deceleration. When the selected coordinated safe point is reached, the critical point alignment module freezes all vCPUs, collects CPU register, memory consistency snapshots, and protocol I / O proxy layer transaction logs, encodes the above data into platform-independent state packets, and sends them to the target end through the reserved protection band time slots.The memory consistency snapshot represents the memory state at the moment of freezing, and together with the initial memory snapshot and incremental dirty pages, constitutes the complete memory state. The state reconstruction module reconstructs the RISC-V virtual machine instance on the target side based on the received platform-independent state packet. To address the issue of different instruction set architectures between the source and target sides, the target side executes RISC-V guest instructions using instruction set emulation or dynamic binary translation. Taking the QEMUTCG mechanism as an example, RISC-V guest instructions are first divided into basic blocks, each ending with a control transfer instruction. The TCG front-end translates the RISC-V instructions into a platform-independent TCG intermediate representation, and the TCG back-end further compiles the intermediate representation into target host instructions (x86-64 or ARMv8 instructions). The generated host instruction blocks are stored in the translation cache for subsequent direct execution. Based on this execution mechanism, the target end establishes a forwarding channel with the source end's I / O proxy service. This forwarding channel can reuse the migration channel or be established independently. I / O requests issued by the client are intercepted and converted into protocol semantic operation instructions (CANopen requests are converted into object dictionary index / sub-index operation instructions, and raw CAN requests are converted into CANID, data length code, and data field operation instructions), and then sent to the source end for execution via the forwarding channel. Simultaneously, the state reconstruction module generates compensation motion segment commands based on the early termination compensation deviation recorded in the state packet, causing the axis group to move from the early termination position to the original target position. After the migration completion module resumes vCPU execution at the target end, it continuously confirms the stability of the device proxy forwarding channel, specifically by periodically sending heartbeat messages and receiving heartbeat responses from the source end's I / O proxy service. When the channel remains normal for a predetermined number of consecutive heartbeat cycles, the target end notifies the source end's edge controller to release virtual machine memory and vCPU resources. After releasing the virtual machine resources, the source end's edge controller retains the I / O proxy service, continues to manage physical devices, receives I / O requests forwarded by the target end, and drives EtherCAT slaves, CAN nodes, digital I / O, and motion control axis groups. After the process engineer completes debugging and saves the changes at the target end, the target end initiates a reverse migration: the session establishment method for reverse migration is the same as that for forward migration, with the target end as the source end and the original source end edge controller as the target end. During reverse migration, the virtual machine migration-out end is the debugging terminal, and the field physical equipment is still managed by the I / O proxy service of the original edge controller. The EtherCAT distributed clock information and motion segment status of the motion control axis group required for reverse migration are still obtained by the original edge controller and provided to the debugging terminal through the existing communication channels at both ends. The migration negotiation, state decoupling, incremental synchronization, critical point alignment and state reconstruction processes are re-executed to transfer the virtual machine instance back to the source end edge controller. The workshop equipment continues to operate without downtime during the entire reverse migration process.In addition, the system supports abnormal rollback handling. When migration is canceled, the source edge controller restores the I / O requests in the pending submission queue and determines whether to continue executing the compensation motion segment to complete the original motion task based on the recorded early termination compensation deviation. If the migration cancellation occurs after the online endpoint change command has been executed, the source edge controller generates a compensation motion segment command based on the early termination compensation deviation and submits it for execution, causing the motion control axis group to move from the new segment endpoint to the original segment target position, and then continues to execute the subsequent motion segments in the original motion program. When the status packet verification fails, the target debugging terminal discards the status packet and requests the source edge controller to resend it. When the target recovery fails, the target debugging terminal stops the currently failed virtual machine instance and notifies the source edge controller to resume the previously suspended virtual machine instance. When the proxy forwarding channel is disconnected, the target debugging terminal suspends the client I / O request and retryes after the channel is restored. When the motion control axis group is not in place, the source edge controller maintains the current output and waits for the axis group to reach the segment completion state. When the replay of the CAN pending frame fails, the source edge controller marks the corresponding frame as discarded and reports it to the upper layer control logic.

[0036] like Figure 2 As shown, the critical point alignment module includes a migration preparation module, a boundary alignment module, a vCPU freeze module, a snapshot acquisition module, a semantic encoding module, and a status packet transmission module. In this embodiment, the critical point alignment module also includes a migration barrier execution module, which is used to freeze or record EtherCAT process data, motion segment states of motion control axis groups, pending CAN frames, and digital I / O output states at a coordinated safety point. Subsequently, the vCPU freeze module suspends each vCPU.

[0037] Specifically, the migration preparation module executes when the source edge controller enters the migration preparation state, preventing new I / O transactions from being submitted to the device driver. Simultaneously, it adds subsequent I / O requests to the pending submission queue, waiting for the migration to complete before submission. During migration preparation, the I / O transactions prevented from submission are new device control requests generated by the virtual machine, which do not affect the periodic operations performed by the source I / O agent service to maintain communication with field devices. The EtherCAT master continues to perform valid process data exchange according to the predetermined communication cycle and maintains the corresponding existing output data. Motion segments already submitted to the motion control card continue to be executed by the motion control card according to their respective operating states until natural completion or early termination based on an online endpoint change command. While preventing new transaction submissions, the migration preparation module records the EtherCAT process data image, the motion segment status of the motion control axis group, the CAN frame status, and the digital I / O shadow register values. The boundary alignment module obtains the SYNC0 synchronization period, phase, and current distributed clock value from the distributed clock configuration and running clock information of the EtherCAT master station. Based on this, it determines the first SYNC0 synchronization moment after the current moment and generates a candidate synchronization moment sequence according to the SYNC0 synchronization period, starting from this moment. Here, DC is an abbreviation for Distributed Clocks, representing the EtherCAT distributed clock mechanism used to realize clock synchronization of various devices in the EtherCAT network; SYNC0 is a periodic synchronization event generated based on the distributed clock, and the SYNC0 synchronization period is the time interval between two adjacent SYNC0 synchronization events. Subsequently, the boundary alignment module calculates the remaining duration of the natural segment prediction for each active axis group and takes the maximum value of the remaining duration of the prediction among all axis groups as the remaining duration of the natural segment prediction for the axis group. When the predicted remaining time exceeds the predetermined maximum segment waiting time, the boundary alignment module calculates the deceleration time required to decelerate to zero based on the current actual speed and safe deceleration. If the sum of the deceleration time and the command response time does not exceed the maximum segment waiting time, the module sends an online endpoint change command to the motion control drive, causing the corresponding motion control axis group to decelerate to zero along the current motion direction according to the safe deceleration and reach the new segment endpoint. If the sum of the deceleration time and the command response time exceeds the maximum segment waiting time, the migration preparation is canceled. After the command is executed, the motion control card drives the axis group to reach the new target position ahead of schedule with safe deceleration and triggers a segment completion interruption. The boundary alignment module compares the predicted segment completion time with the candidate SYNC0 time sequence one by one, selecting the first candidate SYNC0 time that is no earlier than the predicted segment completion time and whose interval with the current time does not exceed the maximum segment waiting time as the coordination safety point. If there is no candidate SYNC0 time that meets the above conditions, the migration preparation is canceled.Upon arrival at the coordinated safety point, the migration barrier execution module, within the same interrupt handling context, sequentially freezes the EtherCAT master station process data writing, confirms that each axis group is in the segment completion state, stops the corresponding message transmission and reception for pending frames in the CAN controller, buffers the frame headers and data of CAN frames that have not yet been physically sent in the transmission queue, and marks these frames as pending retry; it also buffers the current output values ​​of digital I / O. Subsequently, the vCPU freeze module pauses each vCPU and records the values ​​of the program counter, general-purpose registers, floating-point registers, and control status registers. The snapshot acquisition module immediately acquires the register status of each vCPU and the memory status at the time of freeze after the vCPU freeze. The memory status acquisition is based on a write protection mechanism: write protection has been set for all client physical memory pages during the migration preparation phase, and no new writes are generated after the vCPU freeze, so the memory content is consistent with the protocol I / O status in time. The snapshot acquisition module merges the memory status and the protocol I / O status into a set of states to be encoded. Each data segment in the set of states to be encoded is distinguished by type identifier for subsequent semantic encoding. The boundary alignment module reads the DC configuration parameters of the EtherCAT master driver to obtain the SYNC0 synchronization period and current phase. In actual implementation, the SYNC0 synchronization period and current phase are obtained from the distributed clock configuration and running clock information of the EtherCAT master, and the next set of candidate SYNC0 times is calculated. The algorithm for generating the candidate time sequence is as follows: based on the current distributed clock value, the SYNC0 synchronization period, and the phase, the first SYNC0 synchronization time after the current time is determined, and subsequent candidate synchronization times are generated according to the SYNC0 synchronization period, starting from this synchronization time. Subsequently, the boundary alignment module calculates the remaining duration of the natural segment prediction for each active axis group, and takes the maximum value of the remaining duration of the prediction among all axis groups as the remaining duration of the natural segment prediction for the axis group. When the predicted remaining time exceeds the predetermined maximum segment waiting time, the boundary alignment module calculates the deceleration time required to decelerate to zero based on the current actual speed and safe deceleration. If the sum of the deceleration time and the command response time does not exceed the maximum segment waiting time, the module sends an online endpoint change command to the motion control drive. When calling the online endpoint change interface of the motion control SDK, the parameters passed include the axis group number, the new target position value, and the transition mode identifier. The interface returns the command reception status and the estimated completion time. The new target position is calculated as the pulse position required to decelerate from the current speed to zero at the safe deceleration. After the command is executed, the motion control card drives the axis group to reach the new target position ahead of schedule at the safe deceleration and triggers a segment completion interrupt. The boundary alignment module compares the predicted segment completion time with the candidate SYNC0 time sequence one by one, selecting the first candidate synchronization time that simultaneously satisfies the condition of not being earlier than the predicted segment completion time and that the time from the current time to this candidate time does not exceed the maximum segment waiting time as the coordination safety point. This selection logic can be represented by the following pseudocode: For each candidate time in the candidate sequence... Tcandidate Check in sequence T candidate Does it meet the requirements? T candidate ≥ T now + T seg and T candidate T now ≤ T wait_maxThe first time the conditions are met, it becomes a coordinated safe point. If the segment completion prediction time falls between two adjacent candidate times, then the intermediate EtherCAT loops are marked with migration loops. The vCPU freeze module executes when the coordinated safe point is reached, putting each vCPU into a suspended state through the vCPU pause interface of the RISC-V virtual machine monitor. The vCPU pause interface is either a virtual interrupt injection interface or a direct vCPU stop interface provided by the virtual machine monitor. After each vCPU is paused, the vCPU freeze module records the values ​​of the program counter, general-purpose registers, floating-point registers, and control status registers of each vCPU, forming a CPU state snapshot. The snapshot acquisition module immediately acquires the register states and memory consistency snapshots of each vCPU after the vCPU is frozen. The acquisition of the memory consistency snapshot is based on a write protection mechanism: write protection has been set for all guest physical memory pages during the migration preparation phase, and no new writes are generated after the vCPU is frozen, so the memory content is consistent with the protocol I / O proxy layer freeze snapshot in time. The snapshot acquisition module merges the memory consistency snapshot and the protocol I / O proxy layer freeze snapshot into a set of states to be encoded. Each data segment in the set of states to be encoded is distinguished by type identifier for subsequent semantic encoding. The semantic encoding module performs protocol semantic encoding on the state set to be encoded. For EtherCAT process data, it encodes according to the process data map; for CANopen requests, it encodes using object dictionary index / sub-index pairs. For example, control word 0x6040 is encoded as index 0x6040 plus sub-index 0x00, and actual position 0x6064 is encoded as index 0x6064 plus sub-index 0x00. The encoding result includes object dictionary index, sub-index, current value, target value, and transaction direction; for raw CAN transactions, the encoding uses a combination of CANID, data length code, and data field. For example, a CAN frame with identifier 0x123, data length of 4 bytes, and data content of 0x01, 0x02, 0x03, and 0x04 is encoded as frame header information (CANID=0x123, DLC=4) plus a data field byte sequence; for digital I / O shadow register values, the encoding is a peripheral status segment. The encoding of each output point includes the output point number, current output value, and hold flag. After encoding, pending transactions are marked as pending retry, resulting in protocol semantic state data. The state packet transmission module encodes the protocol semantic state data and CPU / memory snapshots into platform-independent state packets. During encoding, byte order conversion is performed on multi-byte data based on the byte order information from the platform characteristics exchanged during the migration negotiation phase, and floating-point data is serialized according to the IEEE 754 standard. After encoding, the state packet transmission module calculates the reservation start time and duration of the protection band time slot based on the time of the coordinated security point, and sends a time slot reservation request to the TSN switch. The reservation start time is no earlier than the time of the coordinated security point, and the duration is determined based on the state packet data size.Within the reserved protection band time slot, the status packet transmission module sends platform-independent status packets to the target end via the TSN network, ensuring that the status packet transmission does not compete with real-time control traffic for bandwidth, and the transmission delay has a deterministic upper bound.

[0038] like Figure 3 As shown, the boundary alignment module includes a distributed clock timing calculation module, a segment prediction and early termination module, a safety point calculation module, and a timing metadata recording module. The distributed clock timing calculation module generates a candidate SYNC0 timing sequence, the segment prediction and early termination module calculates the estimated completion time of the motion segment and executes the online endpoint change command as needed, the safety point calculation module determines the coordinated safety point, and the timing metadata recording module records the timing and motion state information required for the migration.

[0039] The distributed clock timing calculation module obtains the SYNC0 synchronization period and current phase from the distributed clock configuration and running clock information of the EtherCAT master station. Based on the current distributed clock value, SYNC0 synchronization period, and current phase, it determines the first SYNC0 synchronization moment after the current moment. Starting from this moment, it sequentially adds one SYNC0 synchronization period, generating a sequence containing at least two candidate SYNC0 moments. This sequence provides a candidate set for subsequent coordination safety point searches. The segment prediction and early termination module obtains the current segment number, total number of pulses in the segment, number of pulses sent, current actual velocity, acceleration, deceleration, and safe deceleration for each active axis group. It calculates the remaining prediction time for the axis group from the current moment to the completion of the natural segment using kinematic formulas. During the calculation, the current stage of the axle group is first determined based on the relationship between the current actual speed and the maximum speed: If the current actual speed is less than the maximum speed and the acceleration is positive, the axle group is in the acceleration stage. In this case, the remaining acceleration pulse count is the difference between the square of the maximum speed and the square of the current actual speed, divided by twice the acceleration. The remaining constant-speed pulse count equals the total number of pulses in the segment minus the number of pulses already emitted, the remaining acceleration pulse count, and the deceleration pulse count. The predicted remaining time equals the time required to accelerate from the current actual speed to the maximum speed plus the time spent in the constant-speed segment plus the time required to decelerate from the maximum speed to zero. If the current actual speed equals the maximum speed, the axle group is in the constant-speed stage, and the predicted remaining time equals the remaining constant-speed pulse count divided by the maximum speed plus the maximum speed divided by the deceleration. If the current actual speed is less than the maximum speed and the acceleration is negative, the axle group is in the deceleration stage, and the predicted remaining time equals the current actual speed divided by the deceleration. The maximum predicted remaining time among all active axle groups is taken as the predicted remaining time for the axle group, ensuring that the selection of the coordination safety point considers the axle group that completes the movement segment last. When the predicted remaining duration of the axis group exceeds the maximum segment waiting time represented by the synchronization period, the segment prediction and early termination module sends an axis group-level online endpoint change command to the motion control driver, causing the corresponding motion control axis group to decelerate to zero along the current motion direction according to the safety deceleration and reach the new segment endpoint. There is a command response time and a motion execution time between the command being issued by the software and the motion control card completing its execution: the command response time is determined by the call return delay of the motion control SDK; the motion execution time is equal to the current actual speed divided by the safety deceleration, constrained within the maximum segment waiting time by the safety deceleration parameter. When the motion control card executes the online endpoint change command, it synchronously transitions each axis within the axis group to the new segment endpoint according to the interpolation relationship. Upon reaching the new segment endpoint, an axis group segment completion interrupt is triggered, and the interrupt signal enters the interrupt handling context of the virtual machine monitor. The segment prediction and early termination module records the early termination compensation deviation between the original segment target position and the new segment endpoint. The safety point calculation module compares the predicted remaining duration of the axis group with the candidate synchronization time sequence one by one and selects the coordinated safety point.The search logic is as follows: For each candidate time in the candidate synchronization time sequence, it is determined sequentially whether the candidate time simultaneously meets two conditions: it is no earlier than the sum of the current time and the predicted remaining duration of the axis group, and the interval from the current time to the candidate time does not exceed the maximum segment waiting time. The first time that both conditions are met simultaneously is the coordination safe point. If there is no candidate synchronization time that meets the conditions, the migration preparation is canceled. If the segment completion time corresponding to the predicted remaining duration of the axis group is located between two adjacent candidate synchronization times, the migration loop processing is performed on the intermediate EtherCAT loop: the EtherCAT master station continues to send EtherCAT frames containing a copy of the process data from the previous loop in this loop, or keeps the process data valid but the output value unchanged so that the slave station watchdog timer is refreshed; the slave station keeps the output latch value from the previous loop in this loop. When the migration trigger signal arrives, the migration barrier execution module sequentially performs four operations within the same interrupt handling context: First, it freezes the EtherCAT master station process data writing and stops updating output data to slave stations; second, it confirms that each motion control axis group is in the segment completion state and reads the actual position and segment completion status flag of each axis; then, it stops the frame transmission and reception of the corresponding CAN controller, caches the corresponding frame header and data field of CAN frames in the transmission queue that have not yet been submitted to the CAN controller for physical transmission and marks them as pending retry, and freezes the transmission queue for nodes that do not have the above-mentioned pending retry frames; finally, it caches the current output value of digital I / O and writes the current value of each output point to the shadow register bitmap. The four operations are executed sequentially in the same interrupt context, and the total time overhead is the sum of the register read / write time and memory cache time of each operation, with a typical value in the microsecond range, which is much smaller than one EtherCAT distributed clock cycle, thus meeting the atomicity requirement of the migration barrier. The timing metadata recording module records the migration trigger signal type (SYNC0 or segment completion interrupt), EtherCAT cycle number, motion segment number of the motion control axis group, position values ​​of each axis, early termination compensation deviation, and CAN pending frame identifier. This recorded information is encoded as protocol timing metadata into a platform-independent state packet. The protocol timing metadata is used for timing compensation during target-side recovery: the target side determines the recovery timing of the slave output based on the EtherCAT cycle number, generates compensation motion segment commands based on the motion segment number of the motion control axis group and the early termination compensation deviation, and performs retry operations on frames marked as pending retry based on the CAN pending frame identifier.

[0040] In some embodiments of this application, the state reconstruction module includes an execution mechanism determination module, a virtual machine reconstruction module, a device proxy channel module, a protocol conversion module, and a compensation motion module. The execution mechanism determination module selects the execution mode of the RISC-V client instructions, the virtual machine reconstruction module restores the virtual machine's running state, the device proxy channel module and the protocol conversion module are responsible for forwarding device requests between the target and source I / O proxy services, and the compensation motion module is used to generate corresponding compensation motion segments when there is an early termination compensation deviation.

[0041] Specifically, the execution mechanism determines the execution mode of the RISC-V guest instructions based on the target instruction set execution capabilities exchanged by the migration negotiation module, using either instruction set emulation or dynamic binary translation. Taking the QEMUTCG mechanism as an example, RISC-V guest instructions are first divided into basic blocks, each ending with a control transfer instruction. The TCG front-end translates the RISC-V instructions into a platform-independent TCG intermediate representation, and the TCG back-end compiles this intermediate representation into target host instructions (x86-64 or ARMv8 instructions). The generated host instruction blocks are stored in a translation cache, indexed by the guest program counter. Subsequent execution of the same guest code directly hits the cache, avoiding duplicate translations. The translation cache is maintained using a least recently used (LRU) eviction policy. When cache usage exceeds a preset threshold, the least recently used (LRU) guest instruction block is evicted first to control target memory usage. The virtual machine refactoring module performs state recovery on the target side. The recovery sequence is as follows: First, it loads the memory consistency snapshot from the platform-independent state packet into the guest physical memory region allocated by the target virtual machine monitor, establishing guest page table mappings. Then, it restores the values ​​of general-purpose registers, floating-point registers, program counters, and CSR registers for each vCPU, and restores the virtual timer, virtual interrupt controller, and time offset states, restoring the vCPU to its execution context at the migration critical point. Subsequently, it initializes the virtio device queue, writing the queue index, enable bit, and feature negotiation results from the device logic layer into the target virtio device model, ensuring the device logic state is consistent with before the migration. After completing these operations, the virtual machine refactoring module interfaces with the target device shadow agent. The initialization interface process is as follows: the target device shadow agent sends a session establishment request to the source I / O agent service. Both parties exchange protocol version numbers and device capability information. After confirming the target's identity, the source I / O agent service returns a session identifier. The target device shadow agent records this session identifier, and all subsequent forwarding requests carry this identifier for identification and authentication by the source I / O agent service. In the message format of the forwarding channel, the protocol semantic operation instruction consists of four fields: operation type, object dictionary index / sub-index, data, and transaction ID. The operation type identifies whether it is a read or write operation, the object dictionary index / sub-index identifies the target object, the data field carries the written value or read result, and the transaction ID is used to track the correspondence between requests and responses. For raw CAN operations, the message format consists of operation type, CANID, data length code, data field, and transaction ID. The operation type identifies whether it is a send or receive operation, and the data length code indicates the number of valid bytes in the data field. After receiving the operation instruction, the source I / O agent service executes the corresponding physical device operation and encapsulates the execution result into a response message with the same transaction ID, sending it back to the target end. The protocol conversion module intercepts I / O requests sent by the client and converts the request into the corresponding protocol semantic operation instruction according to the CAN protocol type exchanged during the migration negotiation phase.For CANopen type requests, the protocol conversion module converts the client's read / write requests to the object dictionary into object dictionary index / sub-index operation instructions. For raw CAN type requests, the protocol conversion module converts the client's frame transmission requests to the CAN controller into CANID, data length code, and data field operation instructions. After conversion, the protocol conversion module sends the operation instructions to the source I / O agent service via the forwarding channel for execution and waits for the source I / O agent service to return a response message carrying the same transaction ID. The motion compensation module reads the early termination compensation deviation value of each axis group from the motion control segment compensation segment of the status packet. The motion control logic within the virtual machine reconstructs the speed curve based on the compensation deviation. The reconstruction process is as follows: the early termination position is used as the starting point of the compensation segment, and the original segment target position is used as the ending point of the compensation segment. The speed curve of the compensation segment is derived from the parameters of the original segment, with the initial velocity being zero and the final velocity being zero. The maximum velocity, acceleration, and deceleration follow the corresponding parameters in the original segment speed curve. The total number of pulses in the compensation segment is equal to the absolute value of the early termination compensation deviation. The motion control logic generates compensation motion segment commands and submits them for execution, causing the axis group to move from the early termination position to the original target position.

[0042] In some embodiments of this application, the status packet transmission module includes a byte order conversion module, a time slot reservation module, a status packet encapsulation module, and a transmission confirmation module, which are respectively used for byte order conversion of structured status fields, transmission time slot reservation, status packet encapsulation, transmission confirmation, and retransmission processing.

[0043] Specifically, the byte order conversion module performs byte order conversion on the structured state field in the protocol semantic state data based on the byte order information exchanged during the migration negotiation phase using platform characteristics. When the byte order of the source edge controller using a RISC-V architecture differs from that of the target debugging terminal using an x86 or ARM architecture, the byte order of multi-byte data in the structured state field needs to be adjusted accordingly. Taking the conversion from big-endian to little-endian as an example, a 32-bit integer 0x12345678 is stored in big-endian memory as 0x12, 0x34, 0x56, 0x78. After conversion, its storage order in little-endian memory is 0x78, 0x56, 0x34, 0x12. The conversion rule is to reverse the original byte sequence byte by byte. For floating-point data, the byte order conversion module serializes it according to the IEEE 754 standard: taking a double-precision floating-point number as an example, its 64 binary bits consist of 1 sign bit, 11 exponent bits, and 52 mantissa bits. During serialization, the sign bit, exponent bit, and mantissa bit are split bit by bit and reassembled into the target byte order, keeping the value unchanged. After completing the byte order conversion and floating-point serialization, platform-independent encoded data is obtained. The CPU / memory snapshot is migrated according to the original byte order and does not perform byte order conversion. The time slot reservation module calculates the reservation start time and duration of the protection band time slot based on the time of the coordinated security point and sends a time slot reservation request to the TSN switch. After receiving the reservation request, the TSN switch checks the scheduling table of its time-aware shaper for conflicts between the requested time slot and existing time slots. If the requested time slot does not overlap with an existing time slot, it returns a reservation confirmation message and reserves the time slot; if there is a conflict, it returns a rejection message carrying an optional offset time, and the time slot reservation module adjusts the reservation start time and re-initiates the request. The relationship between the reservation start time and the coordinated safety point is derived as follows: The coordinated safety point is the moment when the migration barrier and vCPU freeze are triggered. The state packet is sent after the corresponding state acquisition and encapsulation are completed. Therefore, the reservation start time is no earlier than the coordinated safety point time. Simultaneously, state packet encapsulation requires a certain processing time. The actual reservation start time is the coordinated safety point time plus the nearest available time slot boundary after the state packet encapsulation time. The duration is calculated by dividing the total number of bytes of platform-independent encoded data by the TSN network bandwidth, reserving for inter-frame gaps and preamble overhead. The state packet encapsulation module encapsulates the platform-independent encoded data into platform-independent state packets. During encapsulation, a state packet type identifier, sequence number, total length, and checksum field are added to the data header, and an end identifier is added to the data tail. After encapsulation, the platform-independent state packet is sent to the target end via the TSN network within the reserved guard band time slot. During transmission, a priority field is set in the VLAN tag of the Ethernet frame, enabling the TSN switch to recognize the frame as a migration state packet and prioritize forwarding it within the reserved time slot. The transmission confirmation module listens for the reception confirmation message returned by the target end after transmission.The format of the received acknowledgment message (ACK packet) is as follows: the sequence number field records the sequence number of the platform-independent status packet being acknowledged, the timestamp field records the time when the target end completes reception, and the checksum field is used to verify the integrity of the ACK packet. If an ACK packet is received within the predetermined acknowledgment waiting time and the checksum verification passes, the transmission is complete; if the acknowledgment waiting time expires without an ACK packet or the checksum verification fails, the transmission acknowledgment module retransmits the platform-independent status packet in the next guard band time slot, using the original sequence number during retransmission so that the target end can identify the duplicate packet and discard the received copy.

[0044] In some embodiments of this application, the motion segment of the motion control axis group adopts a trapezoidal velocity curve. The current stage of the axis group is determined based on the relationship between the current actual velocity and the maximum velocity, as well as the signed acceleration along the current motion direction. Under the condition that the velocity, acceleration, and deceleration used for kinematic formula calculations are all of magnitude and the remaining uniform velocity pulse count is not less than zero, the remaining predicted duration of the natural segment of the axis group is calculated as follows: When the current actual speed is less than the maximum speed and the acceleration phase is under the following conditions

[0045]

[0046]

[0047]

[0048] Assuming the current actual speed equals the maximum speed and the speed is constant.

[0049]

[0050] When the current actual speed is less than the maximum speed and the vehicle is in the deceleration phase

[0051] in, To predict the remaining duration for each natural segment, This represents the remaining number of constant-speed pulses, i.e., the number of pulses that need to be sent at maximum speed after acceleration is complete. The remaining acceleration pulse count, i.e., the number of pulses required to accelerate from the current actual speed to the maximum speed. This refers to the number of pulses required for the deceleration phase, i.e., the number of pulses needed to decelerate from maximum speed to zero. This represents the maximum speed in the current segment of the speed curve for this shaft group. To retrieve the current actual speed of this shaft group, This refers to the acceleration in the velocity curve of the current segment of the shaft assembly. This refers to the deceleration in the current segment of the velocity curve of this shaft assembly. This represents the total number of pulses in the current segment of the axis group. This represents the number of pulses that have been sent within the current segment of this axis group.

[0052] Specifically, in the calculation of the remaining time prediction for the completion of a natural segment of the motion control axis group, the current stage of the axis group is first determined based on the relationship between the current actual speed and the maximum speed. The determination criteria are as follows: if the current actual speed is less than the maximum speed and the acceleration in the speed curve is positive, then the axis group is in the acceleration stage; if the current actual speed is equal to the maximum speed, then the axis group is in the uniform speed stage; if the current actual speed is less than the maximum speed and the acceleration in the speed curve is negative, then the axis group is in the deceleration stage. The acceleration used to determine the motion stage is the signed acceleration along the current motion direction, with positive values ​​indicating acceleration and negative values ​​indicating deceleration. The acceleration and deceleration used for kinematic formula calculations are both taken as their magnitude values. Of the parameters required for the above judgment, the total number of pulses per segment is read from the axis group segment parameter register driven by the motion control, which is written by hardware when the motion control card receives a new segment command; the number of pulses sent is read from the axis group pulse count register, which is accumulated and updated in real time by the motion control card during pulse output; the current actual speed is read from the axis group speed feedback register, which is refreshed by the motion control card in each control cycle based on encoder feedback or pulse count calculation; acceleration and deceleration are read from the axis group speed curve parameter register group, which is written by the motion control SDK when the segment command is issued. During the acceleration phase, the formula for predicting the remaining time of a natural segment is derived based on the kinematic relationship between velocity and displacement. The time required to accelerate from the current actual speed to the maximum speed is the difference between the maximum speed and the current actual speed divided by the acceleration. The number of pulses required to accelerate from the current actual speed to the maximum speed, according to the velocity square difference formula, is equal to the difference between the square of the maximum speed and the square of the current actual speed divided by twice the acceleration. The number of pulses in the deceleration phase, according to the velocity square formula, is equal to the square of the maximum speed divided by twice the deceleration. The remaining number of constant-speed pulses is obtained by subtracting the number of pulses already emitted, the remaining number of acceleration pulses, and the number of pulses in the deceleration phase from the total number of pulses in the segment. The duration of the constant-speed phase is the remaining number of constant-speed pulses divided by the maximum speed, and the duration of the deceleration phase is the maximum speed divided by the deceleration. The sum of the acceleration phase time, the constant-speed phase time, and the deceleration phase time is the predicted remaining time for the completion of the natural segment in the acceleration phase. In the constant-speed phase, the current speed of the shaft assembly is equal to the maximum speed, and the acceleration process is complete. Therefore, the predicted remaining time for the completion of the natural segment consists of two parts: the duration of the constant-speed phase and the duration of the deceleration phase. The remaining number of pulses in the constant-speed phase is equal to the total number of pulses in the segment minus the number of pulses already emitted and the number of pulses in the deceleration phase. The duration of the constant-speed phase is the remaining number of pulses divided by the maximum speed, and the duration of the deceleration phase is the maximum speed divided by the deceleration. The sum of these two is the predicted remaining time for the completion of the natural segment in the constant-speed phase. In the deceleration phase, the shaft assembly has entered the deceleration process, and the remaining motion only includes the deceleration phase. The predicted remaining time for the completion of the natural segment is directly equal to the current actual speed divided by the deceleration.After each active axis group calculates the predicted remaining time for the completion of the natural segment in the above manner, the maximum value of the predicted remaining time of all active axis groups is taken as the predicted remaining time of the axis group. The current time is added to the predicted remaining time of the axis group to obtain the predicted time for the completion of the natural segment of the axis group. The rationale is that the coordination safety point can only be established after all axis groups have reached the segment completion state. If any axis group is still in the middle of the segment when the migration is triggered, the speed curve state of the axis group cannot be accurately described. Therefore, the axis group that completes the segment the latest is taken as the boundary of the overall transaction.

[0053] In some embodiments of this application, the motion segment of the motion control axis group is a linear interpolation motion segment. When the axis group-level online variable endpoint command is executed, the motion control card synchronously transitions each axis in the axis group to the new segment endpoint according to the interpolation relationship, keeping the relative trajectory shape between axes unchanged, and triggering the axis group segment completion interruption when the new segment endpoint is reached.

[0054] Specifically, in motion control, inter-axis interpolation refers to the coupling constraint between the positions of each axis during multi-axis linkage. In linear interpolation, the ratio of the displacement of each axis from its starting point to its ending point remains constant, meaning that each axis advances synchronously at the same ratio, making the composite motion trajectory a straight line in space. When the axis group-level online endpoint change command is executed, the motion control card modifies the target position of each axis while maintaining the above interpolation ratio: the motion control card first calculates the target position of each axis at the early termination time based on the current interpolation type and trajectory parameters of the axis group. The ratio of the displacement between the new target positions of each axis is consistent with the ratio of the displacement between the original endpoints, ensuring that the motion trajectory after early termination still contracts along the original trajectory direction without changing the trajectory shape. Simultaneously, the motion control card synchronously modifies the velocity curve parameters of each axis, so that each axis still moves along the interpolation trajectory at the same composite velocity, and the motion timing between each axis maintains the original coupling relationship.

[0055] The trigger condition for a segment completion interruption is that all axes simultaneously reach the new segment endpoint. The motion control card maintains a segment completion detector for the axis group. This detector compares the remaining pulse counts of each axis in each control cycle. When it detects that all axes have zero remaining pulses and the deviation of each axis's actual position from the new segment endpoint position is less than the preset position tolerance, the axis group segment completion condition is determined to be met. When this condition is met, the motion control card sets the axis group segment completion interruption request line, sends an interrupt signal to the main controller, and the interrupt service routine then enters the interrupt handling context of the virtual machine monitor for execution. The time point at which the interrupt is triggered is the occurrence time of the axis group segment completion interruption, which is subsequently used by the safety point calculation module as the protocol safety boundary signal for motion control.

[0056] In some embodiments of this application, the vCPU freeze module causes each vCPU to enter a paused state through the vCPU pause interface of the RISC-V virtual machine monitor, and records the values ​​of the program counter, general-purpose registers, floating-point registers and control status registers. The vCPU pause interface is a virtual interrupt injection interface or a direct vCPU stop interface provided by the virtual machine monitor.

[0057] Specifically, after the migration barrier execution module completes the protocol state freeze, the vCPU freeze module causes each vCPU to enter a suspended state through the vCPU pause interface of the RISC-V virtual machine monitor. In one embodiment, the vCPU pause interface is a virtual interrupt injection interface provided by the virtual machine monitor, which injects a pause request to the guest, causing the guest to enter a virtual interrupt service routine and actively pause within it. In another embodiment, the vCPU pause interface is a direct vCPU stop interface provided by the virtual machine monitor, which directly causes the vCPU to enter a suspended state without going through the guest interrupt service routine. After each vCPU is paused, the vCPU freeze module records the values ​​of the program counter, general-purpose registers, floating-point registers, and control status registers of each vCPU, forming a CPU state snapshot, which is then used by the subsequent snapshot acquisition module to merge with the memory state at the time of freeze.

[0058] In some embodiments of this application, when an EtherCAT loop is marked as a migration loop, the slave corresponding to the EtherCAT loop retains the output value of the previous loop in the migration loop.

[0059] Specifically, the EtherCAT slave chip has an internal output latch located at the process data interface of the slave controller. During normal cyclic communication, the master station sends process data frames carrying new output data in each cycle. The slave controller writes the output data into the latch upon frame arrival, and the latch then drives the physical output pin. When a cycle is marked as a transition cycle, the EtherCAT master station continues to send process data frames according to the corresponding communication cycle, maintaining the output process data of the corresponding slave station at the output value of the previous cycle. For EtherCAT slave stations configured with a process data communication watchdog, the watchdog state is maintained by continuing to execute valid process data accesses that meet their configuration requirements. The watchdog timeout and reset conditions are determined by the specific slave station's configuration, and the processing of transition cycles should meet the watchdog operation requirements of the corresponding slave station. The number of transition cycles skipped is limited to one DC cycle, meaning a maximum of one EtherCAT cycle can be skipped.

[0060] In some embodiments of this application, the original segment is a linear interpolation motion segment, and the system processes the early termination compensation deviation in the following manner: For each active axis group, calculate the difference between the original target position and the early termination position to obtain the early termination compensation deviation. The early termination position is the new target position after modification by the axis group-level online variable endpoint command. The early termination compensation deviation of each axis group is encoded into the motion control segment compensation segment of the platform-independent state package on a unit basis. After the RISC-V virtual machine on the target debugging terminal recovers, the motion control logic within the virtual machine reads the motion control segment compensation segment, generates a linear compensation motion segment command with the early termination position as the starting point, the original segment target position as the ending point, and the velocity curve derived from the original segment parameters, and submits it for execution.

[0061] Specifically, after the online variable endpoint command is executed at the axis group level, the calculation of the early termination position is based on the kinematic relationship between velocity and displacement. When the motion control axis group moves at the current actual speed and needs to decelerate to zero according to the safety deceleration formula, the displacement traversed from the current speed to zero is equal to the square of the current actual speed divided by twice the safety deceleration, according to the velocity square difference formula. The new segment endpoint position is determined in conjunction with the current motion direction: for linear interpolation motion segments, the deceleration distance is mapped to the original interpolation trajectory based on the motion direction of the original linear interpolation trajectory to determine the new target position for each motion axis, so that each motion axis decelerates synchronously along the original interpolation trajectory to the new segment endpoint. The original segment target position is the natural segment endpoint predetermined for the axis group in the original segment command, and the early termination position is the new segment endpoint modified by the online variable endpoint command. The difference between the two is the early termination compensation deviation. A positive deviation indicates that the axis group stops prematurely at a position before the original endpoint, and the supplementary segment needs to continue moving forward; a negative deviation indicates that the early termination position exceeds the original endpoint, and the supplementary segment needs to move in the opposite direction. After recovery at the target end, the motion control logic within the virtual machine reconstructs the velocity curve of the compensation segment based on the early termination compensation deviation. For linear interpolation motion segments, the compensation segment starts at the early termination position and ends at the original segment's target position. The axis group velocity is zero at the start and end of the compensation segment. The maximum velocity and acceleration use the corresponding parameters from the original segment's velocity curve, and the deceleration uses the original segment's deceleration parameters. The total number of pulses in the compensation segment equals the absolute value of the early termination compensation deviation. After the compensation segment is completed, the axis group reaches the original segment's target position with zero velocity. The motion control logic then submits the motion command for the next segment of the axis group in the original motion program. The next segment starts at the original segment's target position and ends at the next segment's end point in the original motion program. The velocity curve parameters are defined by the original motion program. No additional transition segment needs to be inserted between the compensation segment and the next segment, and the axis group motion task remains complete before and after the migration.

[0062] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A cross-platform RISC-V virtual machine seamless transfer system, characterized in that, The system includes a source-end edge controller, a target-end debugging terminal, and a transmission network connecting the source-end edge controller and the target-end debugging terminal. The source-end edge controller runs a RISC-V virtual machine that carries industrial control tasks and manages EtherCAT devices, CAN devices, digital I / O devices, and motion control axis groups through an I / O agent service. The system also includes: The migration negotiation module is used to establish a migration channel between the source edge controller and the target debugging terminal. After exchanging at least the virtual machine configuration, platform characteristics, EtherCAT master station capabilities, motion controller capabilities, target instruction set execution capabilities, and CAN protocol type between the source edge controller and the target debugging terminal, it determines the platform-independent state encoding format. The state decoupling module is used to decouple the state of the source virtual machine into a CPU / memory layer, a device logic layer, and a protocol I / O proxy layer. The protocol I / O proxy layer records the EtherCAT process data image, object dictionary, motion segment state of motion control axis group, CAN frame state, and digital I / O shadow register value. The incremental synchronization module is used to perform dirty page tracking on the source memory pages, incrementally synchronize the initial memory snapshot, device logical state and protocol transaction log to the target end, and request protection band time slots from the TSN switch for status packet transmission. The critical point alignment module is used to enable the source edge controller to enter the migration preparation state and prevent new I / O transactions from being committed. It performs protocol-level transaction boundary alignment based on EtherCAT distributed clock synchronization interrupt and motion segment completion interrupt of motion control axis group. It freezes vCPU at the determined coordination safety point, collects CPU register, memory consistency snapshot and protocol I / O proxy layer transaction log, encodes them into platform-independent state packets, and sends the final dirty page and the platform-independent state packets to the target debugging terminal through the guard band time slot. The state reconstruction module is used to enable the target debugging terminal to reconstruct the RISC-V virtual machine instance according to the platform-independent state packet, execute RISC-V client instructions through instruction set simulation or dynamic binary translation, establish a forwarding channel with the source I / O proxy service, convert client I / O requests into protocol semantic operation instructions and send them to the source for execution, and generate compensation motion segment commands according to the early termination compensation deviation in the platform-independent state packet. The migration completion module is used to enable the target debugging terminal to resume vCPU execution. After the forwarding channel is confirmed to be available, it notifies the source edge controller to release virtual machine memory and vCPU resources. The source edge controller retains the I / O proxy service to continue managing physical devices until the reverse migration.

2. The cross-platform RISC-V virtual machine seamless transfer system according to claim 1, characterized in that, The critical point alignment module includes: The migration preparation module is used to prevent new I / O transactions from being committed, add subsequent I / O requests to the queue to be committed, and record the EtherCAT process data image, the motion segment status of the motion control axis group, the CAN frame status, and the digital I / O shadow register value. The boundary alignment module is used to read the EtherCAT distributed clock configuration, obtain the candidate SYNC0 time sequence with a SYNC0 synchronization cycle interval, calculate the remaining time of natural segment completion prediction for the motion control axis group, and when the remaining time of natural segment completion prediction exceeds the predetermined maximum segment waiting time, send an online change endpoint command to the motion control drive, so that the corresponding motion control axis group decelerates to zero along the current motion direction according to the preset safety deceleration and reaches the new segment endpoint, triggering the segment completion interruption, obtaining the segment completion prediction time, and comparing the segment completion prediction time with the candidate SYNC0 time sequence to select the coordination safety point; The vCPU freeze module is used to put each vCPU into a pause state through the vCPU pause interface of the RISC-V virtual machine monitor on the source edge controller when the coordinated safety point is reached, and to record the values ​​of the program counter, general-purpose register, floating-point register and control status register. The snapshot acquisition module is used to acquire snapshots of the register status and memory consistency of each vCPU after the vCPU is frozen, and to merge the memory consistency snapshot with the frozen snapshot of the protocol I / O proxy layer into a set of states to be encoded. The semantic encoding module is used to encode the EtherCAT process data in the state set to be encoded according to the process data image, encode the CANopen request according to the object dictionary index / sub-index pair, encode the raw CAN request according to CANID, data length code and data field, encode the digital I / O shadow register value as peripheral status segment, and mark the pending transaction as pending retry status to obtain protocol semantic status data. The status packet transmission module is used to encode the protocol semantic state data and CPU / memory snapshot into a platform-independent status packet, reserve a protection band time slot with the TSN switch according to the coordinated security point, and send the platform-independent status packet to the target end within the protection band time slot.

3. The cross-platform RISC-V virtual machine seamless transfer system according to claim 2, characterized in that, The boundary alignment module includes: The distributed clock timing calculation module is used to obtain the SYNC0 synchronization period and current phase from the distributed clock configuration and running clock information of the EtherCAT master station, and generate the candidate SYNC0 timing sequence at intervals of one SYNC0 synchronization period. The segment prediction and early termination module is used to obtain the current segment number, total number of segment pulses, number of pulses sent, current actual speed, acceleration, deceleration, and safe deceleration of each active motion control axis group. It calculates the predicted remaining time for each active motion control axis group from the current moment until the completion of the natural segment, and takes the maximum value as the axis group's predicted remaining time. When the predicted remaining time of the axis group exceeds the maximum segment waiting time represented by the SYNC0 synchronization cycle, it calculates the deceleration time required to decelerate to zero based on the current actual speed and safe deceleration. If the sum of the deceleration time and the command response time does not exceed the maximum segment waiting time, it sends an axis group-level online endpoint change command to the motion control drive, causing the corresponding motion control axis group to decelerate to zero along the current motion direction according to the safe deceleration and reach the new segment endpoint. It records the early termination compensation deviation between the original segment target position and the new segment endpoint and updates the axis group's predicted remaining time. If the sum of the deceleration time and the command response time exceeds the maximum segment waiting time, the migration preparation is canceled. The safety point calculation module is used to select the first candidate synchronization time from the candidate SYNC0 time sequence that simultaneously satisfies the condition of being no earlier than the sum of the current time and the predicted remaining time of the axis group, and that the interval from the current time to the candidate synchronization time does not exceed the maximum segment waiting time, as the migration trigger time; if there is no candidate synchronization time that meets the conditions, the migration preparation is canceled. The timing metadata recording module is used to record the migration trigger time, EtherCAT loop number, motion segment number of motion control axis group, position value of each axis, early termination compensation deviation and CAN pending frame identifier, and encode the recording results into the platform-independent status packet.

4. The cross-platform RISC-V virtual machine seamless transfer system according to claim 1, characterized in that, The state reconstruction module includes: The execution mechanism determination module is used to select instruction set simulation or dynamic binary translation as the execution mode of RISC-V guest instructions based on the target instruction set execution capability exchanged by the migration negotiation module. The virtual machine reconstruction module is used to write the CPU register values, memory consistency snapshots and device logical states in the platform-independent state packet into the target virtual machine monitor to build a RISC-V virtual machine instance. The device proxy channel module is used to establish a forwarding channel between the target device shadow proxy and the source I / O proxy service. The forwarding channel can reuse the migration channel or be established independently. The protocol conversion module intercepts I / O requests from the client and converts the requests into corresponding protocol semantic operation instructions based on the CAN protocol type exchanged by the migration negotiation module. Specifically, CANopen type is converted into object dictionary index / sub-index operation instructions, and raw CAN type is converted into CANID, data length code, and data field operation instructions. The protocol semantic operation instructions are then sent to the source end for execution via the forwarding channel. The protocol semantic operation instructions and the corresponding response messages contain the same transaction identifier. The target device shadow agent matches the request and response based on the transaction identifier. The compensation motion module is used to read the early termination compensation deviation recorded in the motion control segment compensation segment of the status packet, obtain the early termination compensation deviation of each axis group, generate compensation motion segment commands from the motion control logic in the virtual machine that resumes operation at the target end, and submit them for execution, so that the axis group moves from the new segment end point to the original segment target position.

5. The cross-platform RISC-V virtual machine seamless transfer system according to claim 2, characterized in that, The status packet transmission module includes: The byte order conversion module is used to perform byte order conversion on the structured state fields in the protocol semantic state data according to the byte order information in the platform characteristics exchanged by the migration negotiation module, and serialize the floating-point data according to the IEEE 754 standard to obtain platform-independent encoded data; the CPU / memory snapshot is migrated according to the original byte sequence and no byte order conversion is performed; The time slot reservation module is used to calculate the reservation start time and duration of the protection band time slot based on the time of the coordinated security point, and send a time slot reservation request to the TSN switch. The reservation start time is not earlier than the time of the coordinated security point, and the duration is determined based on the amount of data of the platform-independent encoded data. The status packet encapsulation module is used to encapsulate the platform-independent encoded data into a platform-independent status packet according to the version number, data segment type, data segment length and data segment content, write the serial number, total length and verification information into the platform-independent status packet, and send the platform-independent status packet to the target debugging terminal via the TSN network within the scheduled guard band time slot. The transmission confirmation module is used to listen for the reception confirmation message returned by the target debugging terminal after the transmission is completed. If the reception confirmation message is not received within the predetermined confirmation waiting time, the platform-independent status packet is retransmitted in the next guard band time slot. The retransmission of the platform-independent status packet uses the original sequence number. The target debugging terminal identifies and discards the duplicate status packet according to the sequence number.

6. The cross-platform RISC-V virtual machine seamless transfer system according to claim 3, characterized in that, The motion segment of the motion control axis group adopts a trapezoidal velocity curve. Based on the relationship between the current actual velocity and the maximum velocity, as well as the signed acceleration along the current motion direction, the current stage of the axis group is determined. Under the conditions that the velocity, acceleration, and deceleration used for kinematic formula calculations are all taken as magnitudes and the remaining uniform velocity pulse number is not less than zero, the remaining predicted duration of the natural segment of the axis group is calculated as follows: When the current actual speed is less than the maximum speed and the acceleration phase is under the following conditions Assuming the current actual speed equals the maximum speed and the speed is constant. When the current actual speed is less than the maximum speed and the vehicle is in the deceleration phase in, To predict the remaining duration for each natural segment, This represents the remaining number of constant-speed pulses, i.e., the number of pulses that need to be sent at maximum speed after acceleration is complete. The remaining acceleration pulse count, i.e., the number of pulses required to accelerate from the current actual speed to the maximum speed. This refers to the number of pulses required for the deceleration phase, i.e., the number of pulses needed to decelerate from maximum speed to zero. This represents the maximum speed in the current segment of the speed curve for this shaft group. To retrieve the current actual speed of this shaft group, This refers to the acceleration in the velocity curve of the current segment of the shaft assembly. This refers to the deceleration in the current segment of the velocity curve of this shaft assembly. This represents the total number of pulses in the current segment of the axis group. This represents the number of pulses that have been sent within the current segment of this axis group.

7. The cross-platform RISC-V virtual machine seamless transfer system according to claim 3, characterized in that, The motion segment of the motion control axis group is a linear interpolation motion segment. When the axis group-level online variable endpoint command is executed, the motion control card synchronously transitions each axis in the axis group to the new segment endpoint according to the interpolation relationship, keeping the relative trajectory shape between axes unchanged, and triggering the axis group segment completion interruption when reaching the new segment endpoint.

8. The cross-platform RISC-V virtual machine seamless transfer system according to claim 2, characterized in that, The vCPU freeze module puts each vCPU into a pause state through the vCPU pause interface of the RISC-V virtual machine monitor on the source edge controller, and records the values ​​of the program counter, general-purpose registers, floating-point registers and control status registers. The vCPU pause interface is either a virtual interrupt injection interface provided by the virtual machine monitor or a direct vCPU stop interface.

9. The cross-platform RISC-V virtual machine seamless transfer system according to claim 3, characterized in that, When an EtherCAT loop is marked as a migration loop, the slave corresponding to the EtherCAT loop retains the output value of the previous loop in that migration loop.

10. The cross-platform RISC-V virtual machine seamless transfer system according to claim 3, characterized in that, The original segment is a linear interpolation motion segment, and the system handles the early termination compensation deviation in the following manner: For each active axis group, calculate the difference between the original target position and the early termination position to obtain the early termination compensation deviation. The early termination position is the new target position after modification by the axis group-level online variable endpoint command. The early termination compensation deviation of each axis group is encoded into the motion control segment compensation segment of the platform-independent state package on a unit basis. After the RISC-V virtual machine on the target debugging terminal recovers, the motion control logic within the virtual machine reads the motion control segment compensation segment, generates a linear compensation motion segment command with the early termination position as the starting point, the original segment target position as the ending point, and the velocity curve derived from the original segment parameters, and submits it for execution.