blob: bdfadc1bb8d0becedef21c76cb9332d25c10a16a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# rust-threadx-demos
These demos use ThreadX as a Rust standard library implementation.
They work in / on
- QEMU
- a Teensy 4.0
- an iMXRT1170EVK
Right now, most apps blink LEDs and / or print `"hello world!"`.
The iMXRT1170EVK can demonstrate a basic UDP loopback, and you can `ping` this board.
These demos are for [my RustConf 2026 talk][project-landing]!
[project-landing]: https://www.mciantyre.dev/projects/rust-std-on-threadx/
## Getting started
You'll need a custom toolchain to build these examples.
[Here][project-landing] is how to build that toolchain.
All commands below assume your toolchain keeps the `stage1` name.
### QEMU
Install `qemu-system-arm` for your host.
Then, run the example:
```
cargo +stage1 --config .cargo/qemu.toml run --release --package=rust-threadx-qemu
```
QEMU's stdio uses semihosting for input and output.
### Teensy 4.0
You'll need a Teensy 4.0 board.
[Install the dependencies][teensy4-rs] discussed in the teensy4-rs project, including the command-line `teensy_loader_cli`.
Also, [install the teensy4-runner][teensy4-runner].
[teensy4-rs]: https://github.com/mciantyre/teensy4-rs
[teensy4-runner]: https://github.com/mciantyre/teensy4-rs/tree/master/tools
Run the following to compile the example, convert it to Intel HEX, and attempt board programming:
```
cargo +stage1 --config .cargo/teensy4.toml run --release --package=rust-threadx-teensy4
```
Once running on your board, you should see the LED blinking.
Connect to the USB serial interface to see the welcome message.
The board's stdio uses USB serial for stdout; stdin is not (yet) implemented.
### iMXRT1170EVK
You'll need the board, a recent build of [probe-rs], and a way to connect to the board's Ethernet network.
Connect your development host to the 100M ENET interface.
The board thinks its IP address is `192.168.5.1`.
Assign your host an address on that `/24` network.
Run the following to compile and flash the example:
[probe-rs]: https://probe.rs
```
cargo +stage1 --config .cargo/imxrt1170evk.toml run --release --package=rust-threadx-imxrt1170evk
```
You should see the LED blinking.
The board's stdio uses semihosting for input and output; probe-rs should automatically detect this.
If you `ping` the board, it responds.
Connect to the UDP loopback port `5678` and talk with yourself:
```
printf 'hello world' | nc -u -w1 192.168.5.1 5678
```
|