Commit 4f53f462 authored by Tim Radvan's avatar Tim Radvan Committed by Damien George

rp2: Import uarray instead of array in rp2 module.

Some forum users noticed that `sm.exec()` took longer the more was present
on the flash filesystem connected to the RP2040.  They traced this back to
the `array` import inside `asm_pio()`, which is causing MicroPython to scan
the filesystem.

uarray is a built-in module, so importing it shouldn't require scanning the
filesystem.

We avoid moving the import to the top-level in order to keep the namespace
clean; we don't want to accidentally expose `rp2.array`.
parent 172fb523
...@@ -33,7 +33,9 @@ class PIOASMEmit: ...@@ -33,7 +33,9 @@ class PIOASMEmit:
push_thresh=32, push_thresh=32,
pull_thresh=32 pull_thresh=32
): ):
from array import array # uarray is a built-in module so importing it here won't require
# scanning the filesystem.
from uarray import array
self.labels = {} self.labels = {}
execctrl = 0 execctrl = 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment