8000 Merge pull request #2583 from jepler/ulab · gregdavill/circuitpython@b4e1955 · GitHub
[go: up one dir, main page]

Skip to content

Commit b4e1955

Browse files
authored
Merge pull request adafruit#2583 from jepler/ulab
Add 'ulab' as an extmod; enable on nrf and most samd51 boards
2 parents 4aec5d1 + da31acf commit b4e1955

32 files changed

+544
-16
lines changed

.gitmodules

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,12 @@
114114
[submodule "frozen/Adafruit_CircuitPython_Register"]
115115
path = frozen/Adafruit_CircuitPython_Register
116116
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git
117+
[submodule "extmod/ulab"]
118+
path = extmod/ulab
119+
url = https://github.com/adafruit/circuitpython-ulab
117120
[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"]
118121
path = frozen/Adafruit_CircuitPython_ESP32SPI
119122
url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI
120123
[submodule "frozen/Adafruit_CircuitPython_Requests"]
121124
path = frozen/Adafruit_CircuitPython_Requests
122-
url = https://github.com/adafruit/Adafruit_CircuitPython_Requests
125+
url = https://github.com/adafruit/Adafruit_CircuitPython_Requests

extmod/ulab

Submodule ulab added at 42d831e

lib/libm/erf_lgamma.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525

2626
#include "fdlibm.h"
27+
#pragma GCC diagnostic ignored "-Wfloat-equal"
2728

2829
#define __ieee754_logf logf
2930

lib/libm/log1pf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
#include "libm.h"
2020

21+
#pragma GCC diagnostic ignored "-Wfloat-equal"
22+
2123
static const float
2224
ln2_hi = 6.9313812256e-01, /* 0x3f317180 */
2325
ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */

lib/libm/math.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ float copysignf(float x, float y) {
5050

5151
static const float _M_LN10 = 2.30258509299404; // 0x40135d8e
5252
float log10f(float x) { return logf(x) / (float)_M_LN10; }
53+
#undef _M_LN2
54+
static const float _M_LN2 = 0.6931472;
55+
float log2f(float x) { return logf(x) / (float)_M_LN2; }
5356

5457
float tanhf(float x) {
5558
if (isinf(x)) {

locale/ID.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
11+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"

locale/circuitpython.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
11+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"

locale/de_DE.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
10+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1111
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
1212
"Last-Translator: Pascal Deneaux\n"
1313
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"

locale/en_US.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
10+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1111
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
1212
"Last-Translator: \n"
1313
"Language-Team: \n"

locale/en_x_pirate.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
10+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1111
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
1212
"Last-Translator: \n"
1313
"Language-Team: @sommersoft, @MrCertainly\n"

locale/es.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
10+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1111
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
1212
"Last-Translator: \n"
1313
"Language-Team: \n"

locale/fil.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
10+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1111
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
1212
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
1313
"Language-Team: fil\n"

locale/fr.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: 0.1\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
11+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1212
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
1313
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
1414
"Language-Team: fr\n"

locale/it_IT.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
11+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1212
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
1313
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
1414
"Language-Team: \n"

locale/ko.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
11+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1212
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
1313
"Last-Translator: \n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"

locale/pl.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
10+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1111
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
1212
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
1313
"Language-Team: pl\n"

locale/pt_BR.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
11+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1212
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
1313
"Last-Translator: \n"
1414
"Language-Team: \n"

locale/zh_Latn_pinyin.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: circuitpython-cn\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2020-03-02 11:20-0500\n"
10+
"POT-Creation-Date: 2020-03-03 20:13-0600\n"
1111
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
1212
"Last-Translator: hexthat\n"
1313
"Language-Team: Chinese Hanyu Pinyin\n"

ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ CIRCUITPY_DISPLAYIO = 0
1515
CIRCUITPY_NETWORK = 0
1616
CIRCUITPY_PS2IO = 0
1717
CIRCUITPY_AUDIOMP3 = 0
18+
19+
MICROPY_PY_ULAB = 0

ports/atmel-samd/mpconfigport.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ ifndef CIRCUITPY_SAMD
6262
CIRCUITPY_SAMD = 1
6363
endif
6464

65+
ifndef MICROPY_PY_ULAB
66+
ifneq ($(CIRCUITPY_SMALL_BUILD),1)
67+
MICROPY_PY_ULAB = 1
68+
endif
69+
endif
70+
6571
endif # samd51
6672

6773
INTERNAL_LIBM = 1

ports/nrf/mpconfigport.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@ NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
6969
# Defined here because system_nrf52840.c doesn't #include any of our own include files.
7070
CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
7171

72+
MICROPY_PY_ULAB = 1
7273
endif

ports/unix/mpconfigport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,3 +323,6 @@ void mp_unix_mark_exec(void);
323323
// For debugging purposes, make printf() available to any source file.
324324
#include <stdio.h>
325325
#endif
326+
327+
#define MICROPY_PY_BUILTINS_HELP (1)
328+
#define MICROPY_PY_BUILTINS_HELP_MODULES (1)

ports/unix/mpconfigport.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ MICROPY_PY_JNI = 0
4040
# Avoid using system libraries, use copies bundled with MicroPython
4141
# as submodules (currently affects only libffi).
4242
MICROPY_STANDALONE = 0
43+
44+
MICROPY_PY_ULAB = 1

py/builtin.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ extern const mp_obj_module_t mp_module_websocket;
117117
extern const mp_obj_module_t mp_module_webrepl;
118118
extern const mp_obj_module_t mp_module_framebuf;
119119
extern const mp_obj_module_t mp_module_btree;
120+
extern const mp_obj_module_t ulab_user_cmodule;
121+
extern mp_obj_module_t ulab_fft_module;
122+
extern mp_obj_module_t ulab_filter_module;
123+
extern mp_obj_module_t ulab_linalg_module;
124+
extern mp_obj_module_t ulab_numerical_module;
125+
extern mp_obj_module_t ulab_poly_module;
126+
120127

121128
extern const char MICROPY_PY_BUILTINS_HELP_TEXT[];
122129

py/circuitpy_defns.mk

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,19 @@ $(addprefix lib/,\
431431
libm/atanf.c \
432432
libm/atan2f.c \
433433
)
434+
ifeq ($(MICROPY_PY_ULAB),1)
435+
SRC_LIBM += \
436+
$(addprefix lib/,\
437+
libm/acoshf.c \
438+
libm/asinhf.c \
439+
libm/atanhf.c \
440+
libm/erf_lgamma.c \
441+
libm/log1pf.c \
442+
libm/sf_erf.c \
443+
libm/wf_lgamma.c \
444+
libm/wf_tgamma.c \
445+
)
446+
endif
434447
endif
435448

436449
ifdef LD_TEMPLATE_FILE

py/circuitpy_mpconfig.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,12 @@ extern const struct _mp_obj_module_t ustack_module;
578578
#define JSON_MODULE
579579
#endif
580580

581+
#if defined(MICROPY_PY_ULAB) && MICROPY_PY_ULAB
582+
#define ULAB_MODULE \
583+
{ MP_ROM_QSTR(MP_QSTR_ulab), MP_ROM_PTR(&ulab_user_cmodule) },
584+
#else
585+
#define ULAB_MODULE
586+
#endif
581587
#if MICROPY_PY_URE
582588
#define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) },
583589
#else

py/mpconfig.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,10 @@ typedef double mp_float_t;
11731173
#define MICROPY_PY_UJSON (0)
11741174
#endif
11751175

1176+
#ifndef MICROPY_PY_ULAB
1177+
#define MICROPY_PY_ULAB (0)
1178+
#endif
1179+
11761180
#ifndef MICROPY_PY_URE
11771181
#define MICROPY_PY_URE (0)
11781182
#endif

py/objmodule.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
206206
{ MP_ROM_QSTR(MP_QSTR_ujson), MP_ROM_PTR(&mp_module_ujson) },
207207
#endif
208208
#endif
209+
#if MICROPY_PY_ULAB
210+
#if CIRCUITPY
211+
// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here.
212+
// TODO: move to shared-bindings/
213+
#else
214+
{ MP_ROM_QSTR(MP_QSTR_ulab), MP_ROM_PTR(&ulab_user_cmodule) },
215+
#endif
216+
#endif
209217
#if MICROPY_PY_URE
210218
#if CIRCUITPY
211219
// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here.

py/py.mk

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,22 @@ $(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare
105105
$(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS)
106106
endif
107107

108+
ifeq ($(MICROPY_PY_ULAB),1)
109+
SRC_MOD += $(addprefix extmod/ulab/code/, \
110+
create.c \
111+
fft.c \
112+
filter.c \
113+
linalg.c \
114+
ndarray.c \
115+
numerical.c \
116+
poly.c \
117+
ulab.c \
118+
vectorise.c \
119+
)
120+
CFLAGS_MOD += -DMICROPY_PY_ULAB=1 -DMODULE_ULAB_ENABLED=1
121+
$(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
122+
endif
123+
108124
# External modules written in C.
109125
ifneq ($(USER_C_MODULES),)
110126
# pre-define USERMOD variables as expanded so that variables are immediate

shared-bindings/audiocore/RawSample.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
//| first sample will be for channel 1, the second sample will be for channel two, the third for
5050
//| channel 1 and so on.
5151
//|
52-
//| :param array buffer: An `array.array` with samples
52+
//| :param array.array buffer: An `array.array` with samples
5353
//| :param int channel_count: The number of channels in the buffer
5454
//| :param int sample_rate: The desired playback sample rate
5555
//|

0 commit comments

Comments
 (0)
0