Rust std on ThreadX

I'm porting the Rust standard library to ThreadX. Right now, it runs on some NXP i.MX RT MCUs. It also works in a QEMU ARM emulator as well as a Raspberry Pi Pico board. It's an early stage project, but there's plenty you could play with.

This page summarizes progress, shares links to example and dependencies, and tells you how to build the toolchain. The bottom of this page accumulates blog posts and progress updates. If you have issues or suggestions, send me an email or find me on Matrix.

I'm talking about this project at RustConf 2026.

What's available?

The available std modules are

  • thread
  • sync
  • alloc
  • time
  • stdio, implemented in external packages
  • net, but only a bit

If you try anything else, it'll likely panic at runtime.

Examples

Once you have the distribution (explained below), here are the demos. The demos include some hardware drivers, including an i.MX RT ENET driver, written in Rust, with NetX Duo compatibility.

If you don't have hardware, try the QEMU example! If your i.MX RT MCU inventory overlaps with my inventory, let me know, and I'll get that system working for us.

Distribution

The threadx branch of my Rust fork contains a standard library built on ThreadX. The supported targets are called

thumbv7em-threadx-eabihf
thumbv6m-threadx-eabi

Building

Before you try building this distribution, make sure you can build libthreadx-sys for the usual thumbv7em-none-eabihf target. If you can't build libthreadx-sys in isolation, then you'll have issues building it with the standard library.

After that, it's a little different than what's discussed here. After cloning, use x.py to create a bootstrap.toml with library defaults. Within that bootstrap.toml, specify the C toolchain used to build ThreadX for this new target. Additionally, specify any Rust configurations for ThreadX, NetX Duo, and related libraries. My bootstrap.toml includes

[target.thumbv7em-threadx-eabihf]
cc = "arm-none-eabi-gcc"
cxx = "arm-none-eabi-g++"
ar = "arm-none-eabi-ar"
rustflags = [
    # For enhanced NetX Duo bindings, supported
    # by an i.MX RT ENET driver.
    "--cfg", "nx_enable_interface_capability",
]

[target.thumbv6m-threadx-eabi]
cc = "arm-none-eabi-gcc"
cxx = "arm-none-eabi-g++"
ar = "arm-none-eabi-ar"

If you're on a MacOS host, your bootstrap.toml might also need

[rust]
lld = true

(If you're on Linux, you shouldn't need it, but it also shouldn't hurt. And if you're on Windows, I'm sorry, I'm not sure!)

Additionally, edit .cargo/config.toml to include something like

[env]
# My preferred build settings for NetX Duo, supporting an i.MX RT MCU.
"CFLAGS_thumbv7em-threadx-eabihf" = "-DNX_PACKET_ALIGNMENT=64 -DNX_DISABLE_ICMP_RX_CHECKSUM -DNX_DISABLE_ICMP_TX_CHECKSUM -DNX_DISABLE_IP_RX_CHECKSUM -DNX_DISABLE_IP_TX_CHECKSUM -DNX_DISABLE_UDP_RX_CHECKSUM -DNX_DISABLE_UDP_TX_CHECKSUM"

# No CFLAGS strictly needed for thumbv6m, but you're free
# to configure your ThreadX build as you want!

Since you're building NetX Duo with the standard library, the CFLAGS variable shown above should include configurations for that library. My settings for an i.MX RT ENET driver are shown in the example above.

Build a toolchain for the ThreadX targets as well as your host. On my Linux workstation, I usually say

./x build --target=thumbv7em-threadx-eabihf,thumbv6m-threadx-eabi,x86_64-unknown-linux-gnu

And on my old Macbook, I say

./x build --target=thumbv7em-threadx-eabihf,thumbv6m-threadx-eabi,x86_64-apple-darwin

Once complete, rustup should know about your stage1 toolchain.

rustc +stage1 --print target-list | grep threadx

Use stage1 to play with Rust std on ThreadX programs!

Dependencies

The distribution tracks the rustc-dep-of-std branches in all of these repos. The main branches are usable in no_std programs, without the standard library.