aboutsummaryrefslogtreecommitdiff

This repository contains flash programming algorithms for i.MX RT MCUs. The algorithms are designed for use in probe-rs. They're written in Rust and support a variety of MCUs and flash parts.

These flash programming algorithms compete with NXP's flash programming algorithms, which are distributed in device family packs (DFPs). NXP's algorithms also work with probe-rs, so prefer those if you want something official.

I've found these algorithms can program flash 2x to 3x faster than NXP's offerings. These algorithms definitely support page crossings; meaning, if the debug probe wants to program 4KiB into flash, the algorithm will automatically chunk it into pages of 256 bytes. This trick reduces I/O overhead between host and debug probe. (Admittedly, NXP's algorithms might support this, but I never tried. It's fun writing these algorithms!)

Supported boards include

  • IMXRT1010EVK
  • IMXRT1040EVK
  • IMXRT1160EVK
  • IMXRT1170EVK

You'll find the algorithms in their respective top-level directories. These four boards sport four different MCUs, which you'll also find in the top-level directories. Furthermore, those four boards have three different flash parts; the flash part implementation is in src/ as part of the core package.

Before attempting to generate the flash programming algorithms for probe-rs, install the target-gen tool. It's available in the probe-rs repository. My fork has some target-gen patches that might be useful.

Use target-gen test to test each algorithm on its EVK. For convenience, there are dedicated Cargo configurations you can use. For example, to test the algorithm on a 1010EVK, run

cargo --config .cargo/1010evk.toml run --release --package=imxrt1010evk

To test on a different EVK, change the Cargo configuration and the package.

Here's how to generate the algorithm, represented as YAML, for the 1010EVK:

cargo --config .cargo/flash_algo.toml run --release --package=imxrt1010evk

To generate the algorithm for a different EVK, change the --package selection.

Eventually, I might try to define a universal flash programming algorithm, one that works across different flash parts. But for now, they're separate by manufacturer.

FlexSPI pin muxing assumes you're using the boot ROM's primary FlexSPI1 interface. In fact, all algorithms assume you're using FlexSPI1! If your board is doing something different, then you'll need to manually change the pin muxing / FlexSPI instance. There's no board-by-board configuration.

License: APACHE-2.0