diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-02-04 10:24:37 -0600 |
|---|---|---|
| committer | Jeff Epler <jepler@unpythonic.net> | 2020-02-27 11:03:03 -0600 |
| commit | fa3b9eba926525751d0968aef88317ce5ad25003 (patch) | |
| tree | aa7e38f9d7401223e089bfb0125e414d156af494 /py | |
| parent | 4c710cf13b2977eeeb9f2b0506761adaf1feac53 (diff) | |
ulab: Incorporate it
Diffstat (limited to 'py')
| -rw-r--r-- | py/builtin.h | 7 | ||||
| -rw-r--r-- | py/circuitpy_defns.mk | 13 | ||||
| -rw-r--r-- | py/circuitpy_mpconfig.h | 6 | ||||
| -rwxr-xr-x | py/mpconfig.h | 4 | ||||
| -rw-r--r-- | py/objmodule.c | 8 | ||||
| -rw-r--r-- | py/py.mk | 15 |
6 files changed, 53 insertions, 0 deletions
diff --git a/py/builtin.h b/py/builtin.h index 84b99a8a4..6e0d5d9be 100644 --- a/py/builtin.h +++ b/py/builtin.h @@ -117,6 +117,13 @@ extern const mp_obj_module_t mp_module_websocket; extern const mp_obj_module_t mp_module_webrepl; extern const mp_obj_module_t mp_module_framebuf; extern const mp_obj_module_t mp_module_btree; +extern const mp_obj_module_t ulab_user_cmodule; +extern mp_obj_module_t ulab_fft_module; +extern mp_obj_module_t ulab_filter_module; +extern mp_obj_module_t ulab_linalg_module; +extern mp_obj_module_t ulab_numerical_module; +extern mp_obj_module_t ulab_poly_module; + extern const char MICROPY_PY_BUILTINS_HELP_TEXT[]; diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 68fa25d8d..92021d0d0 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -431,6 +431,19 @@ $(addprefix lib/,\ libm/atanf.c \ libm/atan2f.c \ ) +ifeq ($(MICROPY_PY_ULAB),1) +SRC_LIBM += \ +$(addprefix lib/,\ + libm/acoshf.c \ + libm/asinhf.c \ + libm/atanhf.c \ + libm/erf_lgamma.c \ + libm/log1pf.c \ + libm/sf_erf.c \ + libm/wf_lgamma.c \ + libm/wf_tgamma.c \ + ) +endif endif ifdef LD_TEMPLATE_FILE diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 53cd7b0bb..61dd901ed 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -578,6 +578,12 @@ extern const struct _mp_obj_module_t ustack_module; #define JSON_MODULE #endif +#if defined(MICROPY_PY_ULAB) && MICROPY_PY_ULAB +#define ULAB_MODULE \ + { MP_ROM_QSTR(MP_QSTR_ulab), MP_ROM_PTR(&ulab_user_cmodule) }, +#else +#define ULAB_MODULE +#endif #if MICROPY_PY_URE #define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) }, #else diff --git a/py/mpconfig.h b/py/mpconfig.h index 1512c7d3a..8f78ade5c 100755 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1173,6 +1173,10 @@ typedef double mp_float_t; #define MICROPY_PY_UJSON (0) #endif +#ifndef MICROPY_PY_ULAB +#define MICROPY_PY_ULAB (0) +#endif + #ifndef MICROPY_PY_URE #define MICROPY_PY_URE (0) #endif diff --git a/py/objmodule.c b/py/objmodule.c index 627ba79e8..c7b080300 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -206,6 +206,14 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = { { MP_ROM_QSTR(MP_QSTR_ujson), MP_ROM_PTR(&mp_module_ujson) }, #endif #endif +#if MICROPY_PY_ULAB +#if CIRCUITPY +// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here. +// TODO: move to shared-bindings/ +#else + { MP_ROM_QSTR(MP_QSTR_ulab), MP_ROM_PTR(&ulab_user_cmodule) }, +#endif +#endif #if MICROPY_PY_URE #if CIRCUITPY // CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here. @@ -105,6 +105,21 @@ $(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare $(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS) endif +ifeq ($(MICROPY_PY_ULAB),1) +SRC_MOD += $(addprefix extmod/ulab/code/, \ +filter.c \ +fft.c \ +linalg.c \ +ndarray.c \ +numerical.c \ +poly.c \ +vectorise.c \ +ulab.c \ + ) +CFLAGS_MOD += -DMICROPY_PY_ULAB=1 -DMODULE_ULAB_ENABLED=1 +$(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-sign-compare -Wno-missing-prototypes -Wno-unused-parameter -Wno-missing-declarations -Wno-error -Wno-shadow -Wno-maybe-uninitialized -DCIRCUITPY +endif + # External modules written in C. ifneq ($(USER_C_MODULES),) # pre-define USERMOD variables as expanded so that variables are immediate |
