As embedded systems grow in complexity and scale due to increased functional diversity, component-based development (CBD) emerges as a solution to streamline their architecture and enhance functionality reuse. CBD typically utilizes the C programming language for its direct hardware access and low-level operations, despite its susceptibility to memory-related issues. To address these concerns, this paper proposes TECS/Rust, a Rust-based framework specifically designed for TECS, which is a component framework for embedded systems. It leverages Rust's compile-time memory-safe features, such as lifetime and borrowing, to mitigate memory vulnerabilities common with C. The proposed framework not only ensures memory safety but also maintains the flexibility of CBD, automates Rust code generation for CBD components, and supports efficient integration with real-time operating systems. An evaluation of the amount of generated code indicates that the code generated by this paper framework accounts for a large percentage of the actual code. Compared to code developed without the proposed framework, the difference in execution time is minimal, indicating that the overhead introduced by the proposed framework is negligible.
翻译:随着嵌入式系统因功能多样性增加而日益复杂和规模化,基于组件的开发(CBD)作为一种解决方案应运而生,旨在简化其架构并增强功能复用性。CBD通常采用C编程语言,因其可直接访问硬件并进行底层操作,尽管该语言易受内存相关问题的影响。为应对这些问题,本文提出TECS/Rust,这是一个专为TECS(一种嵌入式系统组件框架)设计的基于Rust的框架。该框架利用Rust的编译时内存安全特性(如生命周期和借用机制)来缓解C语言中常见的内存漏洞。所提出的框架不仅确保内存安全,还保持了CBD的灵活性,实现了CBD组件的Rust代码自动生成,并支持与实时操作系统的有效集成。对生成代码量的评估表明,本文框架生成的代码在实际代码中占比较大。与未使用该框架开发的代码相比,执行时间差异极小,表明该框架引入的开销可忽略不计。