Data acquisition method and device based on Sel4 microkernel and medium
Through the Sel4 microkernel and rust language combined with modbus and mqtt communication link, the security and efficiency problems of the data acquisition system are solved, and high security and reliability data acquisition is achieved, ensuring the security and real-time nature of data transmission. Suitable for industrial equipment data collection in the field of intelligent manufacturing.
Patent Information
- Application Number
- CN202411440963.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-01-10
AI Technical Summary
The existing data acquisition system has problems in terms of security and efficiency. The code in the macro kernel runs in the kernel space, which can easily lead to system crashes or security vulnerabilities. The memory problems in C language lead to security problems during data transmission, and the cloud platform and The communication and real-time processing requirements between devices are not fully met.
Adopt the security architecture of Sel4 microkernel and rust language, combining modbus and mqtt communication links, and establishing data collection in a secure memory language through hardware initialization, kernel deployment, network card driver and network protocol stack implementation, and parallel execution of modbus and mqtt communication protocols. Method, SSL encryption and hashing algorithms are used to ensure the security and integrity of data transmission.
Achieve a high-security and reliability data acquisition system, avoid memory management problems, improve system stability and performance, ensure the security and real-time nature of data transmission, support multi-core concurrency and error handling, and reduce memory-related Security breach risk.
Smart Images

Figure CN119293759A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security, and in particular to a data acquisition method, device and medium based on a sel4 microkernel. Background Art
[0002] Modern industry is developing towards intelligence and interconnection. Realizing intelligent management and control of production equipment is of great significance for the further upgrading of modern industry. Especially in the field of intelligent manufacturing, a large number of industrial equipment need to collect and process a large amount of data in real time and efficiently to achieve automated decision-making and optimize production processes. Therefore, a safe and efficient data acquisition system is of great research significance.
[0003] At present, most common data acquisition systems use traditional macro kernel systems and C language programming. Although mature, there are still many barriers. Security cannot be well solved. All codes in the macro kernel run in the kernel space. Errors in any module may cause the entire system to crash or security vulnerabilities. In addition, there are many memory problems in C language, which makes the data transmission process encounter many security issues, such as memory security and network attacks, which affect the entire collection task. Message communication and real-time processing between the cloud platform and the device is also a major demand of users. Summary of the invention
[0004] In view of the problems existing in the prior art, the purpose of the present invention is to utilize the SEL4 microkernel and the unique security architecture of RUST, combined with MODBUS and MQTT communication links, to provide a data acquisition method, device and medium based on the SEL4 microkernel, which overcomes some common security problems and acquisition efficiency problems encountered by data acquisition systems.
[0005] To achieve the above object, the technical solution adopted by the present invention is: a data acquisition method based on the sel4 microkernel, comprising the following steps: Step 1: Hardware configuration and initialization. For the initialization and driver development of the hardware platform, extract the hardware initialization steps under the hardware platform according to the development manual and source code; Step 2: Deployment of the sel4 kernel. Deploy the sel4 kernel on the hardware device, including the kernel space and the user space, to establish a system framework with security and isolation. Configure the hardware address and memory parameters in the seL4 kernel space. By configuring the hardware memory mapping at the kernel space level, establish the communication between the hardware and the user space. The user space can correctly access and operate the hardware resources, and achieve isolation between different software modules. Step 3: Implement the network card driver and network protocol stack. Use the rust language to implement dual network card drivers and lightweight network protocol stacks, and deploy them to the sel4 microkernel space. Step 4: Implement the Modbus and MQTT communication protocols based on the Rust language, use the Rust language to establish Modbus and MQTT threads in the application respectively, and execute Modbus data acquisition and MQTT communication in parallel, which are used for data acquisition and communication between the cloud platform and hardware devices respectively.
[0006] In the above-mentioned data acquisition method based on the sel4 microkernel, in step 1, the hardware platform includes hardware configuration, network card driver, PHY chip reset, kernel configuration, memory mapping, hardware timer and interrupt processing, and the hardware initialization step includes the reset registers of the network card and PHY chip.
[0007] In the above-mentioned data collection method based on the sel4 microkernel, the step 2 of deploying the sel4 kernel on the hardware device includes: Step 2-1: Add device driver and platform description to the kernel program, add serial port driver and configuration file, add platform device tree file, and add them to the cmake compilation file; Step 2-2: Add the hardware platform in the image loader elfloader, create platform_init.c in the src / platform / path, and implement the initialization code of the hardware platform; Step 2-3: Determine the image format and platform support in the compiled file in the application, determine the kernel start address corresponding to it, and enable multi-core support.
[0008] In the above-mentioned data collection method based on the sel4 microkernel, the communication between the kernel space and the user space is established in step 2, including: Step 2-4: Allocate endpoints, use unused memory to allocate endpoint objects, and allocate to endpoint capabilities; Step 2-5: The sending thread uses seL4_Call or seL4_Send to send messages, the synchronous IPC receiving process calls seL4_Recv to block and wait for messages, and the asynchronous IPC uses seL4_Wait to wait for notification signals; Step 2-6: Set and read register values through seL4_SetMR and seL4_GetMR.
[0009] In the above-mentioned data acquisition method based on the sel4 microkernel, step 3 comprises: Step 3-1: Configure the network card register, read the status register of the PHY chip, detect the status of the network link, and initialize the driver according to the link status, realize high-speed data transmission through DMA, and manage the send and receive buffers; Step 3-2: Register and process the interrupt request of the network card, and use the unsafe block in Rust to interact with the interrupt mechanism of seL4 to ensure efficient response to the interrupt signal of the network card hardware; Step 3-3: Implement the basic functions of the TCP / IP protocol stack, including ARP, ICMP, UDP, TCP and IP protocols, ensure reliable data transmission, create multi-threaded user programs, and provide efficient operation processes.
[0010] The above-mentioned data acquisition method based on the sel4 microkernel, said step 4 includes, Establishing a modbus thread based on secure memory language for communication between data acquisition and hardware devices includes the following steps: Step 4-1: Message sending, using the modbus thread to communicate with external devices through the serial port or TCP protocol, the hardware device obtains data from the field device by sending a request message, and sends the message to the slave device through the serial port or TCP interface; Step 4-2: Data acquisition, receiving the data returned after sending a message to the slave device, the field device returns the data of the corresponding register according to the request, reading the data frame returned by the field device, and caching it for subsequent analysis; Step 4-3: Data parsing: parse the response message of the Modbus thread into specific register values, check whether the returned message is correct, extract the register data in the response, identify the specific data value, and compare it with the valid value range, eliminate invalid data, and identify abnormal data; Step 4-4: Data storage, storing the parsed data in a database; By using SSL secure socket layer encryption to establish an mqtt thread, a secure communication channel is established between the hardware device and the cloud platform, including the following steps: Step 4-5: Parse the data format. Through the TSL encrypted MQTT module written in rust, the message sent by the platform is received, and the data in JSON format is parsed. According to the instruction value issued by the platform, it is passed to the corresponding parsing module respectively, and the corresponding value is obtained and saved to the corresponding file system configuration file; Step 4-6: Report the collected data to the cloud platform via MQTT.
[0011] The above-mentioned data acquisition method based on the sel4 microkernel, the establishment of a modbus thread based on a secure memory language for communication between data acquisition and hardware devices also includes: Dynamic mapping, which provides a dynamic data mapping table to automatically adjust the data collection strategy and the collection frequency of each device based on the device type and data type; The error mechanism detects whether there are errors in the data packet transmission process by monitoring specific flags and data in the Modbus communication protocol to ensure the accuracy and integrity of the data.
[0012] The above-mentioned data collection method based on the sel4 microkernel, wherein the mqtt thread is established by adopting SSL secure socket layer encryption to establish a secure communication channel between the hardware device and the cloud platform further comprises: Integrity check: Use hash algorithm to check the integrity of data. A check value will be generated for each message before it is sent. The receiver verifies the consistency of the data to determine whether the data has been modified during transmission, thus ensuring the authenticity and integrity of the data. Fault detection and automatic recovery: Through the built-in monitoring mechanism, fault conditions are detected in real time, and data that has not been sent successfully is resent to ensure complete data transmission; Cache and segment reorganization of big data. When the data volume is large, the system will receive the data in segments and temporarily store it in the buffer until all data segments are received before performing complete data processing; Customized data parsing and error correction, using the cJSON library to parse the received JSON data, check the validity of the data, identify obvious error messages and correct them; Adaptive multi-mode data reporting: after parsing the data type, it will classify the mode and automatically match the reporting mode; Real-time network time synchronization ensures that device time is synchronized with the global time.
[0013] A data acquisition device based on the sel4 microkernel, comprising: Data acquisition and processing integration module: For the initialization and driver development of the hardware platform, according to the development manual and source code, the hardware initialization steps under the hardware platform are extracted, the hardware configuration and initialization are completed, the sel4 kernel is deployed on the hardware device, including the kernel space and the user space, and a system framework with security and isolation is established. The hardware address and memory parameters are configured in the seL4 kernel space. By configuring the memory mapping of the hardware at the kernel space level, the communication between the kernel space and the user space is established, and the user space can correctly access and operate the hardware resources, realizing the isolation between different software modules; Network card driver module: Use the rust language to implement dual network card drivers and lightweight network protocol stacks, and deploy them to the sel4 microkernel space to implement network card drivers and network protocol stacks; Secure link communication module: Use the Rust language to establish Modbus and MQTT threads in the application respectively, integrating connection management, message publishing and subscription, quality of service QoS management, data encryption transmission, identity authentication, fault recovery, and data analysis functions for data collection and communication between the cloud platform and hardware devices.
[0014] A data acquisition medium based on the sel4 microkernel comprises: a program is stored on the data acquisition medium, and when the program is executed by a processor, the data acquisition method based on the sel4 microkernel as described in any one of the above items is implemented.
[0015] The beneficial effects of the data acquisition method, device and medium based on the sel4 microkernel of the present invention are as follows: high security and reliability, improved kernel architecture and optimized memory safety language support, and combined with a componentized software framework, a highly secure and reliable system architecture is provided. It ensures that the kernel code has no common security vulnerabilities, greatly improving the security and stability of the system. The strong isolation mechanism ensures that each application or component is independent of each other, and the failure of one component will not affect other components, further enhancing the security of the system. It makes full use of the memory safety characteristics and efficient concurrency capabilities of the optimized safe programming language. Unlike the traditional C language, memory management problems such as data competition, null pointer reference and buffer overflow are eliminated through ownership rules and borrow checkers during compilation, significantly reducing the risk of memory-related security vulnerabilities.
[0016] Efficient concurrency support and multi-core utilization, the concurrency model of the Rust language has been deeply optimized, and data competition problems in a multi-threaded environment are prevented through safe concurrent programming. On a multi-core hardware platform, the present invention can efficiently utilize parallel computing capabilities to ensure that the system maintains high performance when processing complex tasks. This provides a strong guarantee for industrial data acquisition systems in dealing with large data volumes and multi-task concurrent scenarios.
[0017] The optimized error handling mechanism uses the Result and Option types of the Rust language to replace the traditional error code or exception mechanism, making error handling safer and more efficient. It avoids hidden problems caused by errors not being caught correctly, reduces the potential risk of error propagation in the code, and further improves the reliability and robustness of the system.
[0018] Safe and efficient communication link. The present invention builds an efficient communication link based on MQTT and Modbus, combines data encryption and identity authentication means, and ensures the security and integrity of data during transmission. Through dynamic mapping mechanism and encryption protocol, it is ensured that data will not be illegally tampered with or intercepted during transmission, thereby improving the security of communication. At the same time, the system supports a multi-topic mechanism to distinguish different types of messages and ensure the efficiency and controllability of data transmission.
[0019] Data analysis and exception handling, the present invention realizes effective recording, storage and exception handling of collected data through the data analysis module, ensuring the accuracy of data and the reliability of the system. Comprehensive analysis and processing of the collected data can timely detect and correct anomalies in the data, ensuring that the data reported to the cloud platform is accurate and reliable, and further improving the monitoring and management capabilities of industrial equipment.
[0020] Remote monitoring and real-time control support: The system supports remote monitoring and real-time control functions, and can remotely operate and monitor equipment through the cloud platform. This significantly improves the management capabilities of industrial equipment, especially for industrial equipment environments with low automation. The present invention can effectively improve the operating efficiency and maintainability of equipment through optimized data acquisition and control mechanisms, and significantly reduce equipment maintenance and operating costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a microkernel system architecture diagram of the present invention; Figure 2 This is a product architecture diagram of the present invention; Figure 3 This is a network data transmission diagram of the present invention. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the purpose and technical solutions of the present invention, the purpose and technical solutions of the present invention are described below in conjunction with specific implementation methods.
[0023] The accompanying drawings show embodiments of the present application. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.
[0024] Example 1 like Figure 1 As shown, a software system architecture diagram of data acquisition based on the sel4 microkernel is provided, and a data acquisition system solution is deployed on the microkernel to form an overall software system architecture.
[0025] The microkernel mainly consists of two parts, user state and kernel state. Kernel state is the core part of the operating system, running at the highest privilege level. It can directly access hardware and control underlying system resources. Only the most basic and core operating system functions run in kernel state, and its main functions include process management, memory management, inter-process communication, etc. User state runs at a lower privilege level and is mainly used to execute user space applications and most operating system services.
[0026] In this technical solution, the program code of the acquisition system is all implemented in user mode. In order to build an efficient and secure system architecture, this technical solution uses the CAmkES framework to build corresponding component programs. Specifically, these components include but are not limited to: network drivers, lightweight network protocol stack programs, and communication acquisition programs. The implementation of each component uses the memory-safe language Rust to enhance the security and robustness of the system.
[0027] In the system architecture, the communication between components is based on the port objects of the seL4 microkernel for inter-thread communication. Each component is granted corresponding permissions through the seL4 capability mechanism to ensure the security of the system and the isolation between modules. Through this design, the system can achieve secure and efficient communication between different components while avoiding potential security risks caused by traditional kernel state execution.
[0028] Figure 2 This is a product functional architecture diagram for data acquisition based on the sel4 microkernel, forming a closed-loop path from the cloud platform to the on-site equipment, and describing the elements and functions covered by the entire data acquisition system.
[0029] A collection system based on cloud platform and hardware product communication receives instructions from the cloud platform through the MQTT protocol and communicates with the hardware product. The seL4 microkernel is deployed in the hardware product, and the corresponding application is built using the CAmkES framework to implement core functional modules including data collection, data analysis, data reporting, and network card driver.
[0030] Through this framework, a mapping relationship is established between the software and hardware to ensure that the hardware can execute the corresponding functional instructions. The hardware device is connected to the field equipment through the Modbus communication protocol to realize the data acquisition function. After the acquisition is completed, the field equipment transmits the collected data to the hardware product, and the hardware product processes the received data and stores the results in the database, waiting for the cloud platform to send further instructions for data operations.
[0031] This system architecture enables efficient communication and data processing between the cloud platform and hardware products, ensuring the real-time, reliability and security of the acquisition system.
[0032] Figure 3 Will Figure 2 The flow of network data packets is extracted, and the data transmission from the cloud platform to the field equipment is a two-way transmission process. The cloud platform sends data packets to the product end through the MQTT protocol, and the hardware device receives it through the MAC. After the underlying network card in the software receives the data, it transmits it to the network protocol stack for data packet processing. After the data packet is processed by the protocol layer, it is uploaded to the application layer. The user performs customized parsing and processing on the received data through the application. The user sends instructions to the field device through the product, and transmits the data to the underlying network card through the protocol stack. Then the underlying network card of the field device receives the data packet, performs the next step of parsing and processing, and responds at the application level.
[0033] Example 2 With respect to the traditional system architecture, the optimization points focused on in this embodiment are as follows.
[0034] 1. Optimization of inter-process communication mechanism.
[0035] In embedded systems with high-frequency data interaction and large data volumes, the efficiency of IPC may still become a bottleneck. Data needs to be copied from the user buffer of the application to the kernel buffer, and then from the kernel buffer to the device or network buffer. These data copy processes result in multiple memory accesses and data copies, consuming a large amount of CPU time and memory bandwidth. The present invention adopts a zero-copy IPC channel, optimizes the IPC mechanism on seL4, and designs a zero-copy data sharing channel. Using shared memory technology, the application and the kernel can share the same memory area to avoid data copying between user state and kernel state. The application can directly write data to the shared memory, and then the kernel can directly read data from the shared memory for transmission, or vice versa. Using the memory management capability of seL4, a special physical memory frame is created for the shared memory area, and these frames will be used as shared memory. Use seL4's virtual memory mapping (seL4_VSpace_Map) to map these physical frames to the virtual address space of the data acquisition module and the MQTT communication module. In this way, multiple processes can access the same physical memory area in their respective address spaces. The shared memory channel is particularly suitable for high-frequency data exchange between the data acquisition module and the MQTT publishing module.
[0036] When the data acquisition module collects new sensor data, it writes the data to the buffer in the shared memory. The write operation needs to check the remaining available space to prevent the buffer from overflowing. After the data is successfully written, the write pointer of the buffer is updated. Atomic operations or memory barriers can be used to ensure that the update of the write pointer is visible. The MQTT communication module is notified that new data is available for reading by setting an event flag or using a semaphore. The MQTT communication module can detect the arrival of new data by waiting for event notifications or polling. When the MQTT communication module detects that there is new data, it starts reading the data from the read pointer position of the buffer through specific instructions. After reading, the read pointer is updated.
[0037] 2. seL4's high-performance real-time scheduler.
[0038] Task priorities are adjusted dynamically, real-time priorities are assigned to different data acquisition tasks and communication tasks, and priorities are adjusted dynamically according to the current load of the system. Initial priorities are set for all threads or tasks in the system. Different priorities can be assigned according to the type and importance of tasks. When it is detected that the Modbus module needs to respond quickly to external devices, the priority of its thread can be temporarily increased. After adjusting the priority, the task will be given priority in CPU scheduling, so that it can respond to events faster. When the Modbus acquisition task is completed, its priority is restored to the initial value or a lower priority in time to avoid long-term occupation of CPU resources and affect the execution of other tasks. This is achieved by calling the seL4 system call interface, and using seL4_TCB_SetPriority to set the thread priority. Through dynamic scheduling strategies, the system can better respond to emergencies and real-time requirements.
[0039] 3. Security isolation mechanism.
[0040] Fine-grained permission control: Through the capability mechanism of seL4, fine-grained permission division is performed for each module. The MQTT module can only access the network interface but cannot directly access the hardware sensor, ensuring that each module can only operate its own allocated resources. Through fine-grained permission allocation, the security of the system is enhanced to prevent the crash or malicious behavior of a module from affecting other parts of the system.
[0041] Double isolation protection, based on seL4, provides a double isolation mechanism by using component isolation in the CAmkES framework plus kernel-level isolation of seL4 to ensure that the system can recover quickly when an exception occurs.
[0042] To achieve the above three optimization points, this implementation example specifically explains how to deploy the data collection solution implemented in Rust language to the seL4 microkernel and hardware devices to form an overall secure data collection system. The specific steps include hardware configuration, deployment of the sel4 kernel, implementation of the rust network card driver and network protocol stack, implementation of the modbus and mqtt communication protocols based on the rust language, and system integration and testing.
[0043] A data acquisition method based on the sel4 microkernel comprises the following steps: Step 1: Hardware configuration and initialization.
[0044] Initialization and driver development for the hardware platform, including hardware configuration, network card driver, PHY chip reset, kernel configuration, memory mapping, hardware timer and interrupt handling.
[0045] According to the development manual and source code, extract the hardware initialization steps under the hardware platform, including the reset registers of the network card, PHY chip, etc.
[0046] Configure the hardware address and memory parameters in the seL4 kernel. The physical address and memory parameters of the hardware need to be configured during the kernel startup phase. By configuring the hardware memory mapping at the kernel level, the communication between the kernel and the user space is established to ensure that the user space can correctly access and operate the hardware resources. This includes modifying the device tree, registering the hardware's physical address, memory size and other parameters to the system so that they can be used by the system.
[0047] Step 2: Deployment of the sel4 kernel.
[0048] Deploy the sel4 kernel on the hardware device, including kernel space and user space, to establish a secure and isolated system framework, configure hardware addresses and memory parameters in the seL4 kernel space, and establish communication between kernel space and user space by configuring hardware memory mapping at the kernel space level. The user space can correctly access and operate hardware resources, thus achieving isolation between different software modules.
[0049] Deploy the sel4 kernel on the hardware device, including: Step 2-1: Add device driver and platform description to the kernel program, add serial port driver and configuration file, add platform device tree file, and add it to the cmake compilation file.
[0050] Step 2-2: Add the hardware platform in the image loader elfloader, create platform_init.c in the src / platform / path, and implement the initialization code of the hardware platform.
[0051] Step 2-3: Determine the image format and platform support in the compiled file in the application, determine the kernel start address corresponding to it, and enable multi-core support.
[0052] Establishing communication between kernel space and user space includes: Step 2-4: Allocate endpoints, use unused memory to allocate endpoint objects, and allocate to endpoint capabilities.
[0053] Step 2-5: The sending thread uses seL4_Call or seL4_Send to send messages, the synchronous IPC receiving process calls seL4_Recv to block and wait for messages, and the asynchronous IPC uses seL4_Wait to wait for notification signals.
[0054] Step 2-6: Set and read register values through seL4_SetMR and seL4_GetMR.
[0055] Step 3: Implementation of network card driver and network protocol stack.
[0056] Use the rust language to implement support for dual network card drivers and lightweight network protocol stacks, and deploy them in the sel4 microkernel space.
[0057] include: Step 3-1: Configure the network card register and set the network card to work mode, including 100M and 1000M mode. Read the status register of the PHY chip, detect the status of the network link, and initialize the driver according to the link status to achieve automatic negotiation. Achieve high-speed data transmission through DMA to avoid excessive CPU intervention. Implement ring buffer management and manage the send and receive buffers.
[0058] Step 3-2: Register and process the interrupt request of the network card, including packet reception interrupt, transmission completion interrupt, error interrupt, etc. Use the unsafe block in Rust to interact with the interrupt mechanism of seL4 to ensure efficient response to the interrupt signal of the network card hardware.
[0059] Step 3-3: Implement the basic functions of the TCP / IP protocol stack, including ARP, ICMP, UDP, TCP and IP protocols. The link layer implements the encapsulation and parsing of Ethernet frames. Including destination MAC address, source MAC address, Ethernet type, etc. The network layer implements the IPv4 protocol and handles the routing and forwarding of IP data packets. Parse IP header information. Support ICMP protocol for basic network diagnostic functions. The transport layer implements the UDP protocol for connectionless lightweight communication. Implement the basic functions of the TCP protocol, connection, handshake, data transmission and connection release, etc., to ensure reliable data transmission. The user program creates multiple threads, including application threads, data receiving threads, data sending threads, protocol processing threads and test threads, etc., to provide an efficient operation process.
[0060] Step 4: Implement the modbus and mqtt communication protocols based on the rust language.
[0061] Use the Rust language to establish Modbus and MQTT threads in the application respectively, and execute Modbus data acquisition and MQTT communication in parallel, which are used for data acquisition and communication between the cloud platform and hardware devices respectively.
[0062] The Rust memory-safe language is used to develop component programs for the data acquisition system, which improves performance on the basis of memory safety and ensures the reliability of programming tasks. Through mechanisms such as ownership system, borrowing, and life cycle, memory safety is guaranteed at compile time, avoiding common problems such as null pointer references, dangling pointers, and data competition.
[0063] The Modbus module is responsible for communicating with external devices through the serial port or TCP protocol to obtain the status and data of sensors or industrial equipment. It mainly includes four core functions: message sending, data collection, data analysis and data storage.
[0064] Step 4-1: Message sending, using the modbus thread to communicate with external devices through the serial port or TCP protocol. The hardware device obtains data from the field device by sending a request message and sends the message to the slave device through the serial port or TCP interface.
[0065] Message sending includes two protocols. Modbus RTU sends binary data frames through the serial port, which usually contain fields such as device address, function code, register address and data length. Modbus TCP protocol sends request messages through the TCP network. The message structure is similar to RTU, but TCP header information needs to be added before the data frame.
[0066] Step 4-2: Data acquisition, receiving the data returned after sending a message to the slave device, the field device returns the data of the corresponding register according to the request, reads the data frame returned by the field device, and caches it for subsequent analysis.
[0067] The hardware device needs to receive and buffer data from the serial port or TCP interface. For Modbus RTU, the received message is usually in binary format, and the data is obtained through the serial port interrupt and the fixed-length data frame is read. For Modbus TCP, the received message is a network data packet. When receiving the message, a TCP connection needs to be established, so that the TCP connection can be maintained when sending TCP messages, and the response can be effectively received. The response is read through the TCP stream.
[0068] Step 4-3: Data analysis: The data frame returned by Modbus contains the register data and status information of the device. The data analysis module analyzes the response message of the Modbus protocol into specific register values. Check whether the returned message is correct.
[0069] The serial port checks the CRC or checksum, and TCP checks the corresponding data length and number of data bytes, etc. The register data in the response is extracted and converted into an integer value.
[0070] Identify specific data values and compare them with the valid value range, eliminate invalid data, and identify abnormal data.
[0071] Step 4-4: Data storage, storing the parsed data in the database.
[0072] By using SSL secure socket layer encryption to establish the mqtt thread, a secure communication channel is established between the hardware device and the cloud platform. The TSL encrypted MQTT module written in rust mainly includes core functions such as data format parsing and reporting of collected data.
[0073] Step 4-5: Parse the data format. Through the TSL encrypted MQTT module written in rust, the message sent by the platform is received, and the data in JSON format is parsed. According to the instruction value issued by the platform, it is passed to the corresponding parsing module respectively, and the corresponding value is obtained and saved to the corresponding file system configuration file; Step 4-6: Report the collected data to the cloud platform via MQTT.
[0074] There are four reporting methods, namely, timed reporting, change reporting, threshold reporting and periodic reporting. The data we obtain from Modbus or other acquisition devices has been parsed into JSON format, and the MQTT thread publishes the data to the specified topic of the cloud platform. The whole process uses TSL encryption.
[0075] To verify the effectiveness of the method, the entire method may further include step 5.
[0076] Step 5: System integration and testing.
[0077] Deploy the above modules to the hardware device to form a complete data acquisition system and verify the functions.
[0078] Verify network functions through iperf, including the hardware device as client and server, and view network traffic through winshark.
[0079] Attacks on the security of communication link construction to verify the security of the acquisition system.
[0080] Send configuration and other instructions to the device through the cloud platform, obtain the data obtained by the modbus acquisition module, and verify the integrity of the communication link and the correctness of the function.
[0081] Example 3 This embodiment aims at the inherent drawbacks of traditional programming languages and makes the following improvements in Rust programming: 1. Development of low-overhead network protocol stack based on Rust.
[0082] Rust's memory safety feature solves memory leaks and concurrency problems, but using the existing Rust network library directly may not meet performance requirements. Design a lightweight network protocol stack based on the Rust language, specifically optimized for the low-resource environment of embedded systems. Compared with the standard network protocol stack, it removes unnecessary functional modules, reduces the memory and CPU resources occupied by the protocol stack, and enables it to run efficiently on resource-constrained embedded platforms.
[0083] Parallel processing optimization, through Rust's asynchronous programming model and zero-cost abstraction, parallel optimization of the network protocol stack, so that it can fully utilize the computing power of multi-core systems to handle high-concurrency data transmission tasks. In particular, for the parallel execution of Modbus data acquisition and MQTT communication, the system can ensure that the two do not block each other, improving overall efficiency.
[0084] 2. Custom memory allocator.
[0085] Fixed-size memory pools. Although Rust's default memory allocator has some flexibility, it may not be efficient enough in embedded systems. By designing fixed-size memory pools for different types of tasks and modules, frequent memory allocation and recycling operations can be avoided, thus improving the system's memory management efficiency.
[0086] Optimized stack management: Based on the characteristics of different tasks, a custom stack management mechanism optimized for embedded environments is designed. By limiting the stack size of tasks, system crashes caused by excessive memory usage are avoided. At the same time, a safe stack expansion mechanism is provided to ensure that the system can operate normally under high load conditions.
[0087] 3. Efficient concurrent task scheduling.
[0088] The lock-free concurrency model uses Rust's lock-free data structures Arc and Atomic to avoid lock contention problems in traditional concurrency models. In the case of multi-task concurrency, the system can further improve the efficiency of multi-threaded task processing through a lock-free data sharing mechanism, especially in high-concurrency data collection and communication scenarios.
[0089] Real-time task distribution and scheduling, in response to the high real-time requirements of data collection and transmission, this paper designs a set of real-time task scheduling strategies based on Rust's concurrency model. By classifying the importance of tasks, it ensures that high-priority tasks can be executed first, while low-priority tasks can be delayed, thereby improving the overall system response speed.
[0090] 4. Adaptive error recovery mechanism.
[0091] Adaptive error recovery mechanism: when a component in a Rust program fails, the system can automatically capture and recover errors to avoid the overall crash of the system. In data collection, if a network module fails, the system can automatically restart the module without affecting the operation of other functions. Combined with Rust's Result type, the present invention defines a set of adaptive error handling rules for each module to ensure that the system can respond and recover quickly when an exception occurs.
[0092] Example 4 This embodiment focuses on explaining the optimization of the communication link.
[0093] Communication link optimization mainly includes modbus acquisition module, mqtt communication module, network card driver module and network protocol stack.
[0094] 1. Data acquisition and processing integrated module.
[0095] A Modbus protocol module based on secure memory language is established, including the parsing, data encapsulation, decapsulation, and error detection and correction functions of Modbus RTU and Modbus TCP protocols to improve the reliability and security of communication.
[0096] Real-time data processing, convert the received cloud platform data into modbus messages, send it to the device in real time, and receive and process the modbus response message in real time. Perform modbus message analysis on the collected data, write the real-time collected data into the database, and update the configuration file at the same time, effectively store and manage process data and real-time data. Effectively identify invalid data and report errors. Support multi-device acquisition, support multi-device and multi-point acquisition at the same time, and real-time acquisition. The Modbus data analysis module mainly includes data integrity verification, which judges the validity of the received data length. Data information verification, set the abnormal detection value according to the device threshold and status, and when the received data exceeds a certain threshold, it will be judged as invalid data. Abnormal data monitoring, define the range of normal and abnormal point information. When the abnormal range is reached, the modbus acquisition module will mark the abnormal data and upload it to the cloud platform for the next step of processing.
[0097] Dynamic mapping provides a dynamic data mapping table to automatically adjust the data collection strategy according to the device type and data type. The dynamic data mapping table is an expandable configuration table that contains the type, address, register range and corresponding data type of each device. Through the mapping table, the system can understand the collection requirements of each device and automatically adjust the collection strategy according to different device types. The system adjusts the collection strategy according to the dynamic data mapping table to ensure that different types of devices use the most appropriate collection method to avoid excessive redundant data collection or collection failure. Through dynamic adjustment, the Modbus module can effectively manage system resources and ensure real-time and accuracy.
[0098] When the system starts, the dynamic data mapping table is loaded according to the configuration file or user input. The type, address, register information and data type of each device are recorded in the mapping table. The acquisition frequency is adjusted according to the device type. Some devices require frequent acquisition, such as temperature sensors, while other devices may only require periodic acquisition, such as gas detectors. Through the configuration in the mapping table, the system automatically adjusts the acquisition frequency of each device to avoid unnecessary data transmission and improve system performance. Parse data according to data type: The collected data is parsed according to the device type and data type. The Modbus register of the temperature sensor returns a floating point number, while the pressure sensor returns an integer. The mapping table helps the system identify the data type and format it correctly.
[0099] The error mechanism includes an error detection and correction mechanism to identify and correct errors in data transmission or acquisition to ensure the accuracy and integrity of the data. The error detection mechanism detects by monitoring specific flags and data in the Modbus communication protocol. The Modbus protocol uses CRC check to detect whether there are errors in the data packet transmission process. If the Modbus master does not receive a response from the slave within the specified time, or the response time exceeds expectations, it is determined to be a timeout error. If the register address requested by the Modbus master exceeds the range supported by the device, the device will return an exception code. At this time, the system will identify the register address error and record it. If the data returned by the slave device does not match the expected data type, the system will identify a data parsing error.
[0100] Once an error is detected, the Modbus module will try to correct the error through a correction mechanism to ensure system continuity and data integrity. When a CRC check error or timeout error is detected, the system will automatically retry the data acquisition operation. The number of retries can be dynamically adjusted according to the characteristics of the device and the communication environment to avoid frequent retries causing performance degradation. For some key devices or data, the system will pre-set multiple slave devices or spare register addresses. When the main device fails or a timeout error occurs, the system can automatically switch to the backup device or spare register address for data acquisition. When a data type mismatch or register read error is detected, the system will automatically adjust the read strategy according to the rules in the mapping table, such as resending the request or adjusting the parsing method to ensure that the collected data is in the correct format. When the error cannot be corrected by the retry or backup mechanism, the system will trigger an alarm and record the error log. The alarm information usually contains the time when the error occurred, the device ID, the error type, etc.
[0101] 2. Secure link communication module.
[0102] The present invention provides an MQTT communication module developed based on secure memory language, which aims to establish a data communication channel between devices and cloud platforms with high security, reliability and scalability. The module integrates multiple functions such as connection management, message publishing and subscription, quality of service QoS management, data encryption transmission, identity authentication, fault recovery, data analysis, etc., and ensures the real-time, efficient and secure transmission and processing of device data through innovative technical means.
[0103] Secure connection and management, the MQTT communication module of the present invention establishes a secure communication channel between the device and the cloud platform by adopting SSL secure socket layer encryption, ensuring the confidentiality, integrity and security of data during transmission. The module supports an automated connection management mechanism and can monitor the communication status between the device and the cloud platform in real time. Once a network anomaly or connection interruption is detected, the module will automatically execute a reconnection mechanism to re-establish a secure connection to ensure the continuity and stability of data transmission.
[0104] Multi-Topic mechanism and multi-level QoS service quality management. By establishing multiple topics, different types of device data and control instructions can be processed separately. Sensor data, device status information, control commands, etc. can be published to different Topics respectively. The cloud platform can subscribe to relevant topics according to needs, thereby achieving efficient message transmission and management. Support multi-level QoS service quality management to meet the requirements of message transmission in different scenarios. For high-priority data, such as important alarm information or real-time control instructions, the MQTT communication module can use the highest level of QoS to ensure reliable transmission of messages; for general status information or non-urgent data, a lower QoS level can be used to optimize network resources.
[0105] Integrity check, in order to prevent data from being maliciously tampered with during transmission, the present invention uses a hash algorithm to perform integrity check on the data. Each message will generate a check value before sending it. The receiver verifies the consistency of the data to determine whether the data has been modified during transmission, ensuring the authenticity and integrity of the data.
[0106] Fault detection and automatic recovery mechanism: The module can detect network interruption, connection failure, data loss and other faults in real time through the built-in monitoring mechanism. Once a communication anomaly is detected, the module will immediately start the fault recovery mechanism. When a network interruption or connection loss occurs, the module will automatically try to re-establish the connection and resend the data that was not sent successfully to ensure the complete transmission of the data and avoid data loss or omission due to network failure.
[0107] Big data caching and segment reorganization. When the amount of data is large, the system will receive the data in segments and temporarily store it in the buffer until all data segments are received before processing the complete data. This buffering mechanism can effectively avoid data loss or processing delays caused by network congestion. When the receiving end obtains the data segments, the module will reorganize each segment to ensure data integrity. Subsequently, the system will perform the next step of parsing or storing the reorganized data to ensure efficient data processing.
[0108] Customized data parsing and error correction mechanism. MQTT messages are usually transmitted in JSON format. The module uses the cJSON library to parse the received JSON data and converts it into the specific type required by the device according to the preset rules, so that the device can correctly understand and execute the instructions issued by the cloud platform. During the parsing process, the module will check the validity of the data, identify obvious error information and correct it, prevent the device from performing wrong operations due to wrong data, and ensure the stable operation of the system.
[0109] Adaptive multi-mode data reporting mechanism. Periodic reporting: uploading device data regularly at set time intervals, suitable for scenarios that require continuous monitoring. Change reporting: triggering reporting immediately when the collected data changes, suitable for scenarios with high real-time requirements. Threshold reporting: triggering reporting of alarm information when the collected data reaches or exceeds the preset threshold, suitable for scenarios such as security monitoring. Scheduled reporting: uploading data at set time points, suitable for regular data collection needs. After the system parses the data type, it will classify its pattern and automatically match the reporting pattern.
[0110] Real-time network time synchronization ensures time acquisition in two ways. RTC time acquisition: the device is equipped with an RTC module. The system can directly read the current time from the RTC module and convert it into a standard time format to ensure the accuracy of the device time. SNTP server synchronization: the device connects to the SNTP server through the network and obtains the standard time from the server to ensure that the device time is synchronized with the global time. It is especially suitable for application scenarios with high requirements for time accuracy.
[0111] 3. Network card driver module.
[0112] The network card driver module in the present invention has been optimized for high-performance industrial Internet of Things application scenarios, ensuring that the system can achieve more efficient data transmission, processing and adaptation capabilities while supporting Gigabit and 100M dual network ports. By introducing a lightweight network protocol stack, combined with cache and DMA processing, automatic negotiation function, and the adaptability of multiple PHY chips, the transmission efficiency and performance of network data are further improved, and the following optimizations are adopted.
[0113] The network card driver module uses ARM NEON assembly language to replace the memcpy function in C language for the data copying and processing process. NEON is a single instruction multiple data instruction set that allows a single instruction to process multiple data points in parallel, greatly improving the efficiency of data copying and processing. By optimizing memcpy through the NEON instruction set copy, unnecessary resource waste can be reduced when copying large blocks of memory data, significantly improving the memory operation speed in network data transmission.
[0114] DMA cache optimization, clearing the send data cache. When sending data, the CPU first prepares the data to be sent in the memory. Then, the data in the cache is written back to the main memory through the DMA controller to ensure that the data read by DMA is the latest. The DMA controller then reads the data from the main memory and transmits it to the network card to avoid data transmission errors caused by cache expired data. Receive data cache invalidation. When receiving data, the DMA controller receives data directly from the network card and writes it to the main memory. In order to ensure that the CPU always obtains the latest data when accessing, the relevant data in the cache will be marked as invalid, forcing the CPU to read new data from the main memory. This process ensures the correctness of data transmission and eliminates potential errors caused by cache expiration.
[0115] Disable the protocol checksum optimization of the network protocol stack. At the hardware level, the network card has verified the data through the frame check sequence FCS of the Ethernet frame, so the TCP / UDP checksum processing at the software layer can be disabled. Disabling the software TCP / UDP checksum will not affect the work of FCS, and can detect transmission errors at the link layer, thereby reducing the system's computing overhead. Setting ip_summed to CHECKSUM_UNNECESSARY means that the driver tells the kernel protocol stack that the checksum of this data packet has been verified at the hardware level and does not need to be checked and verified again at the software level. This approach can reduce CPU overhead and improve network performance.
[0116] CPU frequency adaptation, in order to maximize the performance of the network card driver module, the system optimizes the hardware performance by adjusting the CPU frequency. According to the device tree file and user manual of the hardware development device, the highest supported CPU frequency is determined, and the voltage value on the power supply side is adjusted accordingly. In the device tree file of U-Boot, the CPU frequency is set to 1.512GHz to ensure that the system can process a large amount of network data at a high frequency, reduce network latency and increase throughput. The network performance test is performed through the iperf tool to verify the actual transmission performance after increasing the CPU frequency. The test shows that while the system increases the CPU frequency, the throughput of the network card data is significantly improved and the network latency is reduced, especially in high-traffic network scenarios, which can ensure the stable operation of the system.
[0117] 4. Lightweight network protocol stack.
[0118] Establish a network protocol stack module based on a secure memory language, including IPv4 and IPv6 header parsing, routing, packet fragmentation and reassembly, TCP connection establishment, maintenance, termination, data transmission and congestion control, UDP packet encapsulation, decapsulation and data transmission, device driver interface and data buffer management.
[0119] In the normal process of sending and receiving network data, the network card driver integrates a lightweight network protocol stack, which greatly reduces the complexity of protocol processing and improves transmission efficiency. In particular, batch processing of received data reduces frequent interrupt requests and greatly optimizes the network throughput and overall performance of the system. Compared with the method of processing packets one by one, batch processing can more efficiently utilize CPU resources, significantly reduce system overhead in high-traffic environments, and improve network performance.
[0120] Design safe data structures and use Rust's safe data structures to replace pointers and raw data in C. For example, the Vec dynamic array type supports bounds checking and dynamic expansion. Use Rust's slice type Slices for memory operations to avoid buffer overflows. Use Rust's async / await syntax to support non-blocking I / O and achieve efficient network data transmission. Avoid using copy operations such as clone and copy in the Rust language, and use lifecycles and ownership to perform efficient resource operations. And use mutexes with caution, and some global variables can be summarized into the network protocol stack tcpip thread. Use the ownership system and reference counting mechanism to manage resource sharing and memory usage to prevent memory leaks and data competition. Rewrite the protocol state machine based on Rust's pattern matching Pattern Matching and enumeration Enum type to achieve safer state transitions and exception handling.
[0121] Establish a third-party rust library to effectively replace traditional kernel service-related codes in the standard library.
[0122] Example 5 A data acquisition device based on the sel4 microkernel.
[0123] Including: Data acquisition and processing integration module: for the initialization and driver development of the hardware platform, according to the development manual and source code, the hardware initialization steps under the hardware platform are extracted, the hardware configuration and initialization are completed, and the sel4 kernel is deployed on the hardware device, including kernel space and user space, to establish a system framework with security and isolation, and configure the hardware address and memory parameters in the seL4 kernel space. By configuring the memory mapping of the hardware at the kernel space level, the communication between the kernel space and the user space is established, and the user space can correctly access and operate the hardware resources to achieve isolation between different software modules.
[0124] Network card driver module: Use the rust language to implement support for dual network card drivers and lightweight network protocol stack, and deploy them to the sel4 microkernel space to implement the network card driver and network protocol stack.
[0125] Secure link communication module: Use the Rust language to establish Modbus and MQTT threads in the application respectively, integrating connection management, message publishing and subscription, quality of service QoS management, data encryption transmission, identity authentication, fault recovery, and data analysis functions for data collection and communication between the cloud platform and hardware devices.
[0126] Example 6 A data acquisition medium based on the sel4 microkernel comprises: a program is stored on the data acquisition medium, and when the program is executed by a processor, the data acquisition method based on the sel4 microkernel as described in any one of the above items is implemented.
[0127] The above embodiments are only for illustrating the inventive concept and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made based on the essence of the content of the present invention should be included in the protection scope of the present invention.
Claims
1. A data collection method based on the sel4 microkernel, characterized in that: The following steps are involved: Step 1: Hardware configuration and initialization. For the initialization and driver development of the hardware platform, extract the hardware initialization steps under the hardware platform according to the development manual and source code; Step 2: Deployment of the sel4 kernel. Deploy the sel4 kernel on the hardware device, including the kernel space and the user space, to establish a system framework with security and isolation. Configure the hardware address and memory parameters in the seL4 kernel space. By configuring the hardware memory mapping at the kernel space level, establish the communication between the hardware and the user space. The user space can correctly access and operate the hardware resources, and achieve isolation between different software modules. Step 3: Implement the network card driver and network protocol stack. Use the rust language to implement dual network card drivers and lightweight network protocol stacks, and deploy them to the sel4 microkernel space. Step 4: Implement the Modbus and MQTT communication protocols based on the Rust language, use the Rust language to establish Modbus and MQTT threads in the application respectively, and execute Modbus data acquisition and MQTT communication in parallel, which are used for data acquisition and communication between the cloud platform and hardware devices respectively.
2. The data acquisition method based on the sel4 microkernel according to claim 1, characterized in that: In step 1, the hardware platform includes hardware configuration, network card driver, PHY chip reset, kernel configuration, memory mapping, hardware timer and interrupt processing, and the hardware initialization step includes the reset registers of the network card and PHY chip.
3. The data acquisition method based on the sel4 microkernel according to claim 1 is characterized in that: Deploying the sel4 kernel on the hardware device in step 2 includes: Step 2-1: Add device driver and platform description to the kernel program, add serial port driver and configuration file, add platform device tree file, and add them to the cmake compilation file; Step 2-2: Add the hardware platform in the image loader elfloader, create platform_init.c in the src / platform / path, and implement the initialization code of the hardware platform; Step 2-3: Determine the image format and platform support in the compiled file in the application, determine the kernel start address corresponding to it, and enable multi-core support.
4. The data acquisition method based on the sel4 microkernel according to claim 3 is characterized in that: Establishing the communication between the kernel space and the user space in step 2 includes: Step 2-4: Allocate endpoints, use unused memory to allocate endpoint objects, and allocate to endpoint capabilities; Step 2-5: The sending thread uses seL4_Call or seL4_Send to send messages, the synchronous IPC receiving process calls seL4_Recv to block and wait for messages, and the asynchronous IPC uses seL4_Wait to wait for notification signals; Step 2-6: Set and read register values through seL4_SetMR and seL4_GetMR.
5. The data acquisition method based on the sel4 microkernel according to claim 1, characterized in that: The step 3 comprises: Step 3-1: Configure the network card register, read the status register of the PHY chip, detect the status of the network link, and initialize the driver according to the link status, realize high-speed data transmission through DMA, and manage the send and receive buffers; Step 3-2: Register and process the interrupt request of the network card, and use the unsafe block in Rust to interact with the interrupt mechanism of seL4 to ensure efficient response to the interrupt signal of the network card hardware; Step 3-3: Implement the basic functions of the TCP / IP protocol stack, including ARP, ICMP, UDP, TCP and IP protocols, ensure reliable data transmission, create multi-threaded user programs, and provide efficient operation processes.
6. The data acquisition method based on the sel4 microkernel according to claim 1, characterized in that: The step 4 includes: Establishing a modbus thread based on secure memory language for communication between data acquisition and hardware devices includes the following steps: Step 4-1: Message sending, using the modbus thread to communicate with external devices through the serial port or TCP protocol, the hardware device obtains data from the field device by sending a request message, and sends the message to the slave device through the serial port or TCP interface; Step 4-2: Data acquisition, receiving the data returned after sending a message to the slave device, the field device returns the data of the corresponding register according to the request, reading the data frame returned by the field device, and caching it for subsequent analysis; Step 4-3: Data parsing: parse the response message of the Modbus thread into specific register values, check whether the returned message is correct, extract the register data in the response, identify the specific data value, and compare it with the valid value range, eliminate invalid data, and identify abnormal data; Step 4-4: Data storage, storing the parsed data in a database; By using SSL secure socket layer encryption to establish an mqtt thread, a secure communication channel is established between the hardware device and the cloud platform, including the following steps: Step 4-5: Parse the data format. Through the TSL encrypted MQTT module written in rust, the message sent by the platform is received, and the data in JSON format is parsed. According to the instruction value issued by the platform, it is passed to the corresponding parsing module respectively, and the corresponding value is obtained and saved to the corresponding file system configuration file; Step 4-6: Report the collected data to the cloud platform via MQTT.
7. The data acquisition method based on the sel4 microkernel according to claim 6 is characterized in that: The establishment of a modbus thread based on a secure memory language for communication between data acquisition and hardware devices also includes: Dynamic mapping, which provides a dynamic data mapping table to automatically adjust the data collection strategy and the collection frequency of each device based on the device type and data type; The error mechanism detects whether there are errors in the data packet transmission process by monitoring specific flags and data in the Modbus communication protocol to ensure the accuracy and integrity of the data.
8. The data acquisition method based on the sel4 microkernel according to claim 7 is characterized in that: The method of establishing a secure communication channel between the hardware device and the cloud platform by using SSL secure socket layer encryption to establish an mqtt thread also includes: Integrity check: Use hash algorithm to check the integrity of data. A check value will be generated for each message before it is sent. The receiver verifies the consistency of the data to determine whether the data has been modified during transmission, thus ensuring the authenticity and integrity of the data. Fault detection and automatic recovery: Through the built-in monitoring mechanism, fault conditions are detected in real time, and data that has not been sent successfully is resent to ensure complete data transmission; Cache and segment reorganization of big data. When the data volume is large, the system will receive the data in segments and temporarily store it in the buffer until all data segments are received before performing complete data processing; Customized data parsing and error correction, using the cJSON library to parse the received JSON data, check the validity of the data, identify obvious error messages and correct them; Adaptive multi-mode data reporting: after parsing the data type, it will classify the mode and automatically match the reporting mode; Real-time network time synchronization ensures that device time is synchronized with the global time.
9. A data acquisition device based on the sel4 microkernel, characterized in that: include: Data acquisition and processing integration module: For the initialization and driver development of the hardware platform, according to the development manual and source code, the hardware initialization steps under the hardware platform are extracted, the hardware configuration and initialization are completed, the sel4 kernel is deployed on the hardware device, including the kernel space and the user space, and a system framework with security and isolation is established. The hardware address and memory parameters are configured in the seL4 kernel space. By configuring the memory mapping of the hardware at the kernel space level, the communication between the hardware and the user space is established, and the user space can correctly access and operate the hardware resources, realizing the isolation between different software modules; Network card driver module: Use the rust language to implement dual network card drivers and lightweight network protocol stacks, and deploy them to the sel4 microkernel space to implement network card drivers and network protocol stacks; Secure link communication module: Use the Rust language to establish Modbus and MQTT threads in the application respectively, integrating connection management, message publishing and subscription, quality of service QoS management, data encryption transmission, identity authentication, fault recovery, and data analysis functions for data collection and communication between the cloud platform and hardware devices.
10. A data acquisition medium based on the sel4 microkernel, characterized in that: include: The data acquisition medium stores a program, and when the program is executed by the processor, the data acquisition method based on the sel4 microkernel as described in any one of claims 1 to 8 is implemented.