From c3108fef60ab2b3c347c4762c497a8520901e157 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 20 Jul 2026 12:43:16 -0400 Subject: [PATCH 1/4] update ulab to 6.12 + latest fix 2b6e0cf --- extmod/ulab | 2 +- locale/circuitpython.pot | 176 +++++++++++++++++++++++++++++++++------ 2 files changed, 151 insertions(+), 27 deletions(-) diff --git a/extmod/ulab b/extmod/ulab index 1d3ddd8f522..2b6e0cfaa0d 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 1d3ddd8f5228e2c7335dac71f4846e6abb0ec9f9 +Subproject commit 2b6e0cfaa0d095e497e5a7599e0dbe3d09614ec2 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index bc0286dfe61..1ecb590f02f 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -100,6 +100,10 @@ msgstr "" msgid "ndarray length overflows" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is " +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot convert complex type" msgstr "" @@ -154,11 +158,23 @@ msgid "operation is not supported for given type" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be integer or tuple of integers" +msgid "keyword argument must be tuple of integers" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/random/random.c -msgid "maximum number of dimensions is " +#: extmod/ulab/code/ndarray.c +msgid "too many axes specified" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "axis index out of bounds" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "repeated indices" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "shape must be integer or tuple of integers" msgstr "" #: extmod/ulab/code/ndarray.c @@ -225,6 +241,31 @@ msgstr "" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/user/user.c +#: shared-bindings/_eve/__init__.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c +msgid "object too deep for desired array" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c +msgid "cannot cast array data from dtype" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c +msgid "minlength must not be negative" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c +msgid "the weights and list don't have the same length" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c +msgid "cannot cast weigths to float" +msgstr "" + #: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c #: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c #: extmod/ulab/code/numpy/vector.c @@ -259,7 +300,7 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c msgid "input arrays are not compatible" msgstr "" @@ -271,6 +312,45 @@ msgstr "" msgid "number of points must be at least 2" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "indexing should be 'xy' or 'ij'" +msgstr "" + +#: extmod/ulab/code/numpy/create.c +msgid "indexing must be 'xy' or 'ij'" +msgstr "" + +#: extmod/ulab/code/numpy/create.c +msgid "too many input arrays" +msgstr "" + +#: extmod/ulab/code/numpy/create.c extmod/ulab/code/numpy/numerical.c +#: extmod/ulab/code/numpy/transform.c +msgid "arguments must be ndarrays" +msgstr "" + +#: extmod/ulab/code/numpy/create.c +msgid "arguments must be 1D arrays" +msgstr "" + +#: extmod/ulab/code/numpy/create.c +msgid "input is not an array" +msgstr "" + +#: extmod/ulab/code/numpy/create.c extmod/ulab/code/numpy/numerical.c +#: ports/espressif/common-hal/pulseio/PulseIn.c +#: shared-bindings/bitmaptools/__init__.c +msgid "index out of range" +msgstr "" + +#: extmod/ulab/code/numpy/create.c +msgid "mode should be raise, wrap or clip" +msgstr "" + +#: extmod/ulab/code/numpy/create.c +msgid "index must not be negative" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "offset must be non-negative and no greater than buffer length" msgstr "" @@ -291,7 +371,7 @@ msgstr "" msgid "FFT is implemented for linear arrays only" msgstr "" -#: extmod/ulab/code/numpy/fft/fft_tools.c +#: extmod/ulab/code/numpy/fft/fft_tools.c extmod/ulab/code/utils/utils.c msgid "input array length must be power of 2" msgstr "" @@ -400,10 +480,6 @@ msgstr "" msgid "axis too long" msgstr "" -#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/numpy/transform.c -msgid "arguments must be ndarrays" -msgstr "" - #: extmod/ulab/code/numpy/numerical.c msgid "cross is defined for 1D arrays of length 3" msgstr "" @@ -412,12 +488,6 @@ msgstr "" msgid "diff argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: shared-bindings/bitmaptools/__init__.c -msgid "index out of range" -msgstr "" - #: extmod/ulab/code/numpy/numerical.c msgid "differentiation order out of range" msgstr "" @@ -463,10 +533,10 @@ msgid "argument must be None, an integer or a tuple of integers" msgstr "" #: extmod/ulab/code/numpy/random/random.c -msgid "shape must be None, and integer or a tuple of integers" +msgid "shape must be None, an integer or a tuple of integers" msgstr "" -#: extmod/ulab/code/numpy/random/random.c +#: extmod/ulab/code/numpy/random/random.c extmod/ulab/code/ulab_tools.c msgid "out has wrong type" msgstr "" @@ -478,7 +548,7 @@ msgstr "" msgid "size must match out.shape when used together" msgstr "" -#: extmod/ulab/code/numpy/random/random.c +#: extmod/ulab/code/numpy/random/random.c extmod/ulab/code/ulab_tools.c msgid "output array must be contiguous" msgstr "" @@ -502,7 +572,7 @@ msgstr "" msgid "dimensions do not match" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/vector.c extmod/ulab/code/utils/utils.c msgid "out must be an ndarray" msgstr "" @@ -538,7 +608,7 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/vector.c extmod/ulab/code/scipy/integrate/integrate.c msgid "first argument must be a callable" msgstr "" @@ -546,18 +616,36 @@ msgstr "" msgid "wrong output type" msgstr "" -#: extmod/ulab/code/scipy/linalg/linalg.c -msgid "first two arguments must be ndarrays" +#: extmod/ulab/code/scipy/integrate/integrate.c +#, c-format +msgid "can't convert arg %d from %s to float" msgstr "" -#: extmod/ulab/code/scipy/linalg/linalg.c extmod/ulab/code/user/user.c -msgid "input must be a dense ndarray" +#: extmod/ulab/code/scipy/integrate/integrate.c +msgid "levels needs to be a positive integer" msgstr "" +#: extmod/ulab/code/scipy/integrate/integrate.c +msgid "steps needs to be a positive integer" +msgstr "" + +#: extmod/ulab/code/scipy/integrate/integrate.c #: extmod/ulab/code/scipy/optimize/optimize.c msgid "first argument must be a function" msgstr "" +#: extmod/ulab/code/scipy/integrate/integrate.c +msgid "order needs to be a positive integer" +msgstr "" + +#: extmod/ulab/code/scipy/linalg/linalg.c +msgid "first two arguments must be ndarrays" +msgstr "" + +#: extmod/ulab/code/scipy/linalg/linalg.c extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "function has the same sign at the ends of interval" msgstr "" @@ -622,8 +710,16 @@ msgstr "" msgid "input must be square matrix" msgstr "" -#: extmod/ulab/code/user/user.c shared-bindings/_eve/__init__.c -msgid "input must be an ndarray" +#: extmod/ulab/code/ulab_tools.c +msgid "out array has wrong dtype" +msgstr "" + +#: extmod/ulab/code/ulab_tools.c +msgid "out array has wrong dimension" +msgstr "" + +#: extmod/ulab/code/ulab_tools.c +msgid "out array has wrong shape" msgstr "" #: extmod/ulab/code/utils/utils.c @@ -638,6 +734,34 @@ msgstr "" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/utils/utils.c +msgid "spectrogram is defined for ndarrays only" +msgstr "" + +#: extmod/ulab/code/utils/utils.c +msgid "spectrogram is implemented for 1D arrays only" +msgstr "" + +#: extmod/ulab/code/utils/utils.c +msgid "out array must be a 1D array of float type" +msgstr "" + +#: extmod/ulab/code/utils/utils.c +msgid "input and out arrays must have same length" +msgstr "" + +#: extmod/ulab/code/utils/utils.c +msgid "scratchpad must be an ndarray" +msgstr "" + +#: extmod/ulab/code/utils/utils.c +msgid "scratchpad must be a 1D dense float array" +msgstr "" + +#: extmod/ulab/code/utils/utils.c +msgid "scratchpad must be twice as long as input" +msgstr "" + #: extmod/vfs_fat.c py/moderrno.c msgid "Read-only filesystem" msgstr "" From be87246839b9092801fdf380d64a2fdc3d3dee7a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 21 Jul 2026 22:20:10 -0400 Subject: [PATCH 2/4] ulab: disable ndarray modulo and scipy.integrate to reduce build size The 6.12 ulab update added the ndarray % operator (~3.9kB) and a new scipy.integrate module (~4.0kB), pushing size-constrained boards over. Disable both by default. The scipy.integrate disable is groundwork: ULAB_SCIPY_HAS_INTEGRATE_MODULE does not yet drop the module's code upstream (the flag only gates the scipy namespace entry). It becomes an actual size win once the upstream ulab fix lands and the submodule is bumped. Co-Authored-By: Claude Opus 4.8 --- py/circuitpy_mpconfig.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 381cb9538e4..bd63df1daa5 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -415,6 +415,19 @@ extern const struct _mp_obj_module_t nvm_module; #define ULAB_NUMPY_HAS_RANDOM_MODULE (0) #endif +// The ndarray modulo operator is large; disable it to keep the build small. +#ifndef NDARRAY_HAS_BINARY_OP_MODULO +#define NDARRAY_HAS_BINARY_OP_MODULO (0) +#endif +#ifndef NDARRAY_HAS_INPLACE_MODULO +#define NDARRAY_HAS_INPLACE_MODULO (0) +#endif + +// The scipy.integrate module is large; disable it to keep the build small. +#ifndef ULAB_SCIPY_HAS_INTEGRATE_MODULE +#define ULAB_SCIPY_HAS_INTEGRATE_MODULE (0) +#endif + #if CIRCUITPY_ULAB // ulab requires reverse special methods #if defined(MICROPY_PY_REVERSE_SPECIAL_METHODS) && !MICROPY_PY_REVERSE_SPECIAL_METHODS From 85a6ed088c13a7f6d585af4f2e2cb59408ce1a66 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 22 Jul 2026 10:12:15 -0400 Subject: [PATCH 3/4] temporary: see which boards overflow ulab default modules are selected --- extmod/ulab | 2 +- py/circuitpy_mpconfig.h | 35 ++++++++++++++++++----------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/extmod/ulab b/extmod/ulab index 2b6e0cfaa0d..ec98536e27f 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 2b6e0cfaa0d095e497e5a7599e0dbe3d09614ec2 +Subproject commit ec98536e27fe9b91f00478abef6fc950bebf524a diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index bd63df1daa5..0678d27256f 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -410,23 +410,24 @@ extern const struct _mp_obj_module_t nvm_module; #define ULAB_SUPPORTS_COMPLEX (0) #endif -// The random module is fairly large. -#ifndef ULAB_NUMPY_HAS_RANDOM_MODULE -#define ULAB_NUMPY_HAS_RANDOM_MODULE (0) -#endif - -// The ndarray modulo operator is large; disable it to keep the build small. -#ifndef NDARRAY_HAS_BINARY_OP_MODULO -#define NDARRAY_HAS_BINARY_OP_MODULO (0) -#endif -#ifndef NDARRAY_HAS_INPLACE_MODULO -#define NDARRAY_HAS_INPLACE_MODULO (0) -#endif - -// The scipy.integrate module is large; disable it to keep the build small. -#ifndef ULAB_SCIPY_HAS_INTEGRATE_MODULE -#define ULAB_SCIPY_HAS_INTEGRATE_MODULE (0) -#endif +// TEMPORARY TO SEE WHAT OVERFLOWS +// // Disable some ulab modules to make it fit on SAMD51x19 boards +// // Consider turning on these modules on boards with more flash. + +// #ifndef ULAB_NUMPY_HAS_RANDOM_MODULE +// #define ULAB_NUMPY_HAS_RANDOM_MODULE (0) +// #endif + +// #ifndef NDARRAY_HAS_BINARY_OP_MODULO +// #define NDARRAY_HAS_BINARY_OP_MODULO (0) +// #endif +// #ifndef NDARRAY_HAS_INPLACE_MODULO +// #define NDARRAY_HAS_INPLACE_MODULO (0) +// #endif + +// #ifndef ULAB_SCIPY_HAS_INTEGRATE_MODULE +// #define ULAB_SCIPY_HAS_INTEGRATE_MODULE (0) +// #endif #if CIRCUITPY_ULAB // ulab requires reverse special methods From f3a036dbc2ff4ffa2459b1b852cfff242025d487 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 22 Jul 2026 12:38:57 -0400 Subject: [PATCH 4/4] test: ulab: integrate off, everything else on --- py/circuitpy_mpconfig.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 0678d27256f..6fa6552e415 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -425,9 +425,9 @@ extern const struct _mp_obj_module_t nvm_module; // #define NDARRAY_HAS_INPLACE_MODULO (0) // #endif -// #ifndef ULAB_SCIPY_HAS_INTEGRATE_MODULE -// #define ULAB_SCIPY_HAS_INTEGRATE_MODULE (0) -// #endif +#ifndef ULAB_SCIPY_HAS_INTEGRATE_MODULE +#define ULAB_SCIPY_HAS_INTEGRATE_MODULE (0) +#endif #if CIRCUITPY_ULAB // ulab requires reverse special methods