How long does it take to build a peripheral access crate (PAC) for different i.MX RT MCUs? Let's find out! Here are my measurements.
We'll use three different PAC representations:
- the classic svd2rust PAC.
- the chiptool PAC, preferred by embassy.
- the register access layer (RAL) design, first pioneered by stm32ral and later adopted by imxrt-ral.
With each of these, we'll build PACs for four different i.MX RT MCUs:
- iMXRT1011
- iMXRT1062
- iMXRT1176 (Cortex-M7 only)
- iMXRT1189 (Cortex-M33 only)
We'll clean-build all PACs in release mode, targeting the best architecture profile for each MCU. Note that this also includes the time to build PAC dependencies. We'll trust Cargo's reporting of how long it takes.
Try it out
Clone this repository along with all of its submodules.
git clone --recurse-submodules https://git.mciantyre.dev/imxrt-pac-shootout
Install the Rust targets we're using to build PACs:
rustup target add thumbv7em-none-eabihf thumbv8m.main-none-eabihf
The rest of these commands should automatically build the tools and intermediates needed for codegen.
imxrt-ral
This one is the simplest: clean-build the package for each MCU.
make -j imxrt-ral.shootout
imxrt-svd2rust
Generate four PACs using svd2rust, supplying the same patched SVDs used by imxrt-ral.
Separate each PAC's modules with form, and format them with rustfmt.
Then, build all four PACs.
make -j imxrt-svd2rust.shootout
imxrt-chiptool
Generate four PACs using chiptool, supplying the same patched SVDs used by imxrt-ral.
Use a transform file that's equivalent to what imxrt-ral uses.
Separate each PAC's modules with form, and format them with rustfmt.
Then, build all four PACs.
make -j imxrt-chiptool.shootout
License
Top-level files are licensed MIT or APACHE-2.0, at your option. Submodules carry their own licenses.
