Xiaomeng Zhang
Xiaomi Vela Development Engineer
Xiaomeng Zhang is a maintainer of the C++ runtime libraries for NuttX, an embedded RTOS. He has ported and adapted the full LLVM libc++ / libc++abi / libunwind stack, as well as libgcc / compiler-rt, to resource-constrained environments, with support for lightweight runtimes such as libminiabi and uClibc++. He previously contributed to the maintenance of the LLVM 17 C++ libraries, integrating them with NuttX and the Infineon TASKING compiler. He also led the upgrade of NuttX’s three LLVM runtime libraries to LLVM 21, and enabled C++ exception handling for dynamically loaded modules across ARM, x86-64, and RISC-V architectures.
Topic
Practical Deployment of the C++ Runtime on openVela
openVela is Xiaomi’s open-source embedded real-time operating system, already deployed at scale across wearables and IoT devices and now expanding into automotive applications such as smart cockpits, intelligent driving, and centralized domain controllers. Making C++ “fully usable” in resource-constrained environments with highly heterogeneous compilers and architectures requires bringing the complete desktop-class C++ runtime stack—including libc++, libc++abi, libunwind, libgcc, and compiler-rt—into the RTOS and making it work reliably in production. This talk shares a series of practical projects on openVela, including maintaining and porting LLVM 17/21 C++ libraries, upgrading the GCC 13–15 toolchain, adapting C++ libraries for the TASKING compiler targeting automotive-grade MCUs, and enabling C++ exception handling for loadable ELF modules across ARM, ARM64, x86-64, and RISC-V architectures. Outline Background: openVela’s system software landscape and why a complete C++ runtime matters on an RTOS—from wearables and IoT to automotive systems The Big Picture: Bringing the C++ standard library and runtime into an RTOS—compiler heterogeneity, resource constraints, and multi-architecture support Case Study 1: C++ exceptions in loadable ELF modules across four architectures—pluggable unwind engine design and root-cause analysis of an “uncaught exception” issue Case Study 2: Joint GCC 13→15 and LLVM 17→21 upgrades Case Study 3: Bringing C++ to automotive-grade MCUs—adapting to the TASKING compiler Lessons Learned: A reusable cross-layer debugging methodology—from language standards and compiler ABI to the OS kernel and CPU architecture Key Takeaways A practical roadmap for porting a complete C++ runtime to an RTOS, including key design trade-offs A reusable cross-layer debugging methodology spanning standards → compiler ABI → kernel → architecture, with GDB and disassembly as evidence Practical experience designing a pluggable exception-unwinding architecture across libgcc/libunwind × built-in/module × EHABI/DWARF Real-world challenges and solutions for multi-compiler, multi-architecture deployment across GCC, Clang, TASKING, and four CPU architectures, including automotive-grade MCUs Practical techniques for reducing C++ code size, including why garbage collection alone is insufficient and which heavyweight components require manual optimization