summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorKevin Banks <kevin@firia.com>2021-02-03 16:48:28 -0600
committerKevin Banks <kevin@firia.com>2021-02-03 16:48:28 -0600
commit215a56c920b64d522e505d20e1480859fd0ea333 (patch)
tree1bee95771e6aeeb459eedb1837382f0431bd565b /py
parent00926b687a619f18deb08c1f59f868a4e9b8514a (diff)
parentadaf43d6d84a49c382fd6fab3cb96da33aff02e4 (diff)
Merge branch 'main' into webusb (trying to get CI back online)
Diffstat (limited to 'py')
-rw-r--r--py/builtinhelp.c13
-rw-r--r--py/circuitpy_defns.mk5
-rw-r--r--py/circuitpy_mpconfig.h105
-rw-r--r--py/circuitpy_mpconfig.mk22
4 files changed, 95 insertions, 50 deletions
diff --git a/py/builtinhelp.c b/py/builtinhelp.c
index d12e088d6..e1dcb6096 100644
--- a/py/builtinhelp.c
+++ b/py/builtinhelp.c
@@ -152,9 +152,18 @@ STATIC void mp_help_print_obj(const mp_obj_t obj) {
mp_obj_type_t *type = mp_obj_get_type(obj);
// try to print something sensible about the given object
- mp_print_str(MP_PYTHON_PRINTER, "object ");
+ const compressed_string_t* compressed = translate("object ");
+ char decompressed_object[decompress_length(compressed)];
+ decompress(compressed, decompressed_object);
+
+ mp_print_str(MP_PYTHON_PRINTER, decompressed_object);
mp_obj_print(obj, PRINT_STR);
- mp_printf(MP_PYTHON_PRINTER, " is of type %q\n", type->name);
+
+ compressed = translate(" is of type %q\n");
+ char decompressed_typestring[decompress_length(compressed)];
+ decompress(compressed, decompressed_typestring);
+
+ mp_printf(MP_PYTHON_PRINTER, decompressed_typestring, type->name);
mp_map_t *map = NULL;
if (type == &mp_type_module) {
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index 5eb7992b1..f907bf7ae 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -51,6 +51,7 @@ BASE_CFLAGS = \
-DCIRCUITPY_SOFTWARE_SAFE_MODE=0x0ADABEEF \
-DCIRCUITPY_CANARY_WORD=0xADAF00 \
-DCIRCUITPY_SAFE_RESTART_WORD=0xDEADBEEF \
+ -DCIRCUITPY_BOARD_ID="\"$(BOARD)\"" \
--param max-inline-insns-single=500
# Use these flags to debug build times and header includes.
@@ -234,6 +235,9 @@ endif
ifeq ($(CIRCUITPY_RANDOM),1)
SRC_PATTERNS += random/%
endif
+ifeq ($(CIRCUITPY_RP2PIO),1)
+SRC_PATTERNS += rp2pio/%
+endif
ifeq ($(CIRCUITPY_ROTARYIO),1)
SRC_PATTERNS += rotaryio/%
endif
@@ -387,6 +391,7 @@ SRC_COMMON_HAL_ALL = \
socketpool/Socket.c \
ssl/__init__.c \
ssl/SSLContext.c \
+ ssl/SSLSocket.c \
supervisor/Runtime.c \
supervisor/__init__.c \
watchdog/WatchDogMode.c \
diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h
index a3411b7ad..ee23c7156 100644
--- a/py/circuitpy_mpconfig.h
+++ b/py/circuitpy_mpconfig.h
@@ -195,21 +195,12 @@ typedef long mp_off_t;
#define MICROPY_PY_BUILTINS_STR_CENTER (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_STR_PARTITION (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (CIRCUITPY_FULL_BUILD)
-#define MICROPY_PY_UERRNO (CIRCUITPY_FULL_BUILD)
#ifndef MICROPY_PY_COLLECTIONS_ORDEREDDICT
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (CIRCUITPY_FULL_BUILD)
#endif
-#ifndef MICROPY_PY_UBINASCII
-#define MICROPY_PY_UBINASCII (CIRCUITPY_FULL_BUILD)
-#endif
-// Opposite setting is deliberate.
-#define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_FULL_BUILD)
-#ifndef MICROPY_PY_URE
-#define MICROPY_PY_URE (CIRCUITPY_FULL_BUILD)
-#endif
-#define MICROPY_PY_URE_MATCH_GROUPS (CIRCUITPY_FULL_BUILD)
-#define MICROPY_PY_URE_MATCH_SPAN_START_END (CIRCUITPY_FULL_BUILD)
-#define MICROPY_PY_URE_SUB (CIRCUITPY_FULL_BUILD)
+#define MICROPY_PY_URE_MATCH_GROUPS (CIRCUITPY_RE)
+#define MICROPY_PY_URE_MATCH_SPAN_START_END (CIRCUITPY_RE)
+#define MICROPY_PY_URE_SUB (CIRCUITPY_RE)
// LONGINT_IMPL_xxx are defined in the Makefile.
//
@@ -228,7 +219,7 @@ typedef long mp_off_t;
#endif
#ifndef MICROPY_PY_REVERSE_SPECIAL_METHODS
-#define MICROPY_PY_REVERSE_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD)
+#define MICROPY_PY_REVERSE_SPECIAL_METHODS (CIRCUITPY_ULAB || CIRCUITPY_FULL_BUILD)
#endif
#if INTERNAL_FLASH_FILESYSTEM == 0 && QSPI_FLASH_FILESYSTEM == 0 && SPI_FLASH_FILESYSTEM == 0 && !DISABLE_FILESYSTEM
@@ -301,6 +292,13 @@ extern const struct _mp_obj_module_t audiopwmio_module;
#define AUDIOPWMIO_MODULE
#endif
+#if CIRCUITPY_BINASCII
+#define MICROPY_PY_UBINASCII CIRCUITPY_BINASCII
+#define BINASCII_MODULE { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) },
+#else
+#define BINASCII_MODULE
+#endif
+
#if CIRCUITPY_BITBANGIO
#define BITBANGIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_bitbangio), (mp_obj_t)&bitbangio_module },
extern const struct _mp_obj_module_t bitbangio_module;
@@ -399,6 +397,16 @@ extern const struct _mp_obj_module_t terminalio_module;
#define TERMINALIO_MODULE
#endif
+#if CIRCUITPY_ERRNO
+#define MICROPY_PY_UERRNO (1)
+// Uses about 80 bytes.
+#define MICROPY_PY_UERRNO_ERRORCODE (1)
+#define ERRNO_MODULE { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) },
+#else
+#define ERRNO_MODULE
+#
+#endif
+
#if CIRCUITPY_ESPIDF
extern const struct _mp_obj_module_t espidf_module;
#define ESPIDF_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_espidf),(mp_obj_t)&espidf_module },
@@ -470,6 +478,18 @@ extern const struct _mp_obj_module_t ipaddress_module;
#define IPADDRESS_MODULE
#endif
+#if CIRCUITPY_JSON
+#define MICROPY_PY_UJSON (1)
+#define MICROPY_PY_IO (1)
+#define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) },
+#else
+#ifndef MICROPY_PY_IO
+// We don't need MICROPY_PY_IO unless someone else wants it.
+#define MICROPY_PY_IO (0)
+#endif
+#define JSON_MODULE
+#endif
+
#if CIRCUITPY_MATH
extern const struct _mp_obj_module_t math_module;
#define MATH_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_math), (mp_obj_t)&math_module },
@@ -581,13 +601,6 @@ extern const struct _mp_obj_module_t pwmio_module;
#define PWMIO_MODULE
#endif
-#if CIRCUITPY_RGBMATRIX
-extern const struct _mp_obj_module_t rgbmatrix_module;
-#define RGBMATRIX_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rgbmatrix),(mp_obj_t)&rgbmatrix_module },
-#else
-#define RGBMATRIX_MODULE
-#endif
-
#if CIRCUITPY_RANDOM
extern const struct _mp_obj_module_t random_module;
#define RANDOM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_random), (mp_obj_t)&random_module },
@@ -595,6 +608,20 @@ extern const struct _mp_obj_module_t random_module;
#define RANDOM_MODULE
#endif
+#if CIRCUITPY_RE
+#define MICROPY_PY_URE (1)
+#define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) },
+#else
+#define RE_MODULE
+#endif
+
+#if CIRCUITPY_RGBMATRIX
+extern const struct _mp_obj_module_t rgbmatrix_module;
+#define RGBMATRIX_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rgbmatrix),(mp_obj_t)&rgbmatrix_module },
+#else
+#define RGBMATRIX_MODULE
+#endif
+
#if CIRCUITPY_ROTARYIO
extern const struct _mp_obj_module_t rotaryio_module;
#define ROTARYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rotaryio), (mp_obj_t)&rotaryio_module },
@@ -602,6 +629,13 @@ extern const struct _mp_obj_module_t rotaryio_module;
#define ROTARYIO_MODULE
#endif
+#if CIRCUITPY_RP2PIO
+extern const struct _mp_obj_module_t rp2pio_module;
+#define RP2PIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rp2pio),(mp_obj_t)&rp2pio_module },
+#else
+#define RP2PIO_MODULE
+#endif
+
#if CIRCUITPY_RTC
extern const struct _mp_obj_module_t rtc_module;
#define RTC_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rtc), (mp_obj_t)&rtc_module },
@@ -723,25 +757,6 @@ extern const struct _mp_obj_module_t ustack_module;
#define USTACK_MODULE
#endif
-// These modules are not yet in shared-bindings, but we prefer the non-uxxx names.
-#if MICROPY_PY_UBINASCII
-#define BINASCII_MODULE { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) },
-#else
-#define BINASCII_MODULE
-#endif
-
-#if MICROPY_PY_UERRNO
-#define ERRNO_MODULE { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) },
-#else
-#define ERRNO_MODULE
-#endif
-
-#if MICROPY_PY_UJSON
-#define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) },
-#else
-#define JSON_MODULE
-#endif
-
#if defined(CIRCUITPY_ULAB) && CIRCUITPY_ULAB
// ulab requires reverse special methods
#if defined(MICROPY_PY_REVERSE_SPECIAL_METHODS) && !MICROPY_PY_REVERSE_SPECIAL_METHODS
@@ -753,12 +768,6 @@ extern const struct _mp_obj_module_t ustack_module;
#define ULAB_MODULE
#endif
-#if MICROPY_PY_URE
-#define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) },
-#else
-#define RE_MODULE
-#endif
-
// This is not a top-level module; it's microcontroller.watchdog.
#if CIRCUITPY_WATCHDOG
extern const struct _mp_obj_module_t watchdog_module;
@@ -852,6 +861,7 @@ extern const struct _mp_obj_module_t msgpack_module;
RE_MODULE \
RGBMATRIX_MODULE \
ROTARYIO_MODULE \
+ RP2PIO_MODULE \
RTC_MODULE \
SAMD_MODULE \
SDCARDIO_MODULE \
@@ -928,12 +938,15 @@ void supervisor_run_background_tasks_if_tick(void);
#define CIRCUITPY_PYSTACK_SIZE 1536
#endif
-
// Wait this long imediately after startup to see if we are connected to USB.
#ifndef CIRCUITPY_USB_CONNECTED_SLEEP_DELAY
#define CIRCUITPY_USB_CONNECTED_SLEEP_DELAY 5
#endif
+#ifndef CIRCUITPY_PROCESSOR_COUNT
+#define CIRCUITPY_PROCESSOR_COUNT (1)
+#endif
+
#define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt"
#define CIRCUITPY_VERBOSE_BLE 0
diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk
index 538d50e94..d9c7c0d33 100644
--- a/py/circuitpy_mpconfig.mk
+++ b/py/circuitpy_mpconfig.mk
@@ -86,6 +86,9 @@ endif
endif
CFLAGS += -DCIRCUITPY_AUDIOMP3=$(CIRCUITPY_AUDIOMP3)
+CIRCUITPY_BINASCII ?= $(CIRCUITPY_FULL_BUILD)
+CFLAGS += -DCIRCUITPY_BINASCII=$(CIRCUITPY_BINASCII)
+
CIRCUITPY_BITBANGIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_BITBANGIO=$(CIRCUITPY_BITBANGIO)
@@ -100,7 +103,7 @@ CFLAGS += -DCIRCUITPY_BLEIO=$(CIRCUITPY_BLEIO)
CIRCUITPY_BOARD ?= 1
CFLAGS += -DCIRCUITPY_BOARD=$(CIRCUITPY_BOARD)
-CIRCUITPY_BUSDEVICE = 0
+CIRCUITPY_BUSDEVICE ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_BUSDEVICE=$(CIRCUITPY_BUSDEVICE)
CIRCUITPY_BUILTINS_POW3 ?= $(CIRCUITPY_FULL_BUILD)
@@ -124,6 +127,9 @@ CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO)
CIRCUITPY_DISPLAYIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_DISPLAYIO=$(CIRCUITPY_DISPLAYIO)
+CIRCUITPY_ERRNO ?= $(CIRCUITPY_FULL_BUILD)
+CFLAGS += -DCIRCUITPY_ERRNO=$(CIRCUITPY_ERRNO)
+
# CIRCUITPY_ESPIDF is handled in the esp32s2 tree.
# Only for ESP32S chips.
# Assume not a ESP build.
@@ -158,6 +164,9 @@ CFLAGS += -DCIRCUITPY_I2CPERIPHERAL=$(CIRCUITPY_I2CPERIPHERAL)
CIRCUITPY_IPADDRESS ?= $(CIRCUITPY_WIFI)
CFLAGS += -DCIRCUITPY_IPADDRESS=$(CIRCUITPY_IPADDRESS)
+CIRCUITPY_JSON ?= $(CIRCUITPY_FULL_BUILD)
+CFLAGS += -DCIRCUITPY_JSON=$(CIRCUITPY_JSON)
+
CIRCUITPY_MATH ?= 1
CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH)
@@ -198,12 +207,21 @@ CFLAGS += -DCIRCUITPY_PULSEIO=$(CIRCUITPY_PULSEIO)
# For now we tie PWMIO to PULSEIO so they always both exist. In CircuitPython 7
# we can enable and disable them separately once PWMOut is removed from `pulseio`.
-CIRCUITPY_PWMIO = $(CIRCUITPY_PULSEIO)
+CIRCUITPY_PWMIO ?= $(CIRCUITPY_PULSEIO)
CFLAGS += -DCIRCUITPY_PWMIO=$(CIRCUITPY_PWMIO)
CIRCUITPY_RANDOM ?= 1
CFLAGS += -DCIRCUITPY_RANDOM=$(CIRCUITPY_RANDOM)
+CIRCUITPY_RE ?= $(CIRCUITPY_FULL_BUILD)
+CFLAGS += -DCIRCUITPY_RE=$(CIRCUITPY_RE)
+
+# CIRCUITPY_RP2PIO is handled in the raspberrypi tree.
+# Only for rp2 chips.
+# Assume not a rp2 build.
+CIRCUITPY_RP2PIO ?= 0
+CFLAGS += -DCIRCUITPY_RP2PIO=$(CIRCUITPY_RP2PIO)
+
CIRCUITPY_RGBMATRIX ?= 0
CFLAGS += -DCIRCUITPY_RGBMATRIX=$(CIRCUITPY_RGBMATRIX)