mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
micropython: Update micropython to 1.20.0.
This commit is contained in:
parent
2930561667
commit
b2ef6e7b9f
@ -1 +1 @@
|
||||
Subproject commit 89c79bb642e0707337481e61bc44b91efd968db4
|
||||
Subproject commit befa2defb4ee0577f438c1a042f382a630646526
|
||||
@ -88,12 +88,6 @@ extern unsigned char *OMV_UNIQUE_ID_ADDR; // Unique address.
|
||||
#define OMV_USB_IRQN (USBCTRL_IRQ_IRQn)
|
||||
#define OMV_USB1_IRQ_HANDLER (USBD_IRQHandler)
|
||||
|
||||
// Jump to bootloader function.
|
||||
#ifndef LINKER_SCRIPT
|
||||
void pico_reset_to_bootloader(void);
|
||||
#endif
|
||||
#define MICROPY_RESET_TO_BOOTLOADER pico_reset_to_bootloader
|
||||
|
||||
// Linker script constants (see the linker script template port/x.ld.S).
|
||||
#define OMV_FB_MEMORY RAM // Framebuffer, fb_alloc
|
||||
#define OMV_MAIN_MEMORY RAM // data, bss and heap memory
|
||||
@ -102,7 +96,7 @@ void pico_reset_to_bootloader(void);
|
||||
#define OMV_FB_SIZE (100K) // FB memory
|
||||
#define OMV_FB_ALLOC_SIZE (16K) // minimum fb alloc size
|
||||
#define OMV_STACK_SIZE (16K)
|
||||
#define OMV_HEAP_SIZE (64 * 1024) // MicroPython's heap
|
||||
#define OMV_HEAP_SIZE (60 * 1024) // MicroPython's heap
|
||||
#define OMV_JPEG_BUF_SIZE (20 * 1024) // IDE JPEG buffer (header + data).
|
||||
|
||||
// GP LED
|
||||
|
||||
@ -147,7 +147,7 @@
|
||||
#define OMV_FB_SIZE (400K) // FB memory: header + VGA/GS image
|
||||
#define OMV_FB_ALLOC_SIZE (100K) // minimum fb alloc size
|
||||
#define OMV_STACK_SIZE (64K)
|
||||
#define OMV_HEAP_SIZE (183K)
|
||||
#define OMV_HEAP_SIZE (182K)
|
||||
|
||||
#define OMV_LINE_BUF_SIZE (3 * 1024) // Image line buffer round(640 * 2BPP * 2 buffers).
|
||||
#define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data
|
||||
|
||||
@ -85,12 +85,6 @@ extern unsigned char *OMV_UNIQUE_ID_ADDR; // Unique ID address.
|
||||
#define OMV_USB_IRQN (USBCTRL_IRQ_IRQn)
|
||||
#define OMV_USB1_IRQ_HANDLER (USBD_IRQHandler)
|
||||
|
||||
// Jump to bootloader function.
|
||||
#ifndef LINKER_SCRIPT
|
||||
void pico_reset_to_bootloader(void);
|
||||
#endif
|
||||
#define MICROPY_RESET_TO_BOOTLOADER pico_reset_to_bootloader
|
||||
|
||||
// Linker script constants (see the linker script template port/x.ld.S).
|
||||
#define OMV_FB_MEMORY RAM // Framebuffer, fb_alloc
|
||||
#define OMV_MAIN_MEMORY RAM // data, bss and heap memory
|
||||
|
||||
@ -56,9 +56,9 @@ void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const *coding)
|
||||
debug_ringbuf.iput = 0;
|
||||
|
||||
if (0) {
|
||||
#if defined(MICROPY_RESET_TO_BOOTLOADER)
|
||||
#if defined(MICROPY_BOARD_ENTER_BOOTLOADER)
|
||||
} else if (coding->bit_rate == 1200) {
|
||||
MICROPY_RESET_TO_BOOTLOADER();
|
||||
MICROPY_BOARD_ENTER_BOOTLOADER(0, 0);
|
||||
#endif
|
||||
} else if (coding->bit_rate == DEBUG_BAUDRATE_SLOW
|
||||
|| coding->bit_rate == DEBUG_BAUDRATE_FAST) {
|
||||
|
||||
@ -430,8 +430,8 @@ void usbdbg_control(void *buffer, uint8_t request, uint32_t length)
|
||||
break;
|
||||
|
||||
case USBDBG_SYS_RESET_TO_BL:{
|
||||
#if defined(MICROPY_RESET_TO_BOOTLOADER)
|
||||
MICROPY_RESET_TO_BOOTLOADER();
|
||||
#if defined(MICROPY_BOARD_ENTER_BOOTLOADER)
|
||||
MICROPY_BOARD_ENTER_BOOTLOADER(0, 0);
|
||||
#else
|
||||
NVIC_SystemReset();
|
||||
#endif
|
||||
|
||||
@ -340,6 +340,9 @@ soft_reset:
|
||||
}
|
||||
|
||||
printf("MPY: soft reboot\n");
|
||||
#if MICROPY_PY_MACHINE_HW_PWM
|
||||
pwm_deinit_all();
|
||||
#endif
|
||||
#if MICROPY_PY_AUDIO
|
||||
py_audio_deinit();
|
||||
#endif
|
||||
|
||||
@ -223,6 +223,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\
|
||||
modurandom.o \
|
||||
modutimeq.o \
|
||||
machine_i2c.o \
|
||||
machine_pwm.o \
|
||||
utime_mphal.o \
|
||||
vfs.o \
|
||||
vfs_fat.o \
|
||||
@ -294,7 +295,6 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/,\
|
||||
machine/pin.o \
|
||||
machine/timer.o \
|
||||
machine/rtcounter.o \
|
||||
machine/pwm.o \
|
||||
machine/temp.o \
|
||||
uos/moduos.o \
|
||||
uos/microbitfs.o \
|
||||
|
||||
@ -105,7 +105,7 @@ void __fatal_error()
|
||||
}
|
||||
}
|
||||
|
||||
void pico_reset_to_bootloader(void)
|
||||
void pico_reset_to_bootloader(size_t n_args, const void *args_in)
|
||||
{
|
||||
reset_usb_boot(0, 0);
|
||||
}
|
||||
@ -175,8 +175,8 @@ int main(int argc, char **argv) {
|
||||
|
||||
// Install Tinyusb CDC debugger IRQ handler.
|
||||
irq_set_enabled(USBCTRL_IRQ, false);
|
||||
irq_remove_handler(USBCTRL_IRQ, irq_get_exclusive_handler(USBCTRL_IRQ));
|
||||
irq_set_exclusive_handler(USBCTRL_IRQ, USBD_IRQHandler);
|
||||
irq_remove_handler(USBCTRL_IRQ, irq_get_vtable_handler(USBCTRL_IRQ));
|
||||
irq_set_exclusive_handler(USBCTRL_IRQ, OMV_USB1_IRQ_HANDLER);
|
||||
irq_set_enabled(USBCTRL_IRQ, true);
|
||||
|
||||
soft_reset:
|
||||
@ -218,10 +218,10 @@ soft_reset:
|
||||
#if MICROPY_VFS_FAT && MICROPY_HW_USB_MSC
|
||||
// Mount or create a fresh filesystem.
|
||||
mp_obj_t mount_point = MP_OBJ_NEW_QSTR(MP_QSTR__slash_);
|
||||
mp_obj_t bdev = rp2_flash_type.make_new(&rp2_flash_type, 0, 0, NULL);
|
||||
mp_obj_t bdev = MP_OBJ_TYPE_GET_SLOT(&rp2_flash_type, make_new)(&rp2_flash_type, 0, 0, NULL);
|
||||
if (mp_vfs_mount_and_chdir_protected(bdev, mount_point) == -MP_ENODEV) {
|
||||
// Create a fresh filesystem.
|
||||
fs_user_mount_t *vfs = mp_fat_vfs_type.make_new(&mp_fat_vfs_type, 1, 0, &bdev);
|
||||
fs_user_mount_t *vfs = MP_OBJ_TYPE_GET_SLOT(&mp_fat_vfs_type, make_new)(&mp_fat_vfs_type, 1, 0, &bdev);
|
||||
if (factoryreset_create_filesystem(vfs) == 0) {
|
||||
mp_vfs_mount_and_chdir_protected(bdev, mount_point);
|
||||
}
|
||||
|
||||
@ -26,7 +26,9 @@
|
||||
#include "hardware/clocks.h"
|
||||
#include "OpenPDMFilter.h"
|
||||
|
||||
#ifndef NO_QSTR
|
||||
#include "pdm.pio.h"
|
||||
#endif
|
||||
#include "py_audio.h"
|
||||
|
||||
#define PDM_DEFAULT_GAIN (8)
|
||||
@ -59,6 +61,8 @@ typedef struct _audio_data_t {
|
||||
void (*pdm_filter_func) (uint8_t*, int16_t*, uint16_t, TPDMFilter_InitStruct*);
|
||||
} audio_data_t;
|
||||
|
||||
MP_REGISTER_ROOT_POINTER(struct _audio_data_t *audio_data);
|
||||
|
||||
#define audio_data MP_STATE_PORT(audio_data)
|
||||
#define NEXT_BUFFER(x) (((x) + 1) % (audio_data->n_buffers))
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ set(CM4_DIR cm4)
|
||||
set(BOOTLDR_DIR bootloader)
|
||||
set(CUBEAI_DIR stm32cubeai)
|
||||
set(CMSIS_DIR hal/cmsis)
|
||||
#set(MICROPY_DIR micropython)
|
||||
set(LEPTON_DIR drivers/lepton)
|
||||
set(LSM6DS3_DIR drivers/lsm6ds3)
|
||||
set(WINC1500_DIR drivers/winc1500)
|
||||
@ -20,8 +19,7 @@ set(MLX90641_DIR drivers/mlx90641)
|
||||
set(OPENPDM_DIR ${TOP_DIR}/lib/openpdm)
|
||||
set(TENSORFLOW_DIR ${TOP_DIR}/lib/libtf)
|
||||
set(OMV_BOARD_CONFIG_DIR ${TOP_DIR}/${OMV_DIR}/boards/${TARGET}/)
|
||||
#set(MP_BOARD_CONFIG_DIR ${TOP_DIR}/${MICROPY_DIR}/ports/${PORT}/boards/${TARGET}/
|
||||
set(MPY_LIB_DIR ${TOP_DIR}/../scripts/libraries)
|
||||
set(OMV_LIB_DIR ${TOP_DIR}/../scripts/libraries)
|
||||
set(OMV_COMMON_DIR ${TOP_DIR}/${OMV_DIR}/common)
|
||||
set(PORT_DIR ${TOP_DIR}/${OMV_DIR}/ports/${PORT})
|
||||
|
||||
|
||||
@ -184,7 +184,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) = 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(&pyb_uart_type, make_new)(
|
||||
(mp_obj_t) &pyb_uart_type, MP_ARRAY_SIZE(args), 0, args);
|
||||
uart_attach_to_repl(MP_STATE_PORT(pyb_stdio_uart), true);
|
||||
}
|
||||
} else if (MATCH("BoardConfig", "WiFiDebug")) {
|
||||
|
||||
@ -1142,7 +1142,8 @@ mp_obj_t ltdc_dvi_user_cb = NULL;
|
||||
|
||||
static mp_obj_t ltdc_dvi_get_display_connected()
|
||||
{
|
||||
mp_obj_base_t *bus = ltdc_dvi_bus ? ltdc_dvi_bus : ((mp_obj_base_t *) mp_machine_soft_i2c_type.make_new(&mp_machine_soft_i2c_type, 2, 0, (const mp_obj_t []) {
|
||||
mp_obj_base_t *bus = ltdc_dvi_bus ? ltdc_dvi_bus : ((mp_obj_base_t *) MP_OBJ_TYPE_GET_SLOT(
|
||||
&mp_machine_soft_i2c_type, make_new)(&mp_machine_soft_i2c_type, 2, 0, (const mp_obj_t []) {
|
||||
(mp_obj_t) OMV_DVI_SCL_PIN, (mp_obj_t) OMV_DVI_SDA_PIN
|
||||
}));
|
||||
|
||||
@ -1183,7 +1184,9 @@ static bool ltdc_dvi_checksum(uint8_t *data, int long_count)
|
||||
|
||||
static mp_obj_t ltdc_dvi_get_display_id_data()
|
||||
{
|
||||
mp_obj_base_t *bus = ltdc_ddc_bus ? ltdc_ddc_bus : ((mp_obj_base_t *) mp_machine_soft_i2c_type.make_new(&mp_machine_soft_i2c_type, 2, 1, (const mp_obj_t []) {
|
||||
mp_obj_base_t *bus = ltdc_ddc_bus ? ltdc_ddc_bus :
|
||||
((mp_obj_base_t *) MP_OBJ_TYPE_GET_SLOT(
|
||||
&mp_machine_soft_i2c_type, make_new)(&mp_machine_soft_i2c_type, 2, 1, (const mp_obj_t []) {
|
||||
(mp_obj_t) OMV_DDC_SCL_PIN, (mp_obj_t) OMV_DDC_SDA_PIN,
|
||||
MP_OBJ_NEW_QSTR(MP_QSTR_freq),
|
||||
MP_OBJ_NEW_SMALL_INT(100000)
|
||||
@ -1268,12 +1271,14 @@ static void ltdc_dvi_init()
|
||||
HAL_GPIO_WritePin(OMV_DVI_RESET_PIN->gpio, OMV_DVI_RESET_PIN->pin_mask, GPIO_PIN_SET);
|
||||
HAL_Delay(1);
|
||||
|
||||
ltdc_dvi_bus = (mp_obj_base_t *) mp_machine_soft_i2c_type.make_new(&mp_machine_soft_i2c_type, 2, 0, (const mp_obj_t []) {
|
||||
ltdc_dvi_bus = (mp_obj_base_t *) MP_OBJ_TYPE_GET_SLOT(
|
||||
&mp_machine_soft_i2c_type, make_new)(&mp_machine_soft_i2c_type, 2, 0, (const mp_obj_t []) {
|
||||
(mp_obj_t) OMV_DVI_SCL_PIN, (mp_obj_t) OMV_DVI_SDA_PIN
|
||||
});
|
||||
|
||||
#ifdef OMV_DDC_PRESENT
|
||||
ltdc_ddc_bus = (mp_obj_base_t *) mp_machine_soft_i2c_type.make_new(&mp_machine_soft_i2c_type, 2, 1, (const mp_obj_t []) {
|
||||
ltdc_ddc_bus = (mp_obj_base_t *) MP_OBJ_TYPE_GET_SLOT(
|
||||
&mp_machine_soft_i2c_type, make_new)(&mp_machine_soft_i2c_type, 2, 1, (const mp_obj_t []) {
|
||||
(mp_obj_t) OMV_DDC_SCL_PIN, (mp_obj_t) OMV_DDC_SDA_PIN,
|
||||
MP_OBJ_NEW_QSTR(MP_QSTR_freq),
|
||||
MP_OBJ_NEW_SMALL_INT(100000)
|
||||
|
||||
@ -82,7 +82,8 @@ mp_obj_t lcd_touch_get_point_y_position(mp_obj_t index)
|
||||
|
||||
mp_obj_t lcd_touch_update_touch_points()
|
||||
{
|
||||
mp_obj_base_t *bus = lcd_touch_bus ? lcd_touch_bus : ((mp_obj_base_t *) mp_machine_soft_i2c_type.make_new(&mp_machine_soft_i2c_type, 2, 0, (const mp_obj_t []) {
|
||||
mp_obj_base_t *bus = lcd_touch_bus ? lcd_touch_bus : ((mp_obj_base_t *) MP_OBJ_TYPE_GET_SLOT(
|
||||
&mp_machine_soft_i2c_type, make_new)(&mp_machine_soft_i2c_type, 2, 0, (const mp_obj_t []) {
|
||||
(mp_obj_t) OMV_TOUCH_SCL_PIN, (mp_obj_t) OMV_TOUCH_SDA_PIN
|
||||
}));
|
||||
|
||||
@ -177,7 +178,8 @@ void lcd_touch_init()
|
||||
HAL_GPIO_WritePin(OMV_TOUCH_RESET_PIN->gpio, OMV_TOUCH_RESET_PIN->pin_mask, GPIO_PIN_SET);
|
||||
HAL_Delay(39);
|
||||
|
||||
lcd_touch_bus = (mp_obj_base_t *) mp_machine_soft_i2c_type.make_new(&mp_machine_soft_i2c_type, 2, 0, (const mp_obj_t []) {
|
||||
lcd_touch_bus = (mp_obj_base_t *) MP_OBJ_TYPE_GET_SLOT(
|
||||
&mp_machine_soft_i2c_type, make_new)(&mp_machine_soft_i2c_type, 2, 0, (const mp_obj_t []) {
|
||||
(mp_obj_t) OMV_TOUCH_SCL_PIN, (mp_obj_t) OMV_TOUCH_SDA_PIN
|
||||
});
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ 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
|
||||
MICROPY_ARGS += MICROPY_PY_USSL=1 MICROPY_SSL_MBEDTLS=1 MICROPY_PY_BTREE=1\
|
||||
STM32LIB_CMSIS_DIR=$(TOP_DIR)/$(CMSIS_DIR) STM32LIB_HAL_DIR=$(TOP_DIR)/$(HAL_DIR)
|
||||
@ -291,12 +292,10 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
|
||||
machine_spi.o \
|
||||
machine_uart.o \
|
||||
machine_adc.o \
|
||||
machine_timer.o \
|
||||
machine_bitstream.o \
|
||||
pybthread.o \
|
||||
mpthreadport.o \
|
||||
posix_helpers.o \
|
||||
softtimer.o \
|
||||
mbedtls/mbedtls_port.o \
|
||||
frozen_content.o \
|
||||
)
|
||||
@ -310,9 +309,10 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/shared/,\
|
||||
runtime/pyexec.o \
|
||||
runtime/interrupt_char.o \
|
||||
runtime/sys_stdio_mphal.o \
|
||||
runtime/gchelper_m3.o \
|
||||
runtime/gchelper_thumb2.o \
|
||||
runtime/gchelper_native.o \
|
||||
runtime/stdout_helpers.o \
|
||||
runtime/softtimer.o \
|
||||
netutils/*.o \
|
||||
timeutils/timeutils.o \
|
||||
readline/readline.o \
|
||||
@ -392,6 +392,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\
|
||||
machine_signal.o \
|
||||
machine_pinbase.o \
|
||||
machine_bitstream.o \
|
||||
machine_timer.o \
|
||||
utime_mphal.o \
|
||||
modonewire.o \
|
||||
uos_dupterm.o \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user