From 136369d72f5b99ec23c9c9f178a590bde968e2ee Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 9 Jul 2021 14:19:15 +1000 Subject: [PATCH] all: Update to point to files in new shared/ directory. Signed-off-by: Damien George --- docs/develop/porting.rst | 12 +++++----- drivers/cyw43/cyw43.h | 2 +- drivers/cyw43/cyw43_lwip.c | 2 +- examples/embedding/Makefile.upylib | 16 ++++++------- extmod/extmod.cmake | 4 ++-- extmod/extmod.mk | 2 +- extmod/modlwip.c | 2 +- extmod/uos_dupterm.c | 2 +- extmod/vfs_fat.c | 2 +- extmod/vfs_lfs.c | 2 +- extmod/vfs_lfsx.c | 2 +- mpy-cross/Makefile | 2 +- mpy-cross/gccollect.c | 2 +- mpy-cross/mpy-cross.vcxproj | 4 ++-- ports/bare-arm/lib.c | 2 +- ports/cc3200/application.mk | 21 +++++++++------- ports/cc3200/bootmgr/bootloader.mk | 6 ++--- ports/cc3200/fatfs_port.c | 2 +- ports/cc3200/ftp/ftp.c | 2 +- ports/cc3200/mods/moduos.c | 2 +- ports/cc3200/mods/modusocket.c | 2 +- ports/cc3200/mods/modutime.c | 2 +- ports/cc3200/mods/modwlan.c | 4 ++-- ports/cc3200/mods/pybrtc.c | 2 +- ports/cc3200/mods/pybuart.c | 2 +- ports/cc3200/mptask.c | 6 ++--- ports/cc3200/telnet/telnet.c | 2 +- ports/cc3200/util/gccollect.c | 2 +- ports/esp32/fatfs_port.c | 2 +- ports/esp32/machine_rtc.c | 2 +- ports/esp32/main.c | 4 ++-- ports/esp32/main/CMakeLists.txt | 19 +++++++++------ ports/esp32/modesp32.c | 2 +- ports/esp32/modmachine.c | 2 +- ports/esp32/modnetwork.c | 2 +- ports/esp32/modsocket.c | 2 +- ports/esp32/modutime.c | 2 +- ports/esp32/mphalport.c | 4 ++-- ports/esp32/mphalport.h | 2 +- ports/esp32/network_ppp.c | 2 +- ports/esp8266/Makefile | 20 +++++++++------- ports/esp8266/boards/esp8266_common.ld | 16 ++++++------- ports/esp8266/esp_mphal.c | 2 +- ports/esp8266/esp_mphal.h | 2 +- ports/esp8266/fatfs_port.c | 2 +- ports/esp8266/machine_rtc.c | 2 +- ports/esp8266/main.c | 4 ++-- ports/esp8266/modmachine.c | 2 +- ports/esp8266/modnetwork.c | 2 +- ports/esp8266/modutime.c | 2 +- ports/esp8266/uart.c | 2 +- ports/javascript/Makefile | 12 +++++----- ports/javascript/main.c | 2 +- ports/javascript/modutime.c | 2 +- ports/javascript/mphalport.h | 2 +- ports/mimxrt/Makefile | 24 +++++++++---------- ports/mimxrt/machine_pin.c | 2 +- ports/mimxrt/machine_rtc.c | 2 +- ports/mimxrt/main.c | 6 ++--- ports/mimxrt/modutime.c | 2 +- ports/mimxrt/mphalport.c | 2 +- ports/mimxrt/pin.h | 2 +- ports/minimal/Makefile | 10 ++++---- ports/minimal/main.c | 2 +- ports/nrf/Makefile | 12 +++++----- ports/nrf/drivers/bluetooth/ble_uart.c | 2 +- ports/nrf/main.c | 2 +- ports/nrf/modules/board/modboard.c | 2 +- ports/nrf/modules/machine/modmachine.c | 2 +- ports/nrf/modules/machine/uart.c | 2 +- ports/pic16bit/Makefile | 6 ++--- ports/pic16bit/main.c | 4 ++-- ports/powerpc/Makefile | 10 ++++---- ports/powerpc/main.c | 2 +- ports/qemu-arm/Makefile | 12 +++++----- ports/qemu-arm/Makefile.test | 2 +- ports/qemu-arm/mpconfigport.h | 2 +- ports/qemu-arm/test_main.c | 2 +- ports/rp2/CMakeLists.txt | 20 ++++++++-------- ports/rp2/machine_pin.c | 2 +- ports/rp2/machine_rtc.c | 2 +- ports/rp2/main.c | 6 ++--- ports/rp2/modmachine.c | 2 +- ports/rp2/modutime.c | 2 +- ports/rp2/mphalport.c | 2 +- ports/rp2/rp2_pio.c | 2 +- ports/samd/Makefile | 16 ++++++------- ports/samd/main.c | 4 ++-- ports/stm32/Makefile | 29 ++++++++++++----------- ports/stm32/boardctrl.c | 2 +- ports/stm32/eth.c | 2 +- ports/stm32/gccollect.c | 2 +- ports/stm32/machine_uart.c | 4 ++-- ports/stm32/main.c | 4 ++-- ports/stm32/mboot/Makefile | 4 ++-- ports/stm32/modmachine.c | 2 +- ports/stm32/modnetwork.c | 2 +- ports/stm32/modnwcc3k.c | 2 +- ports/stm32/modnwwiznet5k.c | 2 +- ports/stm32/modpyb.c | 2 +- ports/stm32/moduos.c | 2 +- ports/stm32/modusocket.c | 2 +- ports/stm32/modutime.c | 2 +- ports/stm32/mpbthciport.c | 2 +- ports/stm32/network_wiznet5k.c | 2 +- ports/stm32/pendsv.c | 2 +- ports/stm32/rtc.c | 2 +- ports/stm32/uart.c | 4 ++-- ports/stm32/uart.h | 2 +- ports/stm32/usb.c | 2 +- ports/stm32/usbd_cdc_interface.c | 2 +- ports/teensy/Makefile | 24 +++++++++---------- ports/teensy/main.c | 6 ++--- ports/teensy/modpyb.c | 2 +- ports/unix/Makefile | 14 +++++------ ports/unix/gccollect.c | 2 +- ports/unix/input.c | 2 +- ports/unix/main.c | 2 +- ports/unix/mphalport.h | 2 +- ports/unix/mpthreadport.c | 2 +- ports/windows/Makefile | 6 ++--- ports/windows/micropython.vcxproj | 6 ++--- ports/zephyr/CMakeLists.txt | 19 +++++++++------ ports/zephyr/machine_pin.c | 2 +- ports/zephyr/main.c | 8 +++---- ports/zephyr/mpconfigport_bin_testsuite.h | 2 +- ports/zephyr/mphalport.h | 2 +- py/modbuiltins.c | 2 +- py/mpconfig.h | 2 +- py/py.mk | 6 ++--- shared/memzip/README.md | 8 +++---- shared/netutils/dhcpserver.c | 2 +- shared/netutils/netutils.c | 2 +- shared/netutils/trace.c | 2 +- shared/readline/readline.c | 2 +- shared/runtime/gchelper_generic.c | 2 +- shared/runtime/gchelper_native.c | 2 +- shared/runtime/mpirq.c | 2 +- shared/runtime/pyexec.c | 4 ++-- shared/timeutils/timeutils.c | 2 +- tools/codeformat.py | 6 ++--- 141 files changed, 324 insertions(+), 306 deletions(-) diff --git a/docs/develop/porting.rst b/docs/develop/porting.rst index 59dd570008..08f3557f18 100644 --- a/docs/develop/porting.rst +++ b/docs/develop/porting.rst @@ -42,8 +42,8 @@ The basic MicroPython firmware is implemented in the main port file, e.g ``main. #include "py/gc.h" #include "py/mperrno.h" #include "py/stackctrl.h" - #include "lib/utils/gchelper.h" - #include "lib/utils/pyexec.h" + #include "shared/runtime/gchelper.h" + #include "shared/runtime/pyexec.h" // Allocate memory for the MicroPython GC heap. static char heap[4096]; @@ -106,10 +106,10 @@ We also need a Makefile at this point for the port: SRC_C = \ main.c \ mphalport.c \ - lib/mp-readline/readline.c \ - lib/utils/gchelper_generic.c \ - lib/utils/pyexec.c \ - lib/utils/stdout_helpers.c \ + shared/readline/readline.c \ + shared/runtime/gchelper_generic.c \ + shared/runtime/pyexec.c \ + shared/runtime/stdout_helpers.c \ # Define the required object files. OBJ = $(PY_CORE_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) diff --git a/drivers/cyw43/cyw43.h b/drivers/cyw43/cyw43.h index d7f08cb5df..7d3e30f5d4 100644 --- a/drivers/cyw43/cyw43.h +++ b/drivers/cyw43/cyw43.h @@ -28,7 +28,7 @@ #include "lwip/netif.h" #include "lwip/dhcp.h" -#include "lib/netutils/dhcpserver.h" +#include "shared/netutils/dhcpserver.h" #include "drivers/cyw43/cyw43_ll.h" // For trace_flags diff --git a/drivers/cyw43/cyw43_lwip.c b/drivers/cyw43/cyw43_lwip.c index f3ca59e3a4..16ae602375 100644 --- a/drivers/cyw43/cyw43_lwip.c +++ b/drivers/cyw43/cyw43_lwip.c @@ -28,7 +28,7 @@ #include #include "py/mphal.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "lwip/etharp.h" #include "lwip/dns.h" #include "lwip/apps/mdns.h" diff --git a/examples/embedding/Makefile.upylib b/examples/embedding/Makefile.upylib index 00def493d6..14260a719f 100644 --- a/examples/embedding/Makefile.upylib +++ b/examples/embedding/Makefile.upylib @@ -82,9 +82,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 @@ -145,19 +145,19 @@ SRC_C = $(addprefix ports/unix/,\ $(SRC_MOD) \ ) -LIB_SRC_C = $(addprefix lib/,\ - $(LIB_SRC_C_EXTRA) \ - utils/printf.c \ - utils/gchelper_generic.c \ +SHARED_SRC_C = $(addprefix shared/,\ + libc/printf.c \ + runtime/gchelper_generic.c \ timeutils/timeutils.c \ + $(SHARED_SRC_C_EXTRA) \ ) 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)) # List of sources for qstr extraction -SRC_QSTR += $(SRC_C) $(LIB_SRC_C) +SRC_QSTR += $(SRC_C) $(SHARED_SRC_C) # Append any auto-generated sources that are needed by sources listed in # SRC_QSTR SRC_QSTR_AUTO_DEPS += diff --git a/extmod/extmod.cmake b/extmod/extmod.cmake index a54047519d..9ea2ba0af9 100644 --- a/extmod/extmod.cmake +++ b/extmod/extmod.cmake @@ -4,8 +4,8 @@ set(MICROPY_EXTMOD_DIR "${MICROPY_DIR}/extmod") set(MICROPY_OOFATFS_DIR "${MICROPY_DIR}/lib/oofatfs") set(MICROPY_SOURCE_EXTMOD - ${MICROPY_DIR}/lib/embed/abort_.c - ${MICROPY_DIR}/lib/utils/printf.c + ${MICROPY_DIR}/shared/libc/abort_.c + ${MICROPY_DIR}/shared/libc/printf.c ${MICROPY_EXTMOD_DIR}/machine_i2c.c ${MICROPY_EXTMOD_DIR}/machine_mem.c ${MICROPY_EXTMOD_DIR}/machine_pulse.c diff --git a/extmod/extmod.mk b/extmod/extmod.mk index b000b058d7..ff24a549a9 100644 --- a/extmod/extmod.mk +++ b/extmod/extmod.mk @@ -153,7 +153,7 @@ LWIP_DIR = lib/lwip/src INC += -I$(TOP)/$(LWIP_DIR)/include CFLAGS_MOD += -DMICROPY_PY_LWIP=1 $(BUILD)/$(LWIP_DIR)/core/ipv4/dhcp.o: CFLAGS_MOD += -Wno-address -SRC_MOD += extmod/modlwip.c lib/netutils/netutils.c +SRC_MOD += extmod/modlwip.c shared/netutils/netutils.c SRC_MOD += $(addprefix $(LWIP_DIR)/,\ apps/mdns/mdns.c \ core/def.c \ diff --git a/extmod/modlwip.c b/extmod/modlwip.c index 1d557a6a84..00fd109645 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -35,7 +35,7 @@ #include "py/mperrno.h" #include "py/mphal.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "lwip/init.h" #include "lwip/tcp.h" diff --git a/extmod/uos_dupterm.c b/extmod/uos_dupterm.c index b661803875..d55767de21 100644 --- a/extmod/uos_dupterm.c +++ b/extmod/uos_dupterm.c @@ -33,7 +33,7 @@ #include "py/objarray.h" #include "py/stream.h" #include "extmod/misc.h" -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/interrupt_char.h" #if MICROPY_PY_OS_DUPTERM diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index 644be57ae7..41284500b4 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -37,7 +37,7 @@ #include "py/mperrno.h" #include "lib/oofatfs/ff.h" #include "extmod/vfs_fat.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #if FF_MAX_SS == FF_MIN_SS #define SECSIZE(fs) (FF_MIN_SS) diff --git a/extmod/vfs_lfs.c b/extmod/vfs_lfs.c index dd78269a46..f6a9a24623 100644 --- a/extmod/vfs_lfs.c +++ b/extmod/vfs_lfs.c @@ -26,7 +26,7 @@ #include "py/runtime.h" #include "py/mphal.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "extmod/vfs.h" #include "extmod/vfs_lfs.h" diff --git a/extmod/vfs_lfsx.c b/extmod/vfs_lfsx.c index f865e46060..e1324f82c7 100644 --- a/extmod/vfs_lfsx.c +++ b/extmod/vfs_lfsx.c @@ -34,7 +34,7 @@ #include "py/objstr.h" #include "py/mperrno.h" #include "extmod/vfs.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" STATIC int MP_VFS_LFSx(dev_ioctl)(const struct LFSx_API (config) * c, int cmd, int arg, bool must_return_int) { mp_obj_t ret = mp_vfs_blockdev_ioctl(c->context, cmd, arg); diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile index 971f2f81aa..2189dff905 100644 --- a/mpy-cross/Makefile +++ b/mpy-cross/Makefile @@ -48,7 +48,7 @@ LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA) SRC_C = \ main.c \ gccollect.c \ - lib/utils/gchelper_generic.c \ + shared/runtime/gchelper_generic.c \ # Add fmode when compiling with mingw gcc COMPILER_TARGET := $(shell $(CC) -dumpmachine) diff --git a/mpy-cross/gccollect.c b/mpy-cross/gccollect.c index 120f1a2252..72d4204c28 100644 --- a/mpy-cross/gccollect.c +++ b/mpy-cross/gccollect.c @@ -29,7 +29,7 @@ #include "py/mpstate.h" #include "py/gc.h" -#include "lib/utils/gchelper.h" +#include "shared/runtime/gchelper.h" #if MICROPY_ENABLE_GC diff --git a/mpy-cross/mpy-cross.vcxproj b/mpy-cross/mpy-cross.vcxproj index 74a366712a..e70b29ae14 100644 --- a/mpy-cross/mpy-cross.vcxproj +++ b/mpy-cross/mpy-cross.vcxproj @@ -89,7 +89,7 @@ - + MICROPY_GCREGS_SETJMP @@ -103,4 +103,4 @@ - \ No newline at end of file + diff --git a/ports/bare-arm/lib.c b/ports/bare-arm/lib.c index ee7c1d765e..6ef450bea0 100644 --- a/ports/bare-arm/lib.c +++ b/ports/bare-arm/lib.c @@ -54,7 +54,7 @@ void free(void *p) { } // These standard string functions are needed by the runtime, and can be -// provided either by the system or lib/libc/string0.c. The implementations +// provided either by the system or shared/libc/string0.c. The implementations // here are very simple. int memcmp(const void *s1, const void *s2, size_t n) { diff --git a/ports/cc3200/application.mk b/ports/cc3200/application.mk index 5c8fc9e40e..25a9925ea0 100644 --- a/ports/cc3200/application.mk +++ b/ports/cc3200/application.mk @@ -140,15 +140,18 @@ APP_MAIN_SRC_C = \ APP_LIB_SRC_C = $(addprefix lib/,\ oofatfs/ff.c \ oofatfs/ffunicode.c \ + ) + +APP_SHARED_SRC_C = $(addprefix shared/,\ libc/string0.c \ - mp-readline/readline.c \ + readline/readline.c \ netutils/netutils.c \ timeutils/timeutils.c \ - utils/gchelper_native.c \ - utils/pyexec.c \ - utils/interrupt_char.c \ - utils/stdout_helpers.c \ - utils/sys_stdio_mphal.c \ + runtime/gchelper_native.c \ + runtime/pyexec.c \ + runtime/interrupt_char.c \ + runtime/stdout_helpers.c \ + runtime/sys_stdio_mphal.c \ ) APP_STM_SRC_C = $(addprefix ports/stm32/,\ @@ -158,12 +161,12 @@ APP_STM_SRC_C = $(addprefix ports/stm32/,\ OBJ = $(PY_O) $(addprefix $(BUILD)/, $(APP_FATFS_SRC_C:.c=.o) $(APP_RTOS_SRC_C:.c=.o) $(APP_FTP_SRC_C:.c=.o) $(APP_HAL_SRC_C:.c=.o) $(APP_MISC_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(APP_MODS_SRC_C:.c=.o) $(APP_CC3100_SRC_C:.c=.o) $(APP_SL_SRC_C:.c=.o) $(APP_TELNET_SRC_C:.c=.o) $(APP_UTIL_SRC_C:.c=.o) $(APP_UTIL_SRC_S:.s=.o)) -OBJ += $(addprefix $(BUILD)/, $(APP_MAIN_SRC_C:.c=.o) $(APP_LIB_SRC_C:.c=.o) $(APP_STM_SRC_C:.c=.o)) -OBJ += $(BUILD)/lib/utils/gchelper_m3.o +OBJ += $(addprefix $(BUILD)/, $(APP_MAIN_SRC_C:.c=.o) $(APP_SHARED_SRC_C:.c=.o) $(APP_LIB_SRC_C:.c=.o) $(APP_STM_SRC_C:.c=.o)) +OBJ += $(BUILD)/shared/runtime/gchelper_m3.o OBJ += $(BUILD)/pins.o # List of sources for qstr extraction -SRC_QSTR += $(APP_MODS_SRC_C) $(APP_MISC_SRC_C) $(APP_STM_SRC_C) +SRC_QSTR += $(APP_MODS_SRC_C) $(APP_MISC_SRC_C) $(APP_STM_SRC_C) $(APP_SHARED_SRC_C) # Append any auto-generated sources that are needed by sources listed in # SRC_QSTR SRC_QSTR_AUTO_DEPS += diff --git a/ports/cc3200/bootmgr/bootloader.mk b/ports/cc3200/bootmgr/bootloader.mk index 44f1b7f42d..1dc2f82860 100644 --- a/ports/cc3200/bootmgr/bootloader.mk +++ b/ports/cc3200/bootmgr/bootloader.mk @@ -65,14 +65,14 @@ BOOT_PY_SRC_C = $(addprefix py/,\ mpprint.c \ ) -BOOT_LIB_SRC_C = $(addprefix lib/,\ +BOOT_SHARED_SRC_C = $(addprefix shared/,\ + libc/printf.c \ libc/string0.c \ - utils/printf.c \ ) OBJ = $(addprefix $(BUILD)/, $(BOOT_HAL_SRC_C:.c=.o) $(BOOT_SL_SRC_C:.c=.o) $(BOOT_CC3100_SRC_C:.c=.o) $(BOOT_UTIL_SRC_C:.c=.o) $(BOOT_MISC_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(BOOT_MAIN_SRC_C:.c=.o) $(BOOT_MAIN_SRC_S:.s=.o) $(BOOT_PY_SRC_C:.c=.o)) -OBJ += $(addprefix $(BUILD)/, $(BOOT_LIB_SRC_C:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(BOOT_SHARED_SRC_C:.c=.o)) # Add the linker script LINKER_SCRIPT = bootmgr/bootmgr.lds diff --git a/ports/cc3200/fatfs_port.c b/ports/cc3200/fatfs_port.c index 993684d8c6..39b350db60 100644 --- a/ports/cc3200/fatfs_port.c +++ b/ports/cc3200/fatfs_port.c @@ -27,7 +27,7 @@ #include "py/runtime.h" #include "lib/oofatfs/ff.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "mods/pybrtc.h" #if FF_FS_REENTRANT diff --git a/ports/cc3200/ftp/ftp.c b/ports/cc3200/ftp/ftp.c index 37680bc939..d999e810d9 100644 --- a/ports/cc3200/ftp/ftp.c +++ b/ports/cc3200/ftp/ftp.c @@ -28,7 +28,7 @@ #include #include "py/runtime.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "lib/oofatfs/ff.h" #include "extmod/vfs.h" #include "extmod/vfs_fat.h" diff --git a/ports/cc3200/mods/moduos.c b/ports/cc3200/mods/moduos.c index 53521fe66c..8c3dcf696a 100644 --- a/ports/cc3200/mods/moduos.c +++ b/ports/cc3200/mods/moduos.c @@ -31,7 +31,7 @@ #include "py/objtuple.h" #include "py/objstr.h" #include "py/runtime.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "lib/oofatfs/ff.h" #include "lib/oofatfs/diskio.h" #include "genhdr/mpversion.h" diff --git a/ports/cc3200/mods/modusocket.c b/ports/cc3200/mods/modusocket.c index 5dac0a0102..51815a31f9 100644 --- a/ports/cc3200/mods/modusocket.c +++ b/ports/cc3200/mods/modusocket.c @@ -35,7 +35,7 @@ #include "py/runtime.h" #include "py/stream.h" #include "py/mphal.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "modnetwork.h" #include "modusocket.h" diff --git a/ports/cc3200/mods/modutime.c b/ports/cc3200/mods/modutime.c index e77065ef45..c5ff6072f5 100644 --- a/ports/cc3200/mods/modutime.c +++ b/ports/cc3200/mods/modutime.c @@ -33,7 +33,7 @@ #include "py/obj.h" #include "py/smallint.h" #include "py/mphal.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "extmod/utime_mphal.h" #include "inc/hw_types.h" #include "inc/hw_ints.h" diff --git a/ports/cc3200/mods/modwlan.c b/ports/cc3200/mods/modwlan.c index 7aa8f0e2c4..920079b589 100644 --- a/ports/cc3200/mods/modwlan.c +++ b/ports/cc3200/mods/modwlan.c @@ -35,8 +35,8 @@ #include "py/runtime.h" #include "py/stream.h" #include "py/mphal.h" -#include "lib/timeutils/timeutils.h" -#include "lib/netutils/netutils.h" +#include "shared/timeutils/timeutils.h" +#include "shared/netutils/netutils.h" #include "modnetwork.h" #include "modusocket.h" #include "modwlan.h" diff --git a/ports/cc3200/mods/pybrtc.c b/ports/cc3200/mods/pybrtc.c index f0704eecda..6c1918831c 100644 --- a/ports/cc3200/mods/pybrtc.c +++ b/ports/cc3200/mods/pybrtc.c @@ -29,7 +29,7 @@ #include "py/obj.h" #include "py/runtime.h" #include "py/mperrno.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "inc/hw_types.h" #include "inc/hw_ints.h" #include "inc/hw_memmap.h" diff --git a/ports/cc3200/mods/pybuart.c b/ports/cc3200/mods/pybuart.c index ac2af7032e..b8e8cbb682 100644 --- a/ports/cc3200/mods/pybuart.c +++ b/ports/cc3200/mods/pybuart.c @@ -33,7 +33,7 @@ #include "py/objlist.h" #include "py/stream.h" #include "py/mphal.h" -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/interrupt_char.h" #include "inc/hw_types.h" #include "inc/hw_ints.h" #include "inc/hw_memmap.h" diff --git a/ports/cc3200/mptask.c b/ports/cc3200/mptask.c index 71b650ff85..b764c4712c 100644 --- a/ports/cc3200/mptask.c +++ b/ports/cc3200/mptask.c @@ -33,7 +33,7 @@ #include "py/runtime.h" #include "py/gc.h" #include "py/mphal.h" -#include "lib/mp-readline/readline.h" +#include "shared/readline/readline.h" #include "lib/oofatfs/ff.h" #include "lib/oofatfs/diskio.h" #include "extmod/vfs.h" @@ -49,8 +49,8 @@ #include "pybuart.h" #include "pybpin.h" #include "pybrtc.h" -#include "lib/utils/pyexec.h" -#include "lib/utils/gchelper.h" +#include "shared/runtime/pyexec.h" +#include "shared/runtime/gchelper.h" #include "gccollect.h" #include "mperror.h" #include "simplelink.h" diff --git a/ports/cc3200/telnet/telnet.c b/ports/cc3200/telnet/telnet.c index 9f51d4cd85..c4daac3426 100644 --- a/ports/cc3200/telnet/telnet.c +++ b/ports/cc3200/telnet/telnet.c @@ -28,7 +28,7 @@ #include "py/runtime.h" #include "py/mphal.h" -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/interrupt_char.h" #include "telnet.h" #include "simplelink.h" #include "modnetwork.h" diff --git a/ports/cc3200/util/gccollect.c b/ports/cc3200/util/gccollect.c index eac0c86b02..0ff179e48b 100644 --- a/ports/cc3200/util/gccollect.c +++ b/ports/cc3200/util/gccollect.c @@ -30,7 +30,7 @@ #include "py/gc.h" #include "py/mpthread.h" -#include "lib/utils/gchelper.h" +#include "shared/runtime/gchelper.h" #include "gccollect.h" /****************************************************************************** diff --git a/ports/esp32/fatfs_port.c b/ports/esp32/fatfs_port.c index 7fce654c09..b9ad30a128 100644 --- a/ports/esp32/fatfs_port.c +++ b/ports/esp32/fatfs_port.c @@ -28,7 +28,7 @@ #include #include "lib/oofatfs/ff.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" DWORD get_fattime(void) { struct timeval tv; diff --git a/ports/esp32/machine_rtc.c b/ports/esp32/machine_rtc.c index 1b6a71b5b4..52227c93b8 100644 --- a/ports/esp32/machine_rtc.c +++ b/ports/esp32/machine_rtc.c @@ -36,7 +36,7 @@ #include "py/obj.h" #include "py/runtime.h" #include "py/mphal.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "modmachine.h" #include "machine_rtc.h" diff --git a/ports/esp32/main.c b/ports/esp32/main.c index b04831fff1..c1b8e8a31d 100644 --- a/ports/esp32/main.c +++ b/ports/esp32/main.c @@ -54,8 +54,8 @@ #include "py/repl.h" #include "py/gc.h" #include "py/mphal.h" -#include "lib/mp-readline/readline.h" -#include "lib/utils/pyexec.h" +#include "shared/readline/readline.h" +#include "shared/runtime/pyexec.h" #include "uart.h" #include "usb.h" #include "modmachine.h" diff --git a/ports/esp32/main/CMakeLists.txt b/ports/esp32/main/CMakeLists.txt index ed72a8d68b..f2b3dd4a4f 100644 --- a/ports/esp32/main/CMakeLists.txt +++ b/ports/esp32/main/CMakeLists.txt @@ -15,21 +15,24 @@ set(MICROPY_QSTRDEFS_PORT ${PROJECT_DIR}/qstrdefsport.h ) +set(MICROPY_SOURCE_SHARED + ${MICROPY_DIR}/shared/readline/readline.c + ${MICROPY_DIR}/shared/netutils/netutils.c + ${MICROPY_DIR}/shared/timeutils/timeutils.c + ${MICROPY_DIR}/shared/runtime/interrupt_char.c + ${MICROPY_DIR}/shared/runtime/stdout_helpers.c + ${MICROPY_DIR}/shared/runtime/sys_stdio_mphal.c + ${MICROPY_DIR}/shared/runtime/pyexec.c +) + set(MICROPY_SOURCE_LIB ${MICROPY_DIR}/lib/littlefs/lfs1.c ${MICROPY_DIR}/lib/littlefs/lfs1_util.c ${MICROPY_DIR}/lib/littlefs/lfs2.c ${MICROPY_DIR}/lib/littlefs/lfs2_util.c ${MICROPY_DIR}/lib/mbedtls_errors/mp_mbedtls_errors.c - ${MICROPY_DIR}/lib/mp-readline/readline.c - ${MICROPY_DIR}/lib/netutils/netutils.c ${MICROPY_DIR}/lib/oofatfs/ff.c ${MICROPY_DIR}/lib/oofatfs/ffunicode.c - ${MICROPY_DIR}/lib/timeutils/timeutils.c - ${MICROPY_DIR}/lib/utils/interrupt_char.c - ${MICROPY_DIR}/lib/utils/stdout_helpers.c - ${MICROPY_DIR}/lib/utils/sys_stdio_mphal.c - ${MICROPY_DIR}/lib/utils/pyexec.c ) set(MICROPY_SOURCE_DRIVERS @@ -80,6 +83,7 @@ set(MICROPY_SOURCE_QSTR ${MICROPY_SOURCE_PY} ${MICROPY_SOURCE_EXTMOD} ${MICROPY_SOURCE_USERMOD} + ${MICROPY_SOURCE_SHARED} ${MICROPY_SOURCE_LIB} ${MICROPY_SOURCE_PORT} ) @@ -142,6 +146,7 @@ idf_component_register( SRCS ${MICROPY_SOURCE_PY} ${MICROPY_SOURCE_EXTMOD} + ${MICROPY_SOURCE_SHARED} ${MICROPY_SOURCE_LIB} ${MICROPY_SOURCE_DRIVERS} ${MICROPY_SOURCE_PORT} diff --git a/ports/esp32/modesp32.c b/ports/esp32/modesp32.c index 3ed5343380..042c8b8566 100644 --- a/ports/esp32/modesp32.c +++ b/ports/esp32/modesp32.c @@ -40,7 +40,7 @@ #include "py/obj.h" #include "py/runtime.h" #include "py/mphal.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "modmachine.h" #include "machine_rtc.h" #include "modesp32.h" diff --git a/ports/esp32/modmachine.c b/ports/esp32/modmachine.c index c46f8ab8d7..a4e0724cee 100644 --- a/ports/esp32/modmachine.c +++ b/ports/esp32/modmachine.c @@ -49,7 +49,7 @@ #include "py/obj.h" #include "py/runtime.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #include "extmod/machine_mem.h" #include "extmod/machine_signal.h" #include "extmod/machine_pulse.h" diff --git a/ports/esp32/modnetwork.c b/ports/esp32/modnetwork.c index e2bd20a1a9..3977256166 100644 --- a/ports/esp32/modnetwork.c +++ b/ports/esp32/modnetwork.c @@ -40,7 +40,7 @@ #include "py/runtime.h" #include "py/mphal.h" #include "py/mperrno.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "esp_eth.h" #include "esp_wifi.h" #include "esp_log.h" diff --git a/ports/esp32/modsocket.c b/ports/esp32/modsocket.c index 67b1d7d6f0..be950ac1f6 100644 --- a/ports/esp32/modsocket.c +++ b/ports/esp32/modsocket.c @@ -45,7 +45,7 @@ #include "py/mphal.h" #include "py/stream.h" #include "py/mperrno.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "mdns.h" #include "modnetwork.h" diff --git a/ports/esp32/modutime.c b/ports/esp32/modutime.c index cf7178e0b1..f864df678f 100644 --- a/ports/esp32/modutime.c +++ b/ports/esp32/modutime.c @@ -31,7 +31,7 @@ #include #include "py/runtime.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "extmod/utime_mphal.h" STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) { diff --git a/ports/esp32/mphalport.c b/ports/esp32/mphalport.c index db2146d93d..de7fdfcec3 100644 --- a/ports/esp32/mphalport.c +++ b/ports/esp32/mphalport.c @@ -47,8 +47,8 @@ #include "py/mpstate.h" #include "py/mphal.h" #include "extmod/misc.h" -#include "lib/timeutils/timeutils.h" -#include "lib/utils/pyexec.h" +#include "shared/timeutils/timeutils.h" +#include "shared/runtime/pyexec.h" #include "mphalport.h" #include "usb.h" diff --git a/ports/esp32/mphalport.h b/ports/esp32/mphalport.h index 60cc308d68..2ba6f96b6a 100644 --- a/ports/esp32/mphalport.h +++ b/ports/esp32/mphalport.h @@ -30,7 +30,7 @@ #define INCLUDED_MPHALPORT_H #include "py/ringbuf.h" -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/interrupt_char.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/ports/esp32/network_ppp.c b/ports/esp32/network_ppp.c index db2292ca03..d74283c19c 100644 --- a/ports/esp32/network_ppp.c +++ b/ports/esp32/network_ppp.c @@ -30,7 +30,7 @@ #include "py/mphal.h" #include "py/objtype.h" #include "py/stream.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "modmachine.h" #include "netif/ppp/ppp.h" diff --git a/ports/esp8266/Makefile b/ports/esp8266/Makefile index 9d6aea603a..b54193afef 100644 --- a/ports/esp8266/Makefile +++ b/ports/esp8266/Makefile @@ -119,8 +119,6 @@ EXTMOD_SRC_C = $(addprefix extmod/,\ ) LIB_SRC_C = $(addprefix lib/,\ - embed/__errno.c \ - libc/string0.c \ libm/math.c \ libm/fmodf.c \ libm/nearbyintf.c \ @@ -140,13 +138,18 @@ LIB_SRC_C = $(addprefix lib/,\ libm/atanf.c \ libm/atan2f.c \ libm/roundf.c \ - mp-readline/readline.c \ + ) + +SHARED_SRC_C = $(addprefix shared/,\ + libc/__errno.c \ + libc/string0.c \ netutils/netutils.c \ + readline/readline.c \ + runtime/interrupt_char.c \ + runtime/pyexec.c \ + runtime/stdout_helpers.c \ + runtime/sys_stdio_mphal.c \ timeutils/timeutils.c \ - utils/pyexec.c \ - utils/interrupt_char.c \ - utils/stdout_helpers.c \ - utils/sys_stdio_mphal.c \ ) DRIVERS_SRC_C = $(addprefix drivers/,\ @@ -162,11 +165,12 @@ OBJ += $(PY_O) OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o)) OBJ += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o)) # List of sources for qstr extraction -SRC_QSTR += $(SRC_C) $(EXTMOD_SRC_C) $(LIB_SRC_C) $(DRIVERS_SRC_C) +SRC_QSTR += $(SRC_C) $(EXTMOD_SRC_C) $(SHARED_SRC_C) $(DRIVERS_SRC_C) # Append any auto-generated sources that are needed by sources listed in SRC_QSTR SRC_QSTR_AUTO_DEPS += diff --git a/ports/esp8266/boards/esp8266_common.ld b/ports/esp8266/boards/esp8266_common.ld index c6e37d942c..f40ff1e5fc 100644 --- a/ports/esp8266/boards/esp8266_common.ld +++ b/ports/esp8266/boards/esp8266_common.ld @@ -134,14 +134,14 @@ SECTIONS *lib/berkeley-db-1.xx/*.o(.literal*, .text*) *lib/libm/*.o*(.literal*, .text*) *lib/littlefs/*.o*(.literal*, .text*) - *lib/mp-readline/*.o(.literal*, .text*) - *lib/netutils/*.o*(.literal*, .text*) - *lib/timeutils/*.o*(.literal*, .text*) - *lib/utils/printf.o*(.literal*, .text*) - *lib/utils/sys_stdio_mphal.o*(.literal*, .text*) - *lib/utils/pyexec.o*(.literal*, .text*) - *lib/utils/stdout_helpers.o*(.literal*, .text*) - *lib/utils/interrupt_char.o*(.literal*, .text*) + *shared/libc/printf.o*(.literal*, .text*) + *shared/netutils/*.o*(.literal*, .text*) + *shared/readline/*.o(.literal*, .text*) + *shared/runtime/interrupt_char.o*(.literal*, .text*) + *shared/runtime/pyexec.o*(.literal*, .text*) + *shared/runtime/stdout_helpers.o*(.literal*, .text*) + *shared/runtime/sys_stdio_mphal.o*(.literal*, .text*) + *shared/timeutils/*.o*(.literal*, .text*) *drivers/bus/*.o(.literal* .text*) build-*/main.o(.literal* .text*) diff --git a/ports/esp8266/esp_mphal.c b/ports/esp8266/esp_mphal.c index 06e6cd0af5..3cb4807333 100644 --- a/ports/esp8266/esp_mphal.c +++ b/ports/esp8266/esp_mphal.c @@ -34,7 +34,7 @@ #include "py/runtime.h" #include "py/stream.h" #include "extmod/misc.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" STATIC byte stdin_ringbuf_array[256]; ringbuf_t stdin_ringbuf = {stdin_ringbuf_array, sizeof(stdin_ringbuf_array), 0, 0}; diff --git a/ports/esp8266/esp_mphal.h b/ports/esp8266/esp_mphal.h index e9cf7e548d..b0351877e8 100644 --- a/ports/esp8266/esp_mphal.h +++ b/ports/esp8266/esp_mphal.h @@ -26,7 +26,7 @@ #include "user_interface.h" #include "py/ringbuf.h" -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/interrupt_char.h" #include "xtirq.h" void mp_sched_keyboard_interrupt(void); diff --git a/ports/esp8266/fatfs_port.c b/ports/esp8266/fatfs_port.c index bbd1051935..3ffc90040c 100644 --- a/ports/esp8266/fatfs_port.c +++ b/ports/esp8266/fatfs_port.c @@ -25,7 +25,7 @@ */ #include "py/obj.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "lib/oofatfs/ff.h" #include "modmachine.h" diff --git a/ports/esp8266/machine_rtc.c b/ports/esp8266/machine_rtc.c index e7b750fd92..38049ce724 100644 --- a/ports/esp8266/machine_rtc.c +++ b/ports/esp8266/machine_rtc.c @@ -28,7 +28,7 @@ #include #include "py/runtime.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "user_interface.h" #include "modmachine.h" diff --git a/ports/esp8266/main.c b/ports/esp8266/main.c index a73fbbcf5f..404188346c 100644 --- a/ports/esp8266/main.c +++ b/ports/esp8266/main.c @@ -39,8 +39,8 @@ #define USE_US_TIMER 1 #include "extmod/misc.h" -#include "lib/mp-readline/readline.h" -#include "lib/utils/pyexec.h" +#include "shared/readline/readline.h" +#include "shared/runtime/pyexec.h" #include "gccollect.h" #include "user_interface.h" diff --git a/ports/esp8266/modmachine.c b/ports/esp8266/modmachine.c index 86c1d728d5..2b1f0f0835 100644 --- a/ports/esp8266/modmachine.c +++ b/ports/esp8266/modmachine.c @@ -30,7 +30,7 @@ #include "py/obj.h" #include "py/runtime.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" // This needs to be set before we include the RTOS headers #define USE_US_TIMER 1 diff --git a/ports/esp8266/modnetwork.c b/ports/esp8266/modnetwork.c index 8d153acf0f..949aeba106 100644 --- a/ports/esp8266/modnetwork.c +++ b/ports/esp8266/modnetwork.c @@ -31,7 +31,7 @@ #include "py/objlist.h" #include "py/runtime.h" #include "py/mphal.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "queue.h" #include "user_interface.h" #include "espconn.h" diff --git a/ports/esp8266/modutime.c b/ports/esp8266/modutime.c index bcfbf7baf2..1d4ecc05f2 100644 --- a/ports/esp8266/modutime.c +++ b/ports/esp8266/modutime.c @@ -32,7 +32,7 @@ #include "py/runtime.h" #include "py/mphal.h" #include "py/smallint.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "modmachine.h" #include "user_interface.h" #include "extmod/utime_mphal.h" diff --git a/ports/esp8266/uart.c b/ports/esp8266/uart.c index 5ac71da07d..978a7efc38 100644 --- a/ports/esp8266/uart.c +++ b/ports/esp8266/uart.c @@ -285,7 +285,7 @@ void ICACHE_FLASH_ATTR uart0_set_rxbuf(uint8 *buf, int len) { // Task-based UART interface #include "py/obj.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #if MICROPY_REPL_EVENT_DRIVEN void ICACHE_FLASH_ATTR uart_task_handler(os_event_t *evt) { diff --git a/ports/javascript/Makefile b/ports/javascript/Makefile index 9cc45d3ef9..34bbe5f2f7 100644 --- a/ports/javascript/Makefile +++ b/ports/javascript/Makefile @@ -24,11 +24,11 @@ CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool CFLAGS += -DMICROPY_MODULE_FROZEN_MPY endif -SRC_LIB = $(addprefix lib/,\ - utils/interrupt_char.c \ - utils/stdout_helpers.c \ - utils/pyexec.c \ - mp-readline/readline.c \ +SRC_SHARED = $(addprefix shared/,\ + runtime/interrupt_char.c \ + runtime/stdout_helpers.c \ + runtime/pyexec.c \ + readline/readline.c \ ) SRC_C = \ @@ -39,7 +39,7 @@ SRC_C = \ SRC_QSTR += $(SRC_C) OBJ += $(PY_O) -OBJ += $(addprefix $(BUILD)/, $(SRC_LIB:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(SRC_SHARED:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) JSFLAGS += -s ASYNCIFY diff --git a/ports/javascript/main.c b/ports/javascript/main.c index c56f1a2cba..7a04b8eea3 100644 --- a/ports/javascript/main.c +++ b/ports/javascript/main.c @@ -34,7 +34,7 @@ #include "py/repl.h" #include "py/gc.h" #include "py/mperrno.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #include "emscripten.h" #include "library.h" diff --git a/ports/javascript/modutime.c b/ports/javascript/modutime.c index d05d832ab1..05ff8b22f3 100644 --- a/ports/javascript/modutime.c +++ b/ports/javascript/modutime.c @@ -32,7 +32,7 @@ #include "py/smallint.h" #include "py/obj.h" #include "py/runtime.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "extmod/utime_mphal.h" STATIC const mp_rom_map_elem_t time_module_globals_table[] = { diff --git a/ports/javascript/mphalport.h b/ports/javascript/mphalport.h index 614ce8526a..3e2c439f32 100644 --- a/ports/javascript/mphalport.h +++ b/ports/javascript/mphalport.h @@ -25,7 +25,7 @@ */ #include "py/obj.h" -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/interrupt_char.h" #define mp_hal_stdin_rx_chr() (0) void mp_hal_stdout_tx_strn(const char *str, size_t len); diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile index fdb1325fdd..64d9864cbb 100644 --- a/ports/mimxrt/Makefile +++ b/ports/mimxrt/Makefile @@ -155,15 +155,15 @@ SRC_C = \ moduos.c \ mphalport.c \ hal/flexspi_nor_flash.c \ - lib/mp-readline/readline.c \ - lib/libc/string0.c \ - lib/timeutils/timeutils.c \ - lib/utils/gchelper_native.c \ - lib/utils/mpirq.c \ - lib/utils/printf.c \ - lib/utils/pyexec.c \ - lib/utils/stdout_helpers.c \ - lib/utils/sys_stdio_mphal.c \ + shared/libc/printf.c \ + shared/libc/string0.c \ + shared/readline/readline.c \ + shared/runtime/gchelper_native.c \ + shared/runtime/mpirq.c \ + shared/runtime/pyexec.c \ + shared/runtime/stdout_helpers.c \ + shared/runtime/sys_stdio_mphal.c \ + shared/timeutils/timeutils.c \ drivers/bus/softspi.c \ extmod/modonewire.c \ $(SRC_TINYUSB_C) \ @@ -264,7 +264,7 @@ endif SRC_SS = $(MCU_DIR)/gcc/startup_$(MCU_SERIES).S -SRC_S = lib/utils/gchelper_m3.s \ +SRC_S = shared/runtime/gchelper_m3.s \ # List of sources for qstr extraction SRC_QSTR += \ @@ -281,8 +281,8 @@ SRC_QSTR += \ modmimxrt.c \ moduos.c \ pin.c \ - lib/utils/mpirq.c \ - lib/utils/sys_stdio_mphal.c \ + shared/runtime/mpirq.c \ + shared/runtime/sys_stdio_mphal.c \ extmod/modonewire.c \ $(GEN_PINS_SRC) \ diff --git a/ports/mimxrt/machine_pin.c b/ports/mimxrt/machine_pin.c index dc26cdfc12..3a1151ba81 100644 --- a/ports/mimxrt/machine_pin.c +++ b/ports/mimxrt/machine_pin.c @@ -31,7 +31,7 @@ #include "py/runtime.h" #include "py/mphal.h" -#include "lib/utils/mpirq.h" +#include "shared/runtime/mpirq.h" #include "pin.h" // Local functions diff --git a/ports/mimxrt/machine_rtc.c b/ports/mimxrt/machine_rtc.c index d00d139f79..f08e73fa55 100644 --- a/ports/mimxrt/machine_rtc.c +++ b/ports/mimxrt/machine_rtc.c @@ -26,7 +26,7 @@ */ #include "py/runtime.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "modmachine.h" #include "ticks.h" #include "fsl_snvs_lp.h" diff --git a/ports/mimxrt/main.c b/ports/mimxrt/main.c index c93e89c8ab..e81974afaa 100644 --- a/ports/mimxrt/main.c +++ b/ports/mimxrt/main.c @@ -30,9 +30,9 @@ #include "py/gc.h" #include "py/mperrno.h" #include "py/stackctrl.h" -#include "lib/mp-readline/readline.h" -#include "lib/utils/gchelper.h" -#include "lib/utils/pyexec.h" +#include "shared/readline/readline.h" +#include "shared/runtime/gchelper.h" +#include "shared/runtime/pyexec.h" #include "ticks.h" #include "tusb.h" #include "led.h" diff --git a/ports/mimxrt/modutime.c b/ports/mimxrt/modutime.c index 2a88a4224b..d3be7c2ea6 100644 --- a/ports/mimxrt/modutime.c +++ b/ports/mimxrt/modutime.c @@ -26,7 +26,7 @@ */ #include "py/runtime.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "extmod/utime_mphal.h" #include "fsl_snvs_lp.h" diff --git a/ports/mimxrt/mphalport.c b/ports/mimxrt/mphalport.c index 942deae5b7..ff7e988dff 100644 --- a/ports/mimxrt/mphalport.c +++ b/ports/mimxrt/mphalport.c @@ -28,7 +28,7 @@ #include "py/runtime.h" #include "py/stream.h" #include "py/mphal.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "ticks.h" #include "tusb.h" #include "fsl_snvs_lp.h" diff --git a/ports/mimxrt/pin.h b/ports/mimxrt/pin.h index ace4d18436..8d80490d1c 100644 --- a/ports/mimxrt/pin.h +++ b/ports/mimxrt/pin.h @@ -29,7 +29,7 @@ #include #include "py/obj.h" -#include "lib/utils/mpirq.h" +#include "shared/runtime/mpirq.h" #include "fsl_gpio.h" // ------------------------------------------------------------------------------------------------------------------ // diff --git a/ports/minimal/Makefile b/ports/minimal/Makefile index bce544ec17..0e79d581be 100644 --- a/ports/minimal/Makefile +++ b/ports/minimal/Makefile @@ -46,14 +46,14 @@ LIBS = SRC_C = \ main.c \ uart_core.c \ - lib/utils/printf.c \ - lib/utils/stdout_helpers.c \ - lib/utils/pyexec.c \ - lib/mp-readline/readline.c \ + shared/libc/printf.c \ + shared/readline/readline.c \ + shared/runtime/pyexec.c \ + shared/runtime/stdout_helpers.c \ $(BUILD)/_frozen_mpy.c \ ifeq ($(CROSS), 1) -SRC_C += lib/libc/string0.c +SRC_C += shared/libc/string0.c endif OBJ = $(PY_CORE_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) diff --git a/ports/minimal/main.c b/ports/minimal/main.c index aa6d10ee37..006ca0a4d0 100644 --- a/ports/minimal/main.c +++ b/ports/minimal/main.c @@ -7,7 +7,7 @@ #include "py/repl.h" #include "py/gc.h" #include "py/mperrno.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #if MICROPY_ENABLE_COMPILER void do_str(const char *src, mp_parse_input_kind_t input_kind) { diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index a3f914dbc1..7428ab82c0 100644 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -70,7 +70,7 @@ INC += -I./modules/ubluepy INC += -I./modules/music INC += -I./modules/ble INC += -I./modules/board -INC += -I../../lib/mp-readline +INC += -I../../shared/readline INC += -I./drivers/bluetooth INC += -I./drivers INC += -I../../lib/nrfx/ @@ -216,12 +216,12 @@ include drivers/secureboot/secureboot.mk endif -SRC_LIB += $(addprefix lib/,\ +SRC_LIB += $(addprefix shared/,\ libc/string0.c \ - mp-readline/readline.c \ - utils/pyexec.c \ - utils/sys_stdio_mphal.c \ - utils/interrupt_char.c \ + readline/readline.c \ + runtime/pyexec.c \ + runtime/sys_stdio_mphal.c \ + runtime/interrupt_char.c \ timeutils/timeutils.c \ ) diff --git a/ports/nrf/drivers/bluetooth/ble_uart.c b/ports/nrf/drivers/bluetooth/ble_uart.c index 96c2025d0f..c3712fe8c9 100644 --- a/ports/nrf/drivers/bluetooth/ble_uart.c +++ b/ports/nrf/drivers/bluetooth/ble_uart.c @@ -30,7 +30,7 @@ #include "ble_uart.h" #include "ringbuffer.h" #include "mphalport.h" -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/interrupt_char.h" #include "py/runtime.h" #if MICROPY_PY_SYS_STDFILES diff --git a/ports/nrf/main.c b/ports/nrf/main.c index 86ba83342b..3de5a310f0 100644 --- a/ports/nrf/main.c +++ b/ports/nrf/main.c @@ -38,7 +38,7 @@ #include "py/stackctrl.h" #include "py/gc.h" #include "py/compile.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #include "readline.h" #include "gccollect.h" #include "modmachine.h" diff --git a/ports/nrf/modules/board/modboard.c b/ports/nrf/modules/board/modboard.c index 5f59a52a6b..647af5035b 100644 --- a/ports/nrf/modules/board/modboard.c +++ b/ports/nrf/modules/board/modboard.c @@ -25,7 +25,7 @@ */ #include "py/builtin.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #include "py/runtime.h" #include "py/obj.h" #include "led.h" diff --git a/ports/nrf/modules/machine/modmachine.c b/ports/nrf/modules/machine/modmachine.c index 7e45b83df8..fb3267e0db 100644 --- a/ports/nrf/modules/machine/modmachine.c +++ b/ports/nrf/modules/machine/modmachine.c @@ -33,7 +33,7 @@ #include "extmod/machine_mem.h" #include "extmod/machine_pulse.h" #include "extmod/machine_i2c.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #include "lib/oofatfs/ff.h" #include "lib/oofatfs/diskio.h" #include "gccollect.h" diff --git a/ports/nrf/modules/machine/uart.c b/ports/nrf/modules/machine/uart.c index af95ae4b8d..2cc421aa1f 100644 --- a/ports/nrf/modules/machine/uart.c +++ b/ports/nrf/modules/machine/uart.c @@ -38,7 +38,7 @@ #include "py/ringbuf.h" #include "pin.h" #include "genhdr/pins.h" -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/interrupt_char.h" #include "uart.h" #include "mpconfigboard.h" diff --git a/ports/pic16bit/Makefile b/ports/pic16bit/Makefile index 3c2bd54ea2..f0d55ec875 100644 --- a/ports/pic16bit/Makefile +++ b/ports/pic16bit/Makefile @@ -39,9 +39,9 @@ SRC_C = \ modpyb.c \ modpybled.c \ modpybswitch.c \ - lib/utils/pyexec.c \ - lib/utils/sys_stdio_mphal.c \ - lib/mp-readline/readline.c \ + shared/runtime/pyexec.c \ + shared/runtime/sys_stdio_mphal.c \ + shared/readline/readline.c \ SRC_S = \ # gchelper.s \ diff --git a/ports/pic16bit/main.c b/ports/pic16bit/main.c index 07db3f5827..adb9276071 100644 --- a/ports/pic16bit/main.c +++ b/ports/pic16bit/main.c @@ -34,8 +34,8 @@ #include "py/gc.h" #include "py/mphal.h" #include "py/mperrno.h" -#include "lib/utils/pyexec.h" -#include "lib/mp-readline/readline.h" +#include "shared/runtime/pyexec.h" +#include "shared/readline/readline.h" #include "board.h" #include "modpyb.h" diff --git a/ports/powerpc/Makefile b/ports/powerpc/Makefile index 1f5ec80d43..cca170dc02 100644 --- a/ports/powerpc/Makefile +++ b/ports/powerpc/Makefile @@ -34,11 +34,11 @@ LIBS = SRC_C = \ main.c \ uart_$(UART).c \ - lib/utils/printf.c \ - lib/utils/stdout_helpers.c \ - lib/utils/pyexec.c \ - lib/libc/string0.c \ - lib/mp-readline/readline.c \ + shared/libc/printf.c \ + shared/libc/string0.c \ + shared/readline/readline.c \ + shared/runtime/pyexec.c \ + shared/runtime/stdout_helpers.c \ $(BUILD)/_frozen_mpy.c \ OBJ = $(PY_CORE_O) diff --git a/ports/powerpc/main.c b/ports/powerpc/main.c index fdeec13abe..a66d737c13 100644 --- a/ports/powerpc/main.c +++ b/ports/powerpc/main.c @@ -32,7 +32,7 @@ #include "py/gc.h" #include "py/mperrno.h" #include "py/stackctrl.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" void __stack_chk_fail(void); void __stack_chk_fail(void) { diff --git a/ports/qemu-arm/Makefile b/ports/qemu-arm/Makefile index 22d0bf39cd..4a6d63a014 100644 --- a/ports/qemu-arm/Makefile +++ b/ports/qemu-arm/Makefile @@ -16,7 +16,7 @@ ifeq ($(BOARD),netduino2) CFLAGS += -mthumb -mcpu=cortex-m3 -mfloat-abi=soft CFLAGS += -DQEMU_SOC_STM32 LDSCRIPT = stm32.ld -SRC_BOARD_O = lib/utils/gchelper_native.o lib/utils/gchelper_m3.o +SRC_BOARD_O = shared/runtime/gchelper_native.o shared/runtime/gchelper_m3.o MPY_CROSS_FLAGS += -march=armv7m endif @@ -25,7 +25,7 @@ CFLAGS += -mthumb -mcpu=cortex-m0 -mfloat-abi=soft CFLAGS += -DQEMU_SOC_NRF51 LDSCRIPT = nrf51.ld QEMU_EXTRA = -global nrf51-soc.flash-size=1048576 -global nrf51-soc.sram-size=262144 -SRC_BOARD_O = lib/utils/gchelper_native.o lib/utils/gchelper_m0.o +SRC_BOARD_O = shared/runtime/gchelper_native.o shared/runtime/gchelper_m0.o MPY_CROSS_FLAGS += -march=armv7m endif @@ -33,7 +33,7 @@ ifeq ($(BOARD),mps2-an385) CFLAGS += -mthumb -mcpu=cortex-m3 -mfloat-abi=soft CFLAGS += -DQEMU_SOC_MPS2 LDSCRIPT = mps2.ld -SRC_BOARD_O = lib/utils/gchelper_native.o lib/utils/gchelper_m3.o +SRC_BOARD_O = shared/runtime/gchelper_native.o shared/runtime/gchelper_m3.o MPY_CROSS_FLAGS += -march=armv7m endif @@ -42,7 +42,7 @@ CFLAGS += -mcpu=cortex-a9 CFLAGS += -DQEMU_SOC_IMX6 LDSCRIPT = imx6.ld QEMU_EXTRA = -m 128M -SRC_BOARD_O = lib/utils/gchelper_generic.o +SRC_BOARD_O = shared/runtime/gchelper_generic.o # It's really armv7a but closest supported value is armv6. MPY_CROSS_FLAGS += -march=armv6 endif @@ -79,6 +79,8 @@ SRC_COMMON_C = \ uart.c \ moduos.c \ modmachine.c \ + shared/libc/string0.c \ + shared/runtime/sys_stdio_mphal.c \ SRC_RUN_C = \ main.c \ @@ -88,7 +90,6 @@ SRC_TEST_C = \ lib/tinytest/tinytest.c \ LIB_SRC_C += $(addprefix lib/,\ - libc/string0.c \ libm/math.c \ libm/fmodf.c \ libm/nearbyintf.c \ @@ -108,7 +109,6 @@ LIB_SRC_C += $(addprefix lib/,\ libm/atanf.c \ libm/atan2f.c \ libm/roundf.c \ - utils/sys_stdio_mphal.c \ ) OBJ_COMMON = diff --git a/ports/qemu-arm/Makefile.test b/ports/qemu-arm/Makefile.test index b4ad6114b8..e0f3a54169 100644 --- a/ports/qemu-arm/Makefile.test +++ b/ports/qemu-arm/Makefile.test @@ -1,4 +1,4 @@ -LIB_SRC_C = lib/upytesthelper/upytesthelper.c +LIB_SRC_C = shared/upytesthelper/upytesthelper.c FROZEN_MANIFEST ?= "freeze('test-frzmpy')" diff --git a/ports/qemu-arm/mpconfigport.h b/ports/qemu-arm/mpconfigport.h index 1f05719caa..270995979c 100644 --- a/ports/qemu-arm/mpconfigport.h +++ b/ports/qemu-arm/mpconfigport.h @@ -74,7 +74,7 @@ extern const struct _mp_obj_module_t mp_module_uos; #include #ifdef TEST -#include "lib/upytesthelper/upytesthelper.h" +#include "shared/upytesthelper/upytesthelper.h" #undef MP_PLAT_PRINT_STRN #define MP_PLAT_PRINT_STRN(str, len) upytest_output(str, len) #endif diff --git a/ports/qemu-arm/test_main.c b/ports/qemu-arm/test_main.c index a59a8de0ad..284b287311 100644 --- a/ports/qemu-arm/test_main.c +++ b/ports/qemu-arm/test_main.c @@ -11,7 +11,7 @@ #include "py/stackctrl.h" #include "py/gc.h" #include "py/mperrno.h" -#include "lib/utils/gchelper.h" +#include "shared/runtime/gchelper.h" #include "lib/tinytest/tinytest.h" #include "lib/tinytest/tinytest_macros.h" diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt index eb2b3d2a25..3dea793ef9 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt @@ -64,16 +64,16 @@ set(MICROPY_SOURCE_LIB ${MICROPY_DIR}/lib/littlefs/lfs1_util.c ${MICROPY_DIR}/lib/littlefs/lfs2.c ${MICROPY_DIR}/lib/littlefs/lfs2_util.c - ${MICROPY_DIR}/lib/mp-readline/readline.c ${MICROPY_DIR}/lib/oofatfs/ff.c ${MICROPY_DIR}/lib/oofatfs/ffunicode.c - ${MICROPY_DIR}/lib/timeutils/timeutils.c - ${MICROPY_DIR}/lib/utils/gchelper_m0.s - ${MICROPY_DIR}/lib/utils/gchelper_native.c - ${MICROPY_DIR}/lib/utils/mpirq.c - ${MICROPY_DIR}/lib/utils/pyexec.c - ${MICROPY_DIR}/lib/utils/stdout_helpers.c - ${MICROPY_DIR}/lib/utils/sys_stdio_mphal.c + ${MICROPY_DIR}/shared/readline/readline.c + ${MICROPY_DIR}/shared/runtime/gchelper_m0.s + ${MICROPY_DIR}/shared/runtime/gchelper_native.c + ${MICROPY_DIR}/shared/runtime/mpirq.c + ${MICROPY_DIR}/shared/runtime/pyexec.c + ${MICROPY_DIR}/shared/runtime/stdout_helpers.c + ${MICROPY_DIR}/shared/runtime/sys_stdio_mphal.c + ${MICROPY_DIR}/shared/timeutils/timeutils.c ) set(MICROPY_SOURCE_DRIVERS @@ -108,8 +108,8 @@ set(MICROPY_SOURCE_QSTR ${MICROPY_SOURCE_PY} ${MICROPY_SOURCE_EXTMOD} ${MICROPY_SOURCE_USERMOD} - ${MICROPY_DIR}/lib/utils/mpirq.c - ${MICROPY_DIR}/lib/utils/sys_stdio_mphal.c + ${MICROPY_DIR}/shared/runtime/mpirq.c + ${MICROPY_DIR}/shared/runtime/sys_stdio_mphal.c ${PROJECT_SOURCE_DIR}/machine_adc.c ${PROJECT_SOURCE_DIR}/machine_i2c.c ${PROJECT_SOURCE_DIR}/machine_pin.c diff --git a/ports/rp2/machine_pin.c b/ports/rp2/machine_pin.c index 0525e0f9f6..aa3cad6ef0 100644 --- a/ports/rp2/machine_pin.c +++ b/ports/rp2/machine_pin.c @@ -29,7 +29,7 @@ #include "py/runtime.h" #include "py/mphal.h" -#include "lib/utils/mpirq.h" +#include "shared/runtime/mpirq.h" #include "modmachine.h" #include "extmod/virtpin.h" diff --git a/ports/rp2/machine_rtc.c b/ports/rp2/machine_rtc.c index a7c55b616b..9d59124a66 100644 --- a/ports/rp2/machine_rtc.c +++ b/ports/rp2/machine_rtc.c @@ -35,7 +35,7 @@ #include "py/runtime.h" #include "py/mphal.h" #include "py/mperrno.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "hardware/rtc.h" #include "pico/util/datetime.h" #include "modmachine.h" diff --git a/ports/rp2/main.c b/ports/rp2/main.c index 8c5772171a..e615f69112 100644 --- a/ports/rp2/main.c +++ b/ports/rp2/main.c @@ -32,9 +32,9 @@ #include "py/mperrno.h" #include "py/mphal.h" #include "py/stackctrl.h" -#include "lib/mp-readline/readline.h" -#include "lib/utils/gchelper.h" -#include "lib/utils/pyexec.h" +#include "shared/readline/readline.h" +#include "shared/runtime/gchelper.h" +#include "shared/runtime/pyexec.h" #include "tusb.h" #include "uart.h" #include "modmachine.h" diff --git a/ports/rp2/modmachine.c b/ports/rp2/modmachine.c index 3656a7db5a..1b2b2adad7 100644 --- a/ports/rp2/modmachine.c +++ b/ports/rp2/modmachine.c @@ -26,7 +26,7 @@ #include "py/runtime.h" #include "py/mphal.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #include "extmod/machine_i2c.h" #include "extmod/machine_mem.h" #include "extmod/machine_pulse.h" diff --git a/ports/rp2/modutime.c b/ports/rp2/modutime.c index 4835a0ee11..8041ae65b6 100644 --- a/ports/rp2/modutime.c +++ b/ports/rp2/modutime.c @@ -25,7 +25,7 @@ */ #include "py/runtime.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "extmod/utime_mphal.h" #include "hardware/rtc.h" diff --git a/ports/rp2/mphalport.c b/ports/rp2/mphalport.c index 1d77bc8f5d..3385323db0 100644 --- a/ports/rp2/mphalport.c +++ b/ports/rp2/mphalport.c @@ -27,7 +27,7 @@ #include "py/runtime.h" #include "py/stream.h" #include "py/mphal.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "tusb.h" #include "uart.h" #include "hardware/rtc.h" diff --git a/ports/rp2/rp2_pio.c b/ports/rp2/rp2_pio.c index 44928c0a88..414fa8bd70 100644 --- a/ports/rp2/rp2_pio.c +++ b/ports/rp2/rp2_pio.c @@ -30,7 +30,7 @@ #include "py/runtime.h" #include "py/mperrno.h" #include "py/mphal.h" -#include "lib/utils/mpirq.h" +#include "shared/runtime/mpirq.h" #include "modrp2.h" #include "hardware/clocks.h" diff --git a/ports/samd/Makefile b/ports/samd/Makefile index ffd0f06a3f..d29d9c5b24 100644 --- a/ports/samd/Makefile +++ b/ports/samd/Makefile @@ -53,27 +53,27 @@ SRC_C = \ samd_isr.c \ samd_soc.c \ tusb_port.c \ - lib/libc/string0.c \ lib/libm/ef_sqrt.c \ lib/libm/fmodf.c \ lib/libm/math.c \ lib/libm/nearbyintf.c \ - lib/mp-readline/readline.c \ lib/tinyusb/src/class/cdc/cdc_device.c \ lib/tinyusb/src/common/tusb_fifo.c \ lib/tinyusb/src/device/usbd.c \ lib/tinyusb/src/device/usbd_control.c \ lib/tinyusb/src/portable/microchip/samd/dcd_samd.c \ lib/tinyusb/src/tusb.c \ - lib/utils/gchelper_native.c \ - lib/utils/printf.c \ - lib/utils/pyexec.c \ - lib/utils/stdout_helpers.c \ + shared/libc/printf.c \ + shared/libc/string0.c \ + shared/readline/readline.c \ + shared/runtime/gchelper_native.c \ + shared/runtime/pyexec.c \ + shared/runtime/stdout_helpers.c \ ifeq ($(MCU_SERIES),SAMD21) -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 # List of sources for qstr extraction diff --git a/ports/samd/main.c b/ports/samd/main.c index 038373ceb4..1c72f04ab8 100644 --- a/ports/samd/main.c +++ b/ports/samd/main.c @@ -29,8 +29,8 @@ #include "py/gc.h" #include "py/mperrno.h" #include "py/stackctrl.h" -#include "lib/utils/gchelper.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/gchelper.h" +#include "shared/runtime/pyexec.h" extern uint8_t _sstack, _estack, _sheap, _eheap; diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index 9c63707071..ebf1466118 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -157,19 +157,19 @@ endif # Options for mpy-cross MPY_CROSS_FLAGS += -march=armv7m -LIB_SRC_C += $(addprefix lib/,\ +SHARED_SRC_C += $(addprefix shared/,\ libc/string0.c \ - mp-readline/readline.c \ + netutils/dhcpserver.c \ netutils/netutils.c \ netutils/trace.c \ - netutils/dhcpserver.c \ + readline/readline.c \ + runtime/gchelper_native.c \ + runtime/interrupt_char.c \ + runtime/mpirq.c \ + runtime/pyexec.c \ + runtime/stdout_helpers.c \ + runtime/sys_stdio_mphal.c \ timeutils/timeutils.c \ - utils/gchelper_native.c \ - utils/pyexec.c \ - utils/interrupt_char.c \ - utils/stdout_helpers.c \ - utils/sys_stdio_mphal.c \ - utils/mpirq.c \ ) ifeq ($(MICROPY_FLOAT_IMPL),double) @@ -359,18 +359,18 @@ SRC_O += \ ifeq ($(MCU_SERIES),f0) SRC_O += \ resethandler_m0.o \ - lib/utils/gchelper_m0.o + shared/runtime/gchelper_m0.o else ifeq ($(MCU_SERIES),l0) CSUPEROPT = -Os # save some code space SRC_O += \ resethandler_m0.o \ - lib/utils/gchelper_m0.o + shared/runtime/gchelper_m0.o else SRC_O += \ system_stm32.o \ resethandler.o \ - lib/utils/gchelper_m3.o + shared/runtime/gchelper_m3.o endif endif @@ -542,6 +542,7 @@ endif OBJ += $(PY_O) OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o)) OBJ += $(LIBM_O) +OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(HAL_SRC_C:.c=.o)) @@ -555,7 +556,7 @@ OBJ += $(BUILD)/pins_$(BOARD).o # This file contains performance critical functions so turn up the optimisation # level. It doesn't add much to the code size and improves performance a bit. # Don't use -O3 with this file because gcc tries to optimise memset in terms of itself. -$(BUILD)/lib/libc/string0.o: COPT += -O2 +$(BUILD)/shared/libc/string0.o: COPT += -O2 # We put several files into the first 16K section with the ISRs. # If we compile these using -O0 then it won't fit. So if you really want these @@ -728,7 +729,7 @@ GEN_CDCINF_FILE = $(HEADER_BUILD)/pybcdc.inf GEN_CDCINF_HEADER = $(HEADER_BUILD)/pybcdc_inf.h # List of sources for qstr extraction -SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SRC_MOD) $(LIB_SRC_C) $(EXTMOD_SRC_C) +SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SRC_MOD) $(SHARED_SRC_C) $(EXTMOD_SRC_C) # Append any auto-generated sources that are needed by sources listed in # SRC_QSTR SRC_QSTR_AUTO_DEPS += $(GEN_CDCINF_HEADER) diff --git a/ports/stm32/boardctrl.c b/ports/stm32/boardctrl.c index fa71d8e7f4..922f218e92 100644 --- a/ports/stm32/boardctrl.c +++ b/ports/stm32/boardctrl.c @@ -26,7 +26,7 @@ #include "py/runtime.h" #include "py/mphal.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #include "boardctrl.h" #include "led.h" #include "usrsw.h" diff --git a/ports/stm32/eth.c b/ports/stm32/eth.c index 79165e1191..f174b6af0d 100644 --- a/ports/stm32/eth.c +++ b/ports/stm32/eth.c @@ -27,7 +27,7 @@ #include #include "py/mphal.h" #include "py/mperrno.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "pin_static_af.h" #include "modnetwork.h" #include "mpu.h" diff --git a/ports/stm32/gccollect.c b/ports/stm32/gccollect.c index 8b47b121ec..bd697a2af3 100644 --- a/ports/stm32/gccollect.c +++ b/ports/stm32/gccollect.c @@ -30,7 +30,7 @@ #include "py/mpstate.h" #include "py/gc.h" #include "py/mpthread.h" -#include "lib/utils/gchelper.h" +#include "shared/runtime/gchelper.h" #include "gccollect.h" #include "softtimer.h" #include "systick.h" diff --git a/ports/stm32/machine_uart.c b/ports/stm32/machine_uart.c index 1b8db2e3e6..354a1e26ac 100644 --- a/ports/stm32/machine_uart.c +++ b/ports/stm32/machine_uart.c @@ -32,8 +32,8 @@ #include "py/stream.h" #include "py/mperrno.h" #include "py/mphal.h" -#include "lib/utils/interrupt_char.h" -#include "lib/utils/mpirq.h" +#include "shared/runtime/interrupt_char.h" +#include "shared/runtime/mpirq.h" #include "uart.h" #include "irq.h" #include "pendsv.h" diff --git a/ports/stm32/main.c b/ports/stm32/main.c index 86b8fb7972..d7afb9e4af 100644 --- a/ports/stm32/main.c +++ b/ports/stm32/main.c @@ -32,8 +32,8 @@ #include "py/gc.h" #include "py/mperrno.h" #include "py/mphal.h" -#include "lib/mp-readline/readline.h" -#include "lib/utils/pyexec.h" +#include "shared/readline/readline.h" +#include "shared/runtime/pyexec.h" #include "lib/oofatfs/ff.h" #include "lib/littlefs/lfs1.h" #include "lib/littlefs/lfs1_util.h" diff --git a/ports/stm32/mboot/Makefile b/ports/stm32/mboot/Makefile index 41a1a73bc5..553fc4ac66 100755 --- a/ports/stm32/mboot/Makefile +++ b/ports/stm32/mboot/Makefile @@ -105,9 +105,9 @@ else COPT += -Os -DNDEBUG endif -$(BUILD)/lib/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN) +$(BUILD)/shared/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN) LIB_SRC_C += \ - lib/libc/string0.c \ + shared/libc/string0.c \ lib/littlefs/lfs1.c \ lib/littlefs/lfs1_util.c \ lib/littlefs/lfs2.c \ diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c index 66c696982b..2b7e22d13a 100644 --- a/ports/stm32/modmachine.c +++ b/ports/stm32/modmachine.c @@ -38,7 +38,7 @@ #include "extmod/machine_pulse.h" #include "extmod/machine_i2c.h" #include "extmod/machine_spi.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #include "lib/oofatfs/ff.h" #include "extmod/vfs.h" #include "extmod/vfs_fat.h" diff --git a/ports/stm32/modnetwork.c b/ports/stm32/modnetwork.c index 4279df0884..06c4eb05db 100644 --- a/ports/stm32/modnetwork.c +++ b/ports/stm32/modnetwork.c @@ -31,7 +31,7 @@ #include "py/objlist.h" #include "py/runtime.h" #include "py/mphal.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "systick.h" #include "pendsv.h" #include "modnetwork.h" diff --git a/ports/stm32/modnwcc3k.c b/ports/stm32/modnwcc3k.c index b52958ba22..07178b65c7 100644 --- a/ports/stm32/modnwcc3k.c +++ b/ports/stm32/modnwcc3k.c @@ -36,7 +36,7 @@ #include "py/runtime.h" #include "py/mperrno.h" #include "py/mphal.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "modnetwork.h" #include "pin.h" #include "spi.h" diff --git a/ports/stm32/modnwwiznet5k.c b/ports/stm32/modnwwiznet5k.c index 204b9fcc3f..1e18d03ca1 100644 --- a/ports/stm32/modnwwiznet5k.c +++ b/ports/stm32/modnwwiznet5k.c @@ -33,7 +33,7 @@ #include "py/stream.h" #include "py/mperrno.h" #include "py/mphal.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "modnetwork.h" #include "pin.h" #include "spi.h" diff --git a/ports/stm32/modpyb.c b/ports/stm32/modpyb.c index c920906991..b9e2bac03f 100644 --- a/ports/stm32/modpyb.c +++ b/ports/stm32/modpyb.c @@ -29,7 +29,7 @@ #include "py/runtime.h" #include "py/mphal.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #include "drivers/dht/dht.h" #include "stm32_it.h" #include "irq.h" diff --git a/ports/stm32/moduos.c b/ports/stm32/moduos.c index 6f9740c645..5b2335272f 100644 --- a/ports/stm32/moduos.c +++ b/ports/stm32/moduos.c @@ -30,7 +30,7 @@ #include "py/runtime.h" #include "py/objtuple.h" #include "py/objstr.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "lib/oofatfs/ff.h" #include "lib/oofatfs/diskio.h" #include "extmod/misc.h" diff --git a/ports/stm32/modusocket.c b/ports/stm32/modusocket.c index 2732d472b5..c59fc85226 100644 --- a/ports/stm32/modusocket.c +++ b/ports/stm32/modusocket.c @@ -32,7 +32,7 @@ #include "py/runtime.h" #include "py/stream.h" #include "py/mperrno.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "modnetwork.h" #if MICROPY_PY_USOCKET && !MICROPY_PY_LWIP diff --git a/ports/stm32/modutime.c b/ports/stm32/modutime.c index 4bce45eb33..1a22c34b6b 100644 --- a/ports/stm32/modutime.c +++ b/ports/stm32/modutime.c @@ -30,7 +30,7 @@ #include "py/runtime.h" #include "py/smallint.h" #include "py/obj.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "extmod/utime_mphal.h" #include "systick.h" #include "portmodules.h" diff --git a/ports/stm32/mpbthciport.c b/ports/stm32/mpbthciport.c index accb913e1f..369c91e303 100644 --- a/ports/stm32/mpbthciport.c +++ b/ports/stm32/mpbthciport.c @@ -31,7 +31,7 @@ #include "mpbthciport.h" #include "softtimer.h" #include "pendsv.h" -#include "lib/utils/mpirq.h" +#include "shared/runtime/mpirq.h" #if MICROPY_PY_BLUETOOTH diff --git a/ports/stm32/network_wiznet5k.c b/ports/stm32/network_wiznet5k.c index c85ef5e88e..bd4c02cb05 100644 --- a/ports/stm32/network_wiznet5k.c +++ b/ports/stm32/network_wiznet5k.c @@ -34,7 +34,7 @@ #if MICROPY_PY_WIZNET5K && MICROPY_PY_LWIP -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" #include "drivers/wiznet5k/ethernet/socket.h" #include "lwip/err.h" #include "lwip/dns.h" diff --git a/ports/stm32/pendsv.c b/ports/stm32/pendsv.c index c5b2fcf92a..d4c4496f1b 100644 --- a/ports/stm32/pendsv.c +++ b/ports/stm32/pendsv.c @@ -27,7 +27,7 @@ #include #include "py/runtime.h" -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/interrupt_char.h" #include "pendsv.h" #include "irq.h" diff --git a/ports/stm32/rtc.c b/ports/stm32/rtc.c index 02b0f2dbd1..ab8b49e188 100644 --- a/ports/stm32/rtc.c +++ b/ports/stm32/rtc.c @@ -27,7 +27,7 @@ #include #include "py/runtime.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" #include "extint.h" #include "rtc.h" #include "irq.h" diff --git a/ports/stm32/uart.c b/ports/stm32/uart.c index 9f74416170..b15be85336 100644 --- a/ports/stm32/uart.c +++ b/ports/stm32/uart.c @@ -32,8 +32,8 @@ #include "py/stream.h" #include "py/mperrno.h" #include "py/mphal.h" -#include "lib/utils/interrupt_char.h" -#include "lib/utils/mpirq.h" +#include "shared/runtime/interrupt_char.h" +#include "shared/runtime/mpirq.h" #include "uart.h" #include "irq.h" #include "pendsv.h" diff --git a/ports/stm32/uart.h b/ports/stm32/uart.h index 0490a617f6..286b6cdec0 100644 --- a/ports/stm32/uart.h +++ b/ports/stm32/uart.h @@ -26,7 +26,7 @@ #ifndef MICROPY_INCLUDED_STM32_UART_H #define MICROPY_INCLUDED_STM32_UART_H -#include "lib/utils/mpirq.h" +#include "shared/runtime/mpirq.h" typedef enum { PYB_UART_NONE = 0, diff --git a/ports/stm32/usb.c b/ports/stm32/usb.c index 5e3802651b..838613f283 100644 --- a/ports/stm32/usb.c +++ b/ports/stm32/usb.c @@ -39,7 +39,7 @@ #include "py/stream.h" #include "py/mperrno.h" #include "py/mphal.h" -#include "lib/utils/mpirq.h" +#include "shared/runtime/mpirq.h" #include "bufhelper.h" #include "storage.h" #include "sdcard.h" diff --git a/ports/stm32/usbd_cdc_interface.c b/ports/stm32/usbd_cdc_interface.c index a1ac5fd22f..5f27bbe29a 100644 --- a/ports/stm32/usbd_cdc_interface.c +++ b/ports/stm32/usbd_cdc_interface.c @@ -42,7 +42,7 @@ #include "pendsv.h" #include "py/obj.h" -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/interrupt_char.h" #include "irq.h" #if MICROPY_HW_ENABLE_USB diff --git a/ports/teensy/Makefile b/ports/teensy/Makefile index cf9529442a..d1ff421621 100644 --- a/ports/teensy/Makefile +++ b/ports/teensy/Makefile @@ -100,12 +100,12 @@ STM_SRC_C = $(addprefix ports/stm32/,\ pin_named_pins.c \ ) -LIB_SRC_C = $(addprefix lib/,\ +SHARED_SRC_C = $(addprefix shared/,\ libc/string0.c \ - mp-readline/readline.c \ - utils/gchelper_native.c \ - utils/pyexec.c \ - utils/sys_stdio_mphal.c \ + readline/readline.c \ + runtime/gchelper_native.c \ + runtime/pyexec.c \ + runtime/sys_stdio_mphal.c \ ) SRC_TEENSY = $(addprefix core/,\ @@ -120,8 +120,8 @@ SRC_TEENSY = $(addprefix core/,\ ) OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(STM_SRC_C:.c=.o) $(SRC_TEENSY:.c=.o)) -OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o)) -OBJ += $(BUILD)/lib/utils/gchelper_m3.o +OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o)) +OBJ += $(BUILD)/shared/runtime/gchelper_m3.o OBJ += $(BUILD)/pins_gen.o all: hex @@ -129,13 +129,13 @@ hex: $(BUILD)/micropython.hex ifeq ($(USE_MEMZIP),1) SRC_C += \ - lib/memzip/import.c \ - lib/memzip/lexermemzip.c \ - lib/memzip/memzip.c \ + shared/memzip/import.c \ + shared/memzip/lexermemzip.c \ + shared/memzip/memzip.c \ OBJ += $(BUILD)/memzip-files.o -MAKE_MEMZIP = $(TOP)/lib/memzip/make-memzip.py +MAKE_MEMZIP = $(TOP)/shared/memzip/make-memzip.py ifeq ($(MEMZIP_DIR),) MEMZIP_DIR = memzip_files endif @@ -207,7 +207,7 @@ GEN_PINS_AF_CONST = $(HEADER_BUILD)/pins_af_const.h GEN_PINS_AF_PY = $(BUILD)/pins_af.py # List of sources for qstr extraction -SRC_QSTR += $(SRC_C) $(STM_SRC_C) $(LIB_SRC_C) +SRC_QSTR += $(SRC_C) $(STM_SRC_C) $(SHARED_SRC_C) # Append any auto-generated sources that are needed by sources listed in # SRC_QSTR SRC_QSTR_AUTO_DEPS += diff --git a/ports/teensy/main.c b/ports/teensy/main.c index d4c5f0396f..6ebdcde21c 100644 --- a/ports/teensy/main.c +++ b/ports/teensy/main.c @@ -9,9 +9,9 @@ #include "py/gc.h" #include "py/mphal.h" #include "gccollect.h" -#include "lib/utils/gchelper.h" -#include "lib/utils/pyexec.h" -#include "lib/mp-readline/readline.h" +#include "shared/readline/readline.h" +#include "shared/runtime/gchelper.h" +#include "shared/runtime/pyexec.h" #include "lexermemzip.h" #include "Arduino.h" diff --git a/ports/teensy/modpyb.c b/ports/teensy/modpyb.c index 6671b3abdc..f5bb3ea7b8 100644 --- a/ports/teensy/modpyb.c +++ b/ports/teensy/modpyb.c @@ -33,7 +33,7 @@ #include "py/gc.h" #include "py/mphal.h" -#include "lib/utils/pyexec.h" +#include "shared/runtime/pyexec.h" #include "gccollect.h" #include "systick.h" diff --git a/ports/unix/Makefile b/ports/unix/Makefile index d97e4bc7e0..faa978f3f8 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -117,9 +117,9 @@ endif endif 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 @@ -241,10 +241,10 @@ SRC_C += \ $(SRC_MOD) \ $(wildcard $(VARIANT_DIR)/*.c) -LIB_SRC_C += $(addprefix lib/,\ - $(LIB_SRC_C_EXTRA) \ +SHARED_SRC_C += $(addprefix shared/,\ + runtime/gchelper_generic.c \ timeutils/timeutils.c \ - utils/gchelper_generic.c \ + $(SHARED_SRC_C_EXTRA) \ ) SRC_CXX += \ @@ -253,11 +253,11 @@ SRC_CXX += \ OBJ = $(PY_O) OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.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)) # List of sources for qstr extraction -SRC_QSTR += $(SRC_C) $(SRC_CXX) $(LIB_SRC_C) $(EXTMOD_SRC_C) +SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C) $(EXTMOD_SRC_C) # Append any auto-generated sources that are needed by sources listed in # SRC_QSTR SRC_QSTR_AUTO_DEPS += diff --git a/ports/unix/gccollect.c b/ports/unix/gccollect.c index f0441e4ea3..79b17663c3 100644 --- a/ports/unix/gccollect.c +++ b/ports/unix/gccollect.c @@ -29,7 +29,7 @@ #include "py/mpstate.h" #include "py/gc.h" -#include "lib/utils/gchelper.h" +#include "shared/runtime/gchelper.h" #if MICROPY_ENABLE_GC diff --git a/ports/unix/input.c b/ports/unix/input.c index 4a77d1b278..c5bf719738 100644 --- a/ports/unix/input.c +++ b/ports/unix/input.c @@ -35,7 +35,7 @@ #include "input.h" #if MICROPY_USE_READLINE == 1 -#include "lib/mp-readline/readline.h" +#include "shared/readline/readline.h" #endif #if MICROPY_USE_READLINE == 0 diff --git a/ports/unix/main.c b/ports/unix/main.c index a5db0869df..031bdd75d1 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -159,7 +159,7 @@ STATIC int execute_from_lexer(int source_kind, const void *source, mp_parse_inpu } #if MICROPY_USE_READLINE == 1 -#include "lib/mp-readline/readline.h" +#include "shared/readline/readline.h" #else STATIC char *strjoin(const char *s1, int sep_char, const char *s2) { int l1 = strlen(s1); diff --git a/ports/unix/mphalport.h b/ports/unix/mphalport.h index 89d23ca5d2..510f9d939d 100644 --- a/ports/unix/mphalport.h +++ b/ports/unix/mphalport.h @@ -52,7 +52,7 @@ static inline int mp_hal_readline(vstr_t *vstr, const char *p) { #elif MICROPY_PY_BUILTINS_INPUT && MICROPY_USE_READLINE == 1 #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/ports/unix/mpthreadport.c b/ports/unix/mpthreadport.c index d3243b337f..63aac1da38 100644 --- a/ports/unix/mpthreadport.c +++ b/ports/unix/mpthreadport.c @@ -39,7 +39,7 @@ #include #include -#include "lib/utils/gchelper.h" +#include "shared/runtime/gchelper.h" // Some platforms don't have SIGRTMIN but if we do have it, use it to avoid // potential conflict with other uses of the more commonly used SIGUSR1. diff --git a/ports/windows/Makefile b/ports/windows/Makefile index b48c9378b5..d87affa15c 100644 --- a/ports/windows/Makefile +++ b/ports/windows/Makefile @@ -28,8 +28,8 @@ endif # source files SRC_C = \ - lib/utils/gchelper_generic.c \ - lib/utils/printf.c \ + shared/libc/printf.c \ + shared/runtime/gchelper_generic.c \ ports/unix/main.c \ ports/unix/input.c \ ports/unix/modos.c \ @@ -47,7 +47,7 @@ OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) ifeq ($(MICROPY_USE_READLINE),1) CFLAGS_MOD += -DMICROPY_USE_READLINE=1 -SRC_C += lib/mp-readline/readline.c +SRC_C += shared/readline/readline.c endif LIB += -lws2_32 diff --git a/ports/windows/micropython.vcxproj b/ports/windows/micropython.vcxproj index 73a837a840..1beca9e508 100644 --- a/ports/windows/micropython.vcxproj +++ b/ports/windows/micropython.vcxproj @@ -85,8 +85,8 @@ - - + + @@ -109,4 +109,4 @@ - \ No newline at end of file + diff --git a/ports/zephyr/CMakeLists.txt b/ports/zephyr/CMakeLists.txt index 5c09fc76ee..ca18f2cb91 100644 --- a/ports/zephyr/CMakeLists.txt +++ b/ports/zephyr/CMakeLists.txt @@ -54,14 +54,18 @@ set(MICROPY_SOURCE_PORT ) list(TRANSFORM MICROPY_SOURCE_PORT PREPEND ${MICROPY_PORT_DIR}/) -set(MICROPY_SOURCE_LIB +set(MICROPY_SOURCE_SHARED + libc/printf.c + readline/readline.c + runtime/interrupt_char.c + runtime/mpirq.c + runtime/pyexec.c + runtime/stdout_helpers.c timeutils/timeutils.c - utils/mpirq.c - utils/stdout_helpers.c - utils/printf.c - utils/pyexec.c - utils/interrupt_char.c - mp-readline/readline.c +) +list(TRANSFORM MICROPY_SOURCE_SHARED PREPEND ${MICROPY_DIR}/shared/) + +set(MICROPY_SOURCE_LIB oofatfs/ff.c oofatfs/ffunicode.c littlefs/lfs1.c @@ -74,6 +78,7 @@ list(TRANSFORM MICROPY_SOURCE_LIB PREPEND ${MICROPY_DIR}/lib/) set(MICROPY_SOURCE_QSTR ${MICROPY_SOURCE_PY} ${MICROPY_SOURCE_EXTMOD} + ${MICROPY_SOURCE_SHARED} ${MICROPY_SOURCE_LIB} ${MICROPY_SOURCE_PORT} ) diff --git a/ports/zephyr/machine_pin.c b/ports/zephyr/machine_pin.c index 34c822c2f0..f9da2433c0 100644 --- a/ports/zephyr/machine_pin.c +++ b/ports/zephyr/machine_pin.c @@ -35,7 +35,7 @@ #include "py/runtime.h" #include "py/gc.h" #include "py/mphal.h" -#include "lib/utils/mpirq.h" +#include "shared/runtime/mpirq.h" #include "modmachine.h" #if MICROPY_PY_MACHINE diff --git a/ports/zephyr/main.c b/ports/zephyr/main.c index 38285ad944..63190bd5ed 100644 --- a/ports/zephyr/main.c +++ b/ports/zephyr/main.c @@ -47,8 +47,8 @@ #include "py/gc.h" #include "py/mphal.h" #include "py/stackctrl.h" -#include "lib/utils/pyexec.h" -#include "lib/mp-readline/readline.h" +#include "shared/runtime/pyexec.h" +#include "shared/readline/readline.h" #include "extmod/modbluetooth.h" #if MICROPY_VFS @@ -59,9 +59,9 @@ #include "modzephyr.h" #ifdef TEST -#include "lib/upytesthelper/upytesthelper.h" +#include "shared/upytesthelper/upytesthelper.h" #include "lib/tinytest/tinytest.c" -#include "lib/upytesthelper/upytesthelper.c" +#include "shared/upytesthelper/upytesthelper.c" #include TEST #endif diff --git a/ports/zephyr/mpconfigport_bin_testsuite.h b/ports/zephyr/mpconfigport_bin_testsuite.h index 684b4f41c2..4367067af3 100644 --- a/ports/zephyr/mpconfigport_bin_testsuite.h +++ b/ports/zephyr/mpconfigport_bin_testsuite.h @@ -26,6 +26,6 @@ #include "mpconfigport.h" #ifdef TEST -#include "lib/upytesthelper/upytesthelper.h" +#include "shared/upytesthelper/upytesthelper.h" #define MP_PLAT_PRINT_STRN(str, len) upytest_output(str, len) #endif diff --git a/ports/zephyr/mphalport.h b/ports/zephyr/mphalport.h index 63a18e1388..ba902a76aa 100644 --- a/ports/zephyr/mphalport.h +++ b/ports/zephyr/mphalport.h @@ -1,5 +1,5 @@ #include -#include "lib/utils/interrupt_char.h" +#include "shared/runtime/interrupt_char.h" void mp_hal_init(void); void mp_hal_wait_sem(struct k_sem *sem, uint32_t timeout_ms); diff --git a/py/modbuiltins.c b/py/modbuiltins.c index ac41942b9c..c9a49685a4 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -230,7 +230,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_hex_obj, mp_builtin_hex); #if MICROPY_PY_BUILTINS_INPUT #include "py/mphal.h" -#include "lib/mp-readline/readline.h" +#include "shared/readline/readline.h" // A port can define mp_hal_readline if they want to use a custom function here #ifndef mp_hal_readline diff --git a/py/mpconfig.h b/py/mpconfig.h index d40637dfaf..48c4c6d347 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1063,7 +1063,7 @@ typedef double mp_float_t; #endif // Whether to provide the built-in input() function. The implementation of this -// uses mp-readline, so can only be enabled if the port uses this readline. +// uses shared/readline, so can only be enabled if the port uses this readline. #ifndef MICROPY_PY_BUILTINS_INPUT #define MICROPY_PY_BUILTINS_INPUT (0) #endif diff --git a/py/py.mk b/py/py.mk index ab01b0ec21..bc9232ef4f 100644 --- a/py/py.mk +++ b/py/py.mk @@ -209,8 +209,8 @@ PY_EXTMOD_O_BASENAME = \ extmod/vfs_lfs.o \ extmod/utime_mphal.o \ extmod/uos_dupterm.o \ - lib/embed/abort_.o \ - lib/utils/printf.o \ + shared/libc/abort_.o \ + shared/libc/printf.o \ # prepend the build destination prefix to the py object files PY_CORE_O = $(addprefix $(BUILD)/, $(PY_CORE_O_BASENAME)) @@ -272,7 +272,7 @@ $(HEADER_BUILD)/moduledefs.h: $(SRC_QSTR) $(QSTR_GLOBAL_DEPENDENCIES) | $(HEADER # Standard C functions like memset need to be compiled with special flags so # the compiler does not optimise these functions in terms of themselves. CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto -$(BUILD)/lib/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN) +$(BUILD)/shared/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN) # Force nlr code to always be compiled with space-saving optimisation so # that the function preludes are of a minimal and predictable form. diff --git a/shared/memzip/README.md b/shared/memzip/README.md index 287d0fc489..3938e3198c 100644 --- a/shared/memzip/README.md +++ b/shared/memzip/README.md @@ -10,13 +10,13 @@ a C file which contains the data from the zip file. A typical addition to a makefile would look like: ``` SRC_C += \ - lib/memzip/import.c \ - lib/memzip/lexermemzip.c \ - lib/memzip/memzip.c \ + shared/memzip/import.c \ + shared/memzip/lexermemzip.c \ + shared/memzip/memzip.c \ OBJ += $(BUILD)/memzip-files.o -MAKE_MEMZIP = ../lib/memzip/make-memzip.py +MAKE_MEMZIP = ../shared/memzip/make-memzip.py $(BUILD)/memzip-files.o: $(BUILD)/memzip-files.c $(call compile_c) diff --git a/shared/netutils/dhcpserver.c b/shared/netutils/dhcpserver.c index 7f97ee6e46..9db42b3fd9 100644 --- a/shared/netutils/dhcpserver.c +++ b/shared/netutils/dhcpserver.c @@ -35,7 +35,7 @@ #if MICROPY_PY_LWIP -#include "lib/netutils/dhcpserver.h" +#include "shared/netutils/dhcpserver.h" #include "lwip/udp.h" #define DHCPDISCOVER (1) diff --git a/shared/netutils/netutils.c b/shared/netutils/netutils.c index 40fbd5bca3..84b4405c41 100644 --- a/shared/netutils/netutils.c +++ b/shared/netutils/netutils.c @@ -30,7 +30,7 @@ #include #include "py/runtime.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" // Takes an array with a raw IPv4 address and returns something like '192.168.0.1'. mp_obj_t netutils_format_ipv4_addr(uint8_t *ip, netutils_endian_t endian) { diff --git a/shared/netutils/trace.c b/shared/netutils/trace.c index 1610966c2d..a6dfb42c28 100644 --- a/shared/netutils/trace.c +++ b/shared/netutils/trace.c @@ -25,7 +25,7 @@ */ #include "py/mphal.h" -#include "lib/netutils/netutils.h" +#include "shared/netutils/netutils.h" static uint32_t get_be16(const uint8_t *buf) { return buf[0] << 8 | buf[1]; diff --git a/shared/readline/readline.c b/shared/readline/readline.c index 296c8aa4ab..cad85b4e6b 100644 --- a/shared/readline/readline.c +++ b/shared/readline/readline.c @@ -31,7 +31,7 @@ #include "py/mpstate.h" #include "py/repl.h" #include "py/mphal.h" -#include "lib/mp-readline/readline.h" +#include "shared/readline/readline.h" #if 0 // print debugging info #define DEBUG_PRINT (1) diff --git a/shared/runtime/gchelper_generic.c b/shared/runtime/gchelper_generic.c index 3e7e33ab18..dcd35f9c7e 100644 --- a/shared/runtime/gchelper_generic.c +++ b/shared/runtime/gchelper_generic.c @@ -28,7 +28,7 @@ #include "py/mpstate.h" #include "py/gc.h" -#include "lib/utils/gchelper.h" +#include "shared/runtime/gchelper.h" #if MICROPY_ENABLE_GC diff --git a/shared/runtime/gchelper_native.c b/shared/runtime/gchelper_native.c index 6bf386b519..1e4af9c844 100644 --- a/shared/runtime/gchelper_native.c +++ b/shared/runtime/gchelper_native.c @@ -28,7 +28,7 @@ #include "py/mpstate.h" #include "py/gc.h" -#include "lib/utils/gchelper.h" +#include "shared/runtime/gchelper.h" #if MICROPY_ENABLE_GC diff --git a/shared/runtime/mpirq.c b/shared/runtime/mpirq.c index 02139f24dc..8e474bf5a2 100644 --- a/shared/runtime/mpirq.c +++ b/shared/runtime/mpirq.c @@ -29,7 +29,7 @@ #include "py/runtime.h" #include "py/gc.h" -#include "lib/utils/mpirq.h" +#include "shared/runtime/mpirq.h" #if MICROPY_ENABLE_SCHEDULER diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index 4446b36b61..006ec096f7 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -39,8 +39,8 @@ #include "irq.h" #include "usb.h" #endif -#include "lib/mp-readline/readline.h" -#include "lib/utils/pyexec.h" +#include "shared/readline/readline.h" +#include "shared/runtime/pyexec.h" #include "genhdr/mpversion.h" pyexec_mode_kind_t pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL; diff --git a/shared/timeutils/timeutils.c b/shared/timeutils/timeutils.c index 7c74f5fc37..6bf3eca84a 100644 --- a/shared/timeutils/timeutils.c +++ b/shared/timeutils/timeutils.c @@ -27,7 +27,7 @@ #include "py/obj.h" -#include "lib/timeutils/timeutils.h" +#include "shared/timeutils/timeutils.h" // LEAPOCH corresponds to 2000-03-01, which is a mod-400 year, immediately // after Feb 29. We calculate seconds as a signed integer relative to that. diff --git a/tools/codeformat.py b/tools/codeformat.py index 81a3cdcf8e..f8202c66b9 100755 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -39,9 +39,9 @@ PATHS = [ "extmod/btstack/*.[ch]", "extmod/nimble/*.[ch]", "lib/mbedtls_errors/tester.c", - "lib/netutils/*.[ch]", - "lib/timeutils/*.[ch]", - "lib/utils/*.[ch]", + "shared/netutils/*.[ch]", + "shared/timeutils/*.[ch]", + "shared/runtime/*.[ch]", "mpy-cross/*.[ch]", "ports/*/*.[ch]", "ports/windows/msvc/**/*.[ch]",