micropython: Update to MicroPython v1.22.

This commit is contained in:
iabdalkader 2024-01-02 10:16:58 +01:00
parent c20b71f3b9
commit 1c1cd5856c
17 changed files with 145 additions and 153 deletions

@ -1 +1 @@
Subproject commit b0b6a67f71373d361cd209a38657edcf0088eb8e
Subproject commit b7f8d759040fc4c812150bcfa3a005e762139d85

View File

@ -13,6 +13,7 @@ freeze ("$(OMV_LIB_DIR)/", "machine.py")
# Networking
require("ntptime")
require("webrepl")
freeze ("$(OMV_LIB_DIR)/", "mqtt.py")
freeze ("$(OMV_LIB_DIR)/", "urequests.py")
# Utils

View File

@ -47,7 +47,7 @@
// Enable sensor drivers
#define OMV_ENABLE_OV2640 (0)
#define OMV_ENABLE_OV5640 (1)
#define OMV_ENABLE_OV5640 (0)
#define OMV_ENABLE_OV7690 (0)
#define OMV_ENABLE_OV7725 (0)
#define OMV_ENABLE_OV9650 (0)

View File

@ -15,7 +15,7 @@
#include "py/objarray.h"
#include "py/runtime.h"
#include "mphal.h"
#include "extmod/machine_i2c.h"
#include "extmod/modmachine.h"
#include "omv_gpio.h"
#include "fb_alloc.h"

View File

@ -15,7 +15,7 @@
#include "py/obj.h"
#include "py/nlr.h"
#include "py/runtime.h"
#include "extmod/machine_i2c.h"
#include "extmod/modmachine.h"
#include "py_helper.h"
#include "omv_gpio.h"

View File

@ -15,7 +15,7 @@
#include "py/objarray.h"
#include "py/runtime.h"
#include "mphal.h"
#include "extmod/machine_i2c.h"
#include "extmod/modmachine.h"
#include "omv_gpio.h"
#include "fb_alloc.h"

View File

@ -5,3 +5,5 @@
extern void fb_alloc_free_till_mark(); \
fb_alloc_free_till_mark(); \
} while (0);
#define MICROPY_BANNER_NAME_AND_VERSION "OpenMV " OPENMV_GIT_TAG "; MicroPython " MICROPY_GIT_TAG

View File

@ -17,7 +17,7 @@ CFLAGS += -DCPU_$(MCU_VARIANT)\
-DXIP_EXTERNAL_FLASH=1 \
-DXIP_BOOT_HEADER_ENABLE=1 \
-DFSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1 \
-DCFG_TUSB_MCU=OPT_MCU_MIMXRT \
-DCFG_TUSB_MCU=OPT_MCU_MIMXRT1XXX \
-DCPU_HEADER_H='<$(MCU_SERIES).h>' \
-DCLOCK_CONFIG_H='<boards/$(MCU_SERIES)_clock_config.h>' \
-DCSI_DRIVER_FRAG_MODE=1\
@ -44,10 +44,10 @@ MPY_CFLAGS += -I$(TOP_DIR)/$(MICROPY_DIR)/shared/runtime/
MPY_CFLAGS += -DMICROPY_VFS_FAT=1
ifeq ($(MICROPY_PY_LWIP), 0)
MICROPY_ARGS += MICROPY_PY_LWIP=0 MICROPY_PY_USSL=0
MICROPY_ARGS += MICROPY_PY_LWIP=0 MICROPY_PY_SSL=0
else
MPY_CFLAGS += -DMICROPY_PY_USSL=1 -DMICROPY_SSL_MBEDTLS=1
MICROPY_ARGS += MICROPY_PY_USSL=1 MICROPY_SSL_MBEDTLS=1
MPY_CFLAGS += -DMICROPY_PY_SSL=1 -DMICROPY_SSL_MBEDTLS=1
MICROPY_ARGS += MICROPY_PY_SSL=1 MICROPY_SSL_MBEDTLS=1
endif
MICROPY_ARGS += MCU_DIR=$(TOP_DIR)/$(HAL_DIR) CMSIS_DIR=$(TOP_DIR)/$(CMSIS_DIR)\
SUPPORTS_HARDWARE_FP_SINGLE=1 MICROPY_VFS_LFS2=0
@ -231,24 +231,18 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
frozen_content.o \
flash.o \
led.o \
machine_adc.o \
machine_bitstream.o \
machine_can.o \
machine_i2c.o \
machine_i2s.o \
machine_led.o \
machine_pin.o \
machine_rtc.o \
machine_sdcard.o \
machine_spi.o \
machine_uart.o \
machine_wdt.o \
machine_can.o \
mbedtls/mbedtls_port.o \
mimxrt_flash.o \
mimxrt_sdram.o \
modmachine.o \
modmimxrt.o \
modutime.o \
mpnetworkport.o \
msc_disk.o \
network_lan.o \
@ -348,8 +342,11 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/tinyusb/src/, \
)
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\
machine_adc.o \
machine_adc_block.o \
machine_bitstream.o \
machine_i2c.o \
machine_i2s.o \
machine_mem.o \
machine_pinbase.o \
machine_pulse.o \
@ -357,28 +354,30 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\
machine_signal.o \
machine_spi.o \
machine_timer.o \
machine_uart.o \
machine_wdt.o \
modframebuf.o \
modmachine.o \
modnetwork.o \
modonewire.o \
moduasyncio.o \
modubinascii.o \
moducryptolib.o \
modasyncio.o \
modbinascii.o \
modcryptolib.o \
moddeflate.o \
moductypes.o \
moduhashlib.o \
moduheapq.o \
modujson.o \
moduos.o \
moduplatform.o \
modurandom.o \
modure.o \
moduselect.o \
modusocket.o \
modussl_axtls.o \
modussl_mbedtls.o \
modutimeq.o \
moduzlib.o \
uos_dupterm.o \
utime_mphal.o \
modhashlib.o \
modheapq.o \
modjson.o \
modos.o \
modplatform.o \
modrandom.o \
modre.o \
modselect.o \
modsocket.o \
modssl_axtls.o \
modssl_mbedtls.o \
modtime.o \
os_dupterm.o \
vfs_blockdev.o \
vfs_fat_diskio.o \
vfs_fat_file.o \
@ -442,7 +441,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
lib/lwip/src/netif/*.o \
lib/lwip/src/apps/*/*.o \
extmod/modlwip.o \
extmod/moduwebsocket.o \
extmod/modwebsocket.o \
extmod/modwebrepl.o \
extmod/network_lwip.o \
)

View File

@ -43,7 +43,7 @@
#include "gccollect.h"
#include "modmachine.h"
#include "modmusic.h"
#include "modules/uos/microbitfs.h"
#include "modules/os/microbitfs.h"
#include "led.h"
#include "uart.h"
#include "nrf.h"

View File

@ -5,3 +5,5 @@
extern void fb_alloc_free_till_mark(); \
fb_alloc_free_till_mark(); \
} while (0);
#define MICROPY_BANNER_NAME_AND_VERSION "OpenMV " OPENMV_GIT_TAG "; MicroPython " MICROPY_GIT_TAG

View File

@ -211,21 +211,30 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
)
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\
modujson.o \
moduselect.o \
modure.o \
modframebuf.o \
moduasyncio.o \
moductypes.o \
moduzlib.o \
moduhashlib.o \
moduheapq.o \
modubinascii.o \
modurandom.o \
modutimeq.o \
machine_adc.o \
machine_adc_block.o \
machine_i2c.o \
machine_spi.o \
machine_pwm.o \
utime_mphal.o \
machine_mem.o \
machine_uart.o \
machine_signal.o \
modjson.o \
modselect.o \
modre.o \
modframebuf.o \
modasyncio.o \
moductypes.o \
modhashlib.o \
moddeflate.o \
modheapq.o \
modbinascii.o \
modrandom.o \
modtime.o \
os_dupterm.o \
modmachine.o \
modos.o \
modplatform.o \
vfs.o \
vfs_fat.o \
vfs_lfs.o \
@ -233,7 +242,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\
vfs_fat_diskio.o \
vfs_reader.o \
vfs_blockdev.o \
machine_mem.o \
virtpin.o \
)
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/,\
@ -288,18 +297,13 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/libm/,\
)
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/,\
machine/modmachine.o \
machine/uart.o \
machine/spi.o \
machine/i2c.o \
machine/adc.o \
machine/pin.o \
machine/timer.o \
machine/rtcounter.o \
machine/temp.o \
uos/moduos.o \
uos/microbitfs.o \
utime/modutime.o \
os/microbitfs.o \
board/modboard.o \
board/led.o \
ubluepy/modubluepy.o \

View File

@ -32,32 +32,26 @@
#include "py/mperrno.h"
#include "py/mphal.h"
#include "py/stackctrl.h"
#include "extmod/modbluetooth.h"
#include "extmod/modnetwork.h"
#include "shared/readline/readline.h"
#include "shared/runtime/gchelper.h"
#include "shared/runtime/pyexec.h"
#include "shared/runtime/softtimer.h"
#include "tusb.h"
#include "uart.h"
#include "modmachine.h"
#include "modrp2.h"
#include "genhdr/mpversion.h"
#include "pendsv.h"
#if MICROPY_PY_BLUETOOTH
#include "extmod/modbluetooth.h"
#include "mpbthciport.h"
#endif
#if MICROPY_PY_NETWORK
#include "extmod/modnetwork.h"
#endif
#include "mpnetworkport.h"
#include "genhdr/mpversion.h"
#include "pico/stdlib.h"
#include "pico/binary_info.h"
#include "pico/unique_id.h"
#include "hardware/rtc.h"
#include "hardware/irq.h"
#include "hardware/regs/intctrl.h"
#include "hardware/structs/rosc.h"
#include "pico/unique_id.h"
#include "pico/bootrom.h"
#include "omv_boardconfig.h"
@ -70,6 +64,7 @@
#if MICROPY_PY_AUDIO
#include "py_audio.h"
#endif
#include "pendsv.h"
#if MICROPY_VFS_FAT && MICROPY_HW_USB_MSC
#include "extmod/vfs.h"
@ -115,6 +110,10 @@ int main(int argc, char **argv) {
bi_decl(bi_program_feature("UART REPL"))
setup_default_uart();
mp_uart_init();
#else
#ifndef NDEBUG
stdio_init_all();
#endif
#endif
#if MICROPY_HW_ENABLE_USBDEV
@ -138,6 +137,7 @@ int main(int argc, char **argv) {
};
rtc_init();
rtc_set_datetime(&t);
mp_hal_time_ns_set_from_rtc();
// Set board unique ID from flash for USB debugging.
OMV_UNIQUE_ID_ADDR = pico_unique_id.id;
@ -157,6 +157,8 @@ soft_reset:
readline_init0();
machine_pin_init();
rp2_pio_init();
rp2_dma_init();
machine_i2s_init0();
#if MICROPY_PY_BLUETOOTH
mp_bluetooth_hci_init();
@ -276,6 +278,8 @@ soft_reset_exit:
mod_network_deinit();
#endif
rp2_pio_deinit();
rp2_dma_deinit();
machine_pwm_deinit_all();
machine_pin_deinit();
gc_sweep_all();
mp_deinit();
@ -326,40 +330,3 @@ uint32_t rosc_random_u32(void) {
}
return value;
}
const char rp2_help_text[] =
"Welcome to MicroPython!\n"
"\n"
"For online help please visit https://micropython.org/help/.\n"
"\n"
"For access to the hardware use the 'machine' module. RP2 specific commands\n"
"are in the 'rp2' module.\n"
"\n"
"Quick overview of some objects:\n"
" machine.Pin(pin) -- get a pin, eg machine.Pin(0)\n"
" machine.Pin(pin, m, [p]) -- get a pin and configure it for IO mode m, pull mode p\n"
" methods: init(..), value([v]), high(), low(), irq(handler)\n"
" machine.ADC(pin) -- make an analog object from a pin\n"
" methods: read_u16()\n"
" machine.PWM(pin) -- make a PWM object from a pin\n"
" methods: deinit(), freq([f]), duty_u16([d]), duty_ns([d])\n"
" machine.I2C(id) -- create an I2C object (id=0,1)\n"
" methods: readfrom(addr, buf, stop=True), writeto(addr, buf, stop=True)\n"
" readfrom_mem(addr, memaddr, arg), writeto_mem(addr, memaddr, arg)\n"
" machine.SPI(id, baudrate=1000000) -- create an SPI object (id=0,1)\n"
" methods: read(nbytes, write=0x00), write(buf), write_readinto(wr_buf, rd_buf)\n"
" machine.Timer(freq, callback) -- create a software timer object\n"
" eg: machine.Timer(freq=1, callback=lambda t:print(t))\n"
"\n"
"Pins are numbered 0-29, and 26-29 have ADC capabilities\n"
"Pin IO modes are: Pin.IN, Pin.OUT, Pin.ALT\n"
"Pin pull modes are: Pin.PULL_UP, Pin.PULL_DOWN\n"
"\n"
"Useful control commands:\n"
" CTRL-C -- interrupt a running program\n"
" CTRL-D -- on a blank line, do a soft reset of the board\n"
" CTRL-E -- on a blank line, enter paste mode\n"
"\n"
"For further help on a specific object, type help(obj)\n"
"For a list of available modules, type help('modules')\n"
;

View File

@ -5,3 +5,5 @@
extern void fb_alloc_free_till_mark(); \
fb_alloc_free_till_mark(); \
} while (0);
#define MICROPY_BANNER_NAME_AND_VERSION "OpenMV " OPENMV_GIT_TAG "; MicroPython " MICROPY_GIT_TAG

View File

@ -264,6 +264,7 @@ endif()
target_compile_definitions(${MICROPY_TARGET} PRIVATE
MICROPY_BOARD_PENDSV_ENTRIES=${MPY_PENDSV_ENTRIES}
MP_CONFIGFILE="${TOP_DIR}/${OMV_DIR}/ports/${PORT}/omv_mpconfigport.h"
)
add_custom_command(TARGET ${MICROPY_TARGET}

View File

@ -33,8 +33,9 @@
#include "rtc.h"
#include "storage.h"
#include "sdcard.h"
#include "extmod/modnetwork.h"
#include "modmachine.h"
#include "extmod/modnetwork.h"
#include "extmod/modmachine.h"
#include "extmod/vfs.h"
#include "extmod/vfs_fat.h"
@ -180,8 +181,8 @@ int ini_handler_callback(void *user, const char *section, const char *name, cons
MP_OBJ_NEW_SMALL_INT(115200) // Baud Rate
};
MP_STATE_PORT(pyb_stdio_uart) = MP_OBJ_TYPE_GET_SLOT(&pyb_uart_type, make_new) (
(mp_obj_t) &pyb_uart_type, MP_ARRAY_SIZE(args), 0, args);
MP_STATE_PORT(pyb_stdio_uart) = MP_OBJ_TYPE_GET_SLOT(&machine_uart_type, make_new) (
(mp_obj_t) &machine_uart_type, MP_ARRAY_SIZE(args), 0, args);
uart_attach_to_repl(MP_STATE_PORT(pyb_stdio_uart), true);
}
} else if (MATCH("BoardConfig", "WiFiDebug")) {

View File

@ -5,3 +5,6 @@
extern void fb_alloc_free_till_mark(); \
fb_alloc_free_till_mark(); \
} while (0);
#define MICROPY_PY_SOCKET_EXTENDED_STATE (1)
#define MICROPY_BANNER_NAME_AND_VERSION "OpenMV " OPENMV_GIT_TAG "; MicroPython " MICROPY_GIT_TAG

View File

@ -8,7 +8,8 @@ CFLAGS += -std=gnu99 -Wall -Werror -Warray-bounds -mthumb -nostartfiles -fdata-s
CFLAGS += -fno-inline-small-functions -D$(MCU) -D$(CFLAGS_MCU) -D$(ARM_MATH) -DARM_NN_TRUNCATE\
-fsingle-precision-constant -Wdouble-promotion -mcpu=$(CPU) -mtune=$(CPU) -mfpu=$(FPU) -mfloat-abi=hard
CFLAGS += -D__FPU_PRESENT=1 -D__VFP_FP__ -DUSE_DEVICE_MODE -DHSE_VALUE=$(OMV_HSE_VALUE)\
-D$(TARGET) -DVECT_TAB_OFFSET=$(VECT_TAB_OFFSET) -DMAIN_APP_ADDR=$(MAIN_APP_ADDR) -DSTM32_HAL_H=$(HAL_INC)
-D$(TARGET) -DVECT_TAB_OFFSET=$(VECT_TAB_OFFSET) -DMAIN_APP_ADDR=$(MAIN_APP_ADDR) -DSTM32_HAL_H=$(HAL_INC)\
-DUSE_FULL_LL_DRIVER
CFLAGS += $(OMV_BOARD_EXTRA_CFLAGS)
HAL_CFLAGS += -I$(TOP_DIR)/$(CMSIS_DIR)/include/
@ -22,14 +23,15 @@ MPY_CFLAGS += -I$(TOP_DIR)/$(MICROPY_DIR)/
MPY_CFLAGS += -I$(TOP_DIR)/$(MICROPY_DIR)/py/
MPY_CFLAGS += -I$(TOP_DIR)/$(MICROPY_DIR)/lib/oofatfs
MPY_CFLAGS += -I$(TOP_DIR)/$(MICROPY_DIR)/lib/lwip/src/include/
MPY_CFLAGS += -I$(TOP_DIR)/$(MICROPY_DIR)/lib/mbedtls/include
MPY_CFLAGS += -I$(TOP_DIR)/$(MICROPY_DIR)/ports/stm32/
MPY_CFLAGS += -I$(TOP_DIR)/$(MICROPY_DIR)/ports/stm32/usbdev/core/inc/
MPY_CFLAGS += -I$(TOP_DIR)/$(MICROPY_DIR)/ports/stm32/usbdev/class/inc/
MPY_CFLAGS += -I$(TOP_DIR)/$(MICROPY_DIR)/ports/stm32/lwip_inc/
MPY_CFLAGS += -I$(TOP_DIR)/$(MICROPY_DIR)/shared/runtime/
MPY_CFLAGS += -DMICROPY_PY_USSL=1 -DMICROPY_SSL_MBEDTLS=1 -DMICROPY_STREAMS_POSIX_API=1 -DMICROPY_VFS_FAT=1
MPY_CFLAGS += -DMICROPY_PY_SSL=1 -DMICROPY_SSL_MBEDTLS=1 -DMICROPY_STREAMS_POSIX_API=1 -DMICROPY_VFS_FAT=1
MICROPY_ARGS += MICROPY_PY_USSL=1 MICROPY_SSL_MBEDTLS=1 MICROPY_PY_BTREE=1\
MICROPY_ARGS += MICROPY_PY_SSL=1 MICROPY_SSL_MBEDTLS=1 MICROPY_PY_BTREE=1\
STM32LIB_CMSIS_DIR=$(TOP_DIR)/$(CMSIS_DIR) STM32LIB_HAL_DIR=$(TOP_DIR)/$(HAL_DIR)
OMV_CFLAGS += -I$(OMV_BOARD_CONFIG_DIR)
@ -282,7 +284,6 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
servo.o \
rng.o \
led.o \
wdt.o \
mphalport.o \
sdcard.o \
sdram.o \
@ -290,13 +291,9 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
extint.o \
modpyb.o \
modstm.o \
modutime.o \
network_lan.o \
modmachine.o \
machine_i2c.o \
machine_spi.o \
machine_uart.o \
machine_adc.o \
machine_bitstream.o \
pybthread.o \
mpthreadport.o \
@ -372,43 +369,56 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/usbdev/, \
)
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\
modujson.o \
modure.o \
moduzlib.o \
moduhashlib.o \
modubinascii.o \
modurandom.o \
moduselect.o \
modutimeq.o \
moduheapq.o \
moductypes.o \
moduos.o \
vfs.o \
vfs_fat.o \
vfs_fat_file.o \
vfs_reader.o \
vfs_fat_diskio.o \
vfs_blockdev.o \
virtpin.o \
machine_mem.o \
machine_i2c.o \
machine_spi.o \
machine_pulse.o \
machine_signal.o \
machine_pinbase.o \
machine_adc.o \
machine_adc_block.o \
machine_bitstream.o \
machine_timer.o \
utime_mphal.o \
modonewire.o \
uos_dupterm.o \
modframebuf.o \
modbtree.o \
moducryptolib.o \
modussl_mbedtls.o \
moduasyncio.o \
modusocket.o \
modnetwork.o \
moduplatform.o \
machine_i2c.o \
machine_i2s.o \
machine_mem.o \
machine_pinbase.o \
machine_pulse.o \
machine_pwm.o \
machine_signal.o \
machine_spi.o \
machine_timer.o \
machine_uart.o \
machine_wdt.o \
modasyncio.o \
modbinascii.o \
modbtree.o \
modcryptolib.o \
moddeflate.o \
modframebuf.o \
modhashlib.o \
modheapq.o \
modjson.o \
modmachine.o \
modnetwork.o \
modonewire.o \
modos.o \
modplatform.o\
modrandom.o \
modre.o \
modselect.o \
modsocket.o \
modssl_axtls.o \
modssl_mbedtls.o \
modtime.o \
moductypes.o \
network_esp_hosted.o \
network_ninaw10.o \
network_wiznet5k.o \
os_dupterm.o \
vfs.o \
vfs_blockdev.o \
vfs_fat.o \
vfs_fat_diskio.o \
vfs_fat_file.o \
vfs_lfs.o \
vfs_posix.o \
vfs_posix_file.o \
vfs_reader.o \
virtpin.o \
)
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/oofatfs/,\
@ -465,7 +475,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
lib/lwip/src/netif/*.o \
lib/lwip/src/apps/*/*.o \
extmod/modlwip.o \
extmod/moduwebsocket.o \
extmod/modwebsocket.o \
extmod/modwebrepl.o \
mpnetworkport.o \
)