From aaebd2958ef6df05046abb3383edea667b104e91 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 1 Sep 2021 10:38:08 -0500 Subject: [PATCH] micropython: update to v1.17 This updates the micropython submodule to v1.17 and makes changes to the code base as required by upstream changes. --- CHANGELOG.md | 3 +++ bricks/ev3dev/Makefile | 16 ++++++++-------- bricks/ev3dev/ev3dev_mphal.h | 2 +- bricks/ev3rt/Makefile | 15 ++++++++------- bricks/ev3rt/mphal.c | 2 +- bricks/nxt/Makefile | 13 +++++++------ bricks/nxt/main.c | 6 +++--- bricks/stm32/main.c | 8 ++++---- bricks/stm32/stm32.mk | 19 ++++++++++--------- .../drv/bluetooth/pybricks_service_server.h | 1 - lib/pbio/platform/move_hub/bluenrg_conf.h | 1 - micropython | 2 +- npm/mpy-cross/Makefile | 2 +- 13 files changed, 47 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12bcaeb7a..3396ad5b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ - Fixed Ultrasonic Sensor and Color Sensor turning off when a user script ends ([support#456]). +### Changed: +- Updated to MicroPython v1.17. + [support#456]: https://github.com/pybricks/support/issues/456 ## [3.1.0a4] - 2021-08-30 diff --git a/bricks/ev3dev/Makefile b/bricks/ev3dev/Makefile index 030358fe9..332d162b7 100644 --- a/bricks/ev3dev/Makefile +++ b/bricks/ev3dev/Makefile @@ -139,9 +139,9 @@ LDFLAGS += $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA) LDFLAGS += -lpthread ifeq ($(MICROPY_USE_READLINE),1) -INC += -I$(TOP)/lib/mp-readline +INC += -I$(TOP)/shared/readline CFLAGS_MOD += -DMICROPY_USE_READLINE=1 -LIB_SRC_C_EXTRA += mp-readline/readline.c +SHARED_SRC_C_EXTRA += readline/readline.c endif ifeq ($(MICROPY_PY_TERMIOS),1) CFLAGS_MOD += -DMICROPY_PY_TERMIOS=1 @@ -216,11 +216,11 @@ SRC_C = $(addprefix ports/unix/,\ SRC_C += $(SRC_MOD) -LIB_SRC_C = $(addprefix lib/,\ - $(LIB_SRC_C_EXTRA) \ +SHARED_SRC_C = $(addprefix shared/,\ + runtime/gchelper_generic.c \ + runtime/pyexec.c \ timeutils/timeutils.c \ - utils/gchelper_generic.c \ - utils/pyexec.c \ + $(SHARED_SRC_C_EXTRA) \ ) # Pybricks port core source files @@ -338,14 +338,14 @@ PYBRICKS_LIB_SRC_C = $(addprefix lib/,\ OBJ = $(PY_O) OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) -OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(PYBRICKS_PYBRICKS_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(PYBRICKS_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(PYBRICKS_LIB_SRC_C:.c=.o)) # List of sources for qstr extraction -SRC_QSTR += $(SRC_C) $(LIB_SRC_C) $(EXTMOD_SRC_C) $(PYBRICKS_SRC_C) $(PYBRICKS_PYBRICKS_SRC_C) +SRC_QSTR += $(SRC_C) $(SHARED_SRC_C) $(EXTMOD_SRC_C) $(PYBRICKS_SRC_C) $(PYBRICKS_PYBRICKS_SRC_C) # Append any auto-generated sources that are needed by sources listed in # SRC_QSTR SRC_QSTR_AUTO_DEPS += diff --git a/bricks/ev3dev/ev3dev_mphal.h b/bricks/ev3dev/ev3dev_mphal.h index f3ea20b75..98596681b 100644 --- a/bricks/ev3dev/ev3dev_mphal.h +++ b/bricks/ev3dev/ev3dev_mphal.h @@ -36,7 +36,7 @@ void mp_hal_stdio_mode_orig(void); #if MICROPY_USE_READLINE == 1 && MICROPY_PY_BUILTINS_INPUT #include "py/misc.h" -#include "lib/mp-readline/readline.h" +#include "shared/readline/readline.h" // For built-in input() we need to wrap the standard readline() to enable raw mode #define mp_hal_readline mp_hal_readline static inline int mp_hal_readline(vstr_t *vstr, const char *p) { diff --git a/bricks/ev3rt/Makefile b/bricks/ev3rt/Makefile index f02214664..0287ef0ad 100644 --- a/bricks/ev3rt/Makefile +++ b/bricks/ev3rt/Makefile @@ -98,9 +98,9 @@ endif endif ifeq ($(MICROPY_USE_READLINE),1) -INC += -I$(MPTOP)/lib/mp-readline +INC += -I$(MPTOP)/shared/readline CFLAGS_MOD += -DMICROPY_USE_READLINE=1 -LIB_SRC_C_EXTRA += mp-readline/readline.c +SHARED_SRC_C_EXTRA += readline/readline.c endif ifeq ($(MICROPY_USE_READLINE),2) CFLAGS_MOD += -DMICROPY_USE_READLINE=2 @@ -159,11 +159,11 @@ SRC_C = $(addprefix ports/unix/,\ mphal.c \ ) -LIB_SRC_C = $(addprefix lib/,\ - $(LIB_SRC_C_EXTRA) \ - utils/printf.c \ - utils/interrupt_char.c \ +SHARED_SRC_C = $(addprefix shared/,\ + runtime/printf.c \ + runtime/interrupt_char.c \ timeutils/timeutils.c \ + $(SHARED_SRC_C_EXTRA) \ ) ifeq ($(MICROPY_FATFS),1) @@ -175,10 +175,11 @@ endif OBJ = $(PY_O) OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o)) # List of sources for qstr extraction -SRC_QSTR += $(SRC_C) $(LIB_SRC_C) +SRC_QSTR += $(SRC_C) $(SHARED_SRC_C) $(LIB_SRC_C) # Append any auto-generated sources that are needed by sources listed in # SRC_QSTR SRC_QSTR_AUTO_DEPS += diff --git a/bricks/ev3rt/mphal.c b/bricks/ev3rt/mphal.c index 752fef15b..0bf7b3ad3 100644 --- a/bricks/ev3rt/mphal.c +++ b/bricks/ev3rt/mphal.c @@ -38,7 +38,7 @@ #include "py/repl.h" #include "py/gc.h" #include "py/mperrno.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" mp_import_stat_t mp_import_stat(const char *path) { return MP_IMPORT_STAT_NO_EXIST; diff --git a/bricks/nxt/Makefile b/bricks/nxt/Makefile index c4393d45c..3cec3cdb2 100644 --- a/bricks/nxt/Makefile +++ b/bricks/nxt/Makefile @@ -39,6 +39,7 @@ QSTR_GLOBAL_DEPENDENCIES = # MicroPython feature configurations MICROPY_ROM_TEXT_COMPRESSION ?= 1 +MPY_CROSS = ../../micropython/mpy-cross/mpy-cross MPY_CROSS_FLAGS += -mno-unicode # include py core make definitions @@ -96,16 +97,16 @@ SRC_C = \ # if we don't do it this way. So we need to be very careful about name clashes # between the top level directory and the micropython/ subdirectory. -SRC_C += $(addprefix lib/,\ +SRC_C += $(addprefix shared/,\ libc/string0.c \ - mp-readline/readline.c \ - utils/interrupt_char.c \ - utils/pyexec.c \ - utils/stdout_helpers.c \ + readline/readline.c \ + runtime/interrupt_char.c \ + runtime/pyexec.c \ + runtime/stdout_helpers.c \ ) SRC_S = \ - lib/utils/gchelper_arm7tdmi.s \ + shared/runtime/gchelper_arm7tdmi.s \ SRC_C_NXT := $(addprefix nxt-firmware-drivers/nxt/,\ aic.c \ diff --git a/bricks/nxt/main.c b/bricks/nxt/main.c index dbb35f564..53194faa6 100644 --- a/bricks/nxt/main.c +++ b/bricks/nxt/main.c @@ -21,8 +21,8 @@ #include "py/mperrno.h" #include "py/persistentcode.h" #include "py/stackctrl.h" -#include "lib/utils/pyexec.h" -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/pyexec.h" +#include "shared/runtime/interrupt_char.h" #include "py/mphal.h" @@ -202,7 +202,7 @@ int main(int argc, char **argv) { // defined in linker script extern uint32_t _estack; -// defined in lib/utils/gchelper_arm7tdmi.s +// defined in shared/runtime/gchelper_arm7tdmi.s extern uintptr_t gc_helper_get_regs_and_sp(uintptr_t *regs); void gc_collect(void) { diff --git a/bricks/stm32/main.c b/bricks/stm32/main.c index 51dd8d6d3..4ff654c80 100644 --- a/bricks/stm32/main.c +++ b/bricks/stm32/main.c @@ -15,10 +15,10 @@ #include #include -#include "lib/mp-readline/readline.h" -#include "lib/utils/gchelper.h" -#include "lib/utils/interrupt_char.h" -#include "lib/utils/pyexec.h" +#include "shared/readline/readline.h" +#include "shared/runtime/gchelper.h" +#include "shared/runtime/interrupt_char.h" +#include "shared/runtime/pyexec.h" #include "py/compile.h" #include "py/gc.h" #include "py/mperrno.h" diff --git a/bricks/stm32/stm32.mk b/bricks/stm32/stm32.mk index f6df0c40e..cc1da5735 100644 --- a/bricks/stm32/stm32.mk +++ b/bricks/stm32/stm32.mk @@ -148,6 +148,7 @@ CFLAGS += -D$(PB_CMSIS_MCU) CFLAGS += -DSTM32_H='' CFLAGS += -DSTM32_HAL_H='' +MPY_CROSS = ../../micropython/mpy-cross/mpy-cross # TODO: probably only need no-unicode on movehub MPY_CROSS_FLAGS += -mno-unicode @@ -167,23 +168,23 @@ SRC_C = $(addprefix bricks/stm32/,\ # if we don't do it this way. So we need to be very careful about name clashes # between the top level directory and the micropython/ subdirectory. -SRC_C += $(addprefix lib/,\ +SRC_C += $(addprefix shared/,\ libc/string0.c \ - mp-readline/readline.c \ - utils/gchelper_native.c \ - utils/interrupt_char.c \ - utils/pyexec.c \ - utils/stdout_helpers.c \ - utils/sys_stdio_mphal.c \ + readline/readline.c \ + runtime/gchelper_native.c \ + runtime/interrupt_char.c \ + runtime/pyexec.c \ + runtime/stdout_helpers.c \ + runtime/sys_stdio_mphal.c \ ) SRC_S = \ lib/pbio/platform/$(PBIO_PLATFORM)/startup.s \ ifeq ($(PB_MCU_SERIES),F0) - SRC_S += lib/utils/gchelper_m0.s + SRC_S += shared/runtime/gchelper_m0.s else - SRC_S += lib/utils/gchelper_m3.s + SRC_S += shared/runtime/gchelper_m3.s endif # Pybricks modules diff --git a/lib/pbio/drv/bluetooth/pybricks_service_server.h b/lib/pbio/drv/bluetooth/pybricks_service_server.h index e03ea26c2..a005ac602 100644 --- a/lib/pbio/drv/bluetooth/pybricks_service_server.h +++ b/lib/pbio/drv/bluetooth/pybricks_service_server.h @@ -75,4 +75,3 @@ void pybricks_service_server_request_can_send_now(btstack_context_callback_regis int pybricks_service_server_send(hci_con_handle_t con_handle, const uint8_t *data, uint16_t size); #endif // PYBRICKS_SERVICE_SERVER_H - diff --git a/lib/pbio/platform/move_hub/bluenrg_conf.h b/lib/pbio/platform/move_hub/bluenrg_conf.h index b96989886..9f37344a5 100644 --- a/lib/pbio/platform/move_hub/bluenrg_conf.h +++ b/lib/pbio/platform/move_hub/bluenrg_conf.h @@ -8,4 +8,3 @@ #define HCI_MAX_PAYLOAD_SIZE 127 #endif /* _BLUENRG_CONF_H_ */ - diff --git a/micropython b/micropython index c22558dde..b3e725ab9 160000 --- a/micropython +++ b/micropython @@ -1 +1 @@ -Subproject commit c22558ddefea6ea8fd682349f46b2d6fcb1987df +Subproject commit b3e725ab9666c237362e9cf39959b4813501e64f diff --git a/npm/mpy-cross/Makefile b/npm/mpy-cross/Makefile index 7b932b9b4..476c54fa2 100644 --- a/npm/mpy-cross/Makefile +++ b/npm/mpy-cross/Makefile @@ -122,7 +122,7 @@ SRC = $(addprefix $(MICROPYTHON_DIR)/, \ py/frozenmod.c \ mpy-cross/main.c \ mpy-cross/gccollect.c \ - lib/utils/gchelper_generic.c \ + shared/runtime/gchelper_generic.c \ ) MPY_CROSS_BUILD := $(MICROPYTHON_DIR)/mpy-cross/build