diff options
| author | Finomnis <finomnis@gmail.com> | 2023-11-01 12:13:25 +0100 |
|---|---|---|
| committer | Emil Fresk <emil.fresk@gmail.com> | 2023-11-08 19:43:09 +0000 |
| commit | 2fd3b3c4042dd7bffc5387f589a6aef3cf44a8cb (patch) | |
| tree | 255b2fa14a3b1e98e5be52ffb7240d91121cf2c1 /examples/teensy4_blinky/run.py | |
| parent | a7f81262f631d19762cca1fd59c3ed2d8ad12d91 (diff) | |
Add Monotonic for i.MX RT chip family
Diffstat (limited to 'examples/teensy4_blinky/run.py')
| -rw-r--r-- | examples/teensy4_blinky/run.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/teensy4_blinky/run.py b/examples/teensy4_blinky/run.py new file mode 100644 index 0000000..1e2fbf3 --- /dev/null +++ b/examples/teensy4_blinky/run.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +from pathlib import Path +from tempfile import TemporaryDirectory + +import subprocess +import sys + + +def main(): + if len(sys.argv) < 2: + print("Please provide the binary as first argument!") + exit(1) + + binary = sys.argv[1] + print(f"Flashing {binary} ...") + + with TemporaryDirectory() as tmpdir: + tmpdir = Path(tmpdir) + hexfile = tmpdir / "firmware.hex" + + subprocess.run(["rust-objcopy", "-O", "ihex", binary, hexfile], check=True) + subprocess.run(["teensy_loader_cli", "--mcu=imxrt1062", "-wv", hexfile], check=True) + + print("Teensy successfully flashed.") + + +if __name__ == "__main__": + main() |
