mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #995 from openmv/micropython-1.13
Update to MicroPython 1.13
This commit is contained in:
commit
8a28776c36
17
src/Makefile
17
src/Makefile
@ -61,6 +61,8 @@ CUBEAI_DIR=stm32cubeai
|
||||
LIBPDM_DIR=libpdm
|
||||
OMV_BOARD_CONFIG_DIR=$(TOP_DIR)/$(OMV_DIR)/boards/$(TARGET)/
|
||||
MP_BOARD_CONFIG_DIR=$(TOP_DIR)/$(MICROPY_DIR)/ports/stm32/boards/$(TARGET)/
|
||||
MPY_LIB_DIR=$(TOP_DIR)/../scripts/libraries
|
||||
FROZEN_MANIFEST=$(OMV_BOARD_CONFIG_DIR)/manifest.py
|
||||
|
||||
# Additional qstr definitions for OpenMV
|
||||
OMV_QSTR_DEFS = $(TOP_DIR)/$(OMV_DIR)/py/qstrdefsomv.h
|
||||
@ -102,7 +104,7 @@ CFLAGS += -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_USB_FS -DUSE_DEVICE_MODE -DUSE_USB_OTG_ID=0 -DHSE_VALUE=$(OMV_HSE_VALUE)\
|
||||
-D$(TARGET) -DSTM32_HAL_H=$(HAL_INC) -DVECT_TAB_OFFSET=$(VECT_TAB_OFFSET) -DMAIN_APP_ADDR=$(MAIN_APP_ADDR)
|
||||
CFLAGS += $(OMV_BOARD_EXTRA_CFLAGS) -DOPENMV
|
||||
CFLAGS += $(OMV_BOARD_EXTRA_CFLAGS)
|
||||
|
||||
ST_CFLAGS += -I. -Iinclude
|
||||
ST_CFLAGS += -I$(TOP_DIR)/$(CMSIS_DIR)/include/
|
||||
@ -124,7 +126,7 @@ MP_CFLAGS += -I$(MP_BOARD_CONFIG_DIR)
|
||||
|
||||
# In addition to CFLAGS, the following options are needed to set varilables
|
||||
# in MicroPython's Makefile, to enable or disable compiling additional modules.
|
||||
MICROPY_ARGS = BOARD=$(TARGET) DEBUG=$(DEBUG) QSTR_DEFS="$(OMV_QSTR_DEFS)"
|
||||
MICROPY_ARGS = BOARD=$(TARGET) DEBUG=$(DEBUG) QSTR_DEFS="$(OMV_QSTR_DEFS)" MPY_LIB_DIR=$(MPY_LIB_DIR)
|
||||
ifeq ($(MICROPY_PY_WINC1500), 1)
|
||||
MP_CFLAGS += -DMICROPY_PY_WINC1500=1
|
||||
MICROPY_ARGS += MICROPY_PY_WINC1500=1
|
||||
@ -397,16 +399,12 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
|
||||
posix_helpers.o \
|
||||
softtimer.o \
|
||||
mbedtls/mbedtls_port.o \
|
||||
frozen_content.o \
|
||||
)
|
||||
|
||||
# board object files
|
||||
FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/boards/$(TARGET)/*.o)
|
||||
|
||||
# object file for frozen bytecode (frozen .mpy files)
|
||||
ifneq ($(FROZEN_MPY_DIR),)
|
||||
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,frozen_mpy.o)
|
||||
endif
|
||||
|
||||
#------------- MicroPy Objects ----------------#
|
||||
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/,\
|
||||
utils/mpirq.o \
|
||||
@ -415,6 +413,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/,\
|
||||
utils/interrupt_char.o \
|
||||
utils/sys_stdio_mphal.o \
|
||||
utils/gchelper_m3.o \
|
||||
utils/gchelper_native.o \
|
||||
libc/string0.o \
|
||||
netutils/*.o \
|
||||
timeutils/timeutils.o \
|
||||
@ -459,6 +458,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/mp-readline/,\
|
||||
|
||||
#------------- mbedtls -------------------#
|
||||
FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/lib/mbedtls/library/*.o)
|
||||
FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/lib/mbedtls_errors/*.o)
|
||||
|
||||
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/usbdev/, \
|
||||
core/src/usbd_core.o \
|
||||
@ -500,6 +500,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\
|
||||
modbtree.o \
|
||||
moducryptolib.o \
|
||||
modussl_mbedtls.o \
|
||||
moduasyncio.o \
|
||||
)
|
||||
|
||||
ifeq ($(MICROPY_PY_ULAB), 1)
|
||||
@ -630,7 +631,7 @@ export TOP_DIR
|
||||
export BUILD
|
||||
export TARGET
|
||||
export STARTUP
|
||||
export FROZEN_MPY_DIR
|
||||
export FROZEN_MANIFEST
|
||||
###################################################
|
||||
all: $(OPENMV)
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit aa839707bd67ed3a445466b79c13071c5b1dcdbd
|
||||
Subproject commit 1ab09a8d8d66d6016ed9e1da1f8c40ca2f0cf9ad
|
||||
0
src/omv/boards/OPENMV1/manifest.py
Normal file
0
src/omv/boards/OPENMV1/manifest.py
Normal file
0
src/omv/boards/OPENMV2/manifest.py
Normal file
0
src/omv/boards/OPENMV2/manifest.py
Normal file
11
src/omv/boards/OPENMV3/manifest.py
Normal file
11
src/omv/boards/OPENMV3/manifest.py
Normal file
@ -0,0 +1,11 @@
|
||||
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "bno055.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "modbus.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "mqtt.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "mutex.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "pid.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "rpc.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "rtsp.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "ssd1306.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "tb6612.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "vl53l1x.py")
|
||||
@ -10,6 +10,5 @@ VECT_TAB_OFFSET=0x20000
|
||||
MAIN_APP_ADDR=0x08020000
|
||||
OMV_HSE_VALUE=12000000
|
||||
DFU_DEVICE=0x0483:0xdf11
|
||||
FROZEN_MPY_DIR=$(TOP_DIR)/../scripts/libraries
|
||||
MICROPY_PY_ULAB = 1
|
||||
MICROPY_PY_WINC1500 = 1
|
||||
|
||||
11
src/omv/boards/OPENMV4/manifest.py
Normal file
11
src/omv/boards/OPENMV4/manifest.py
Normal file
@ -0,0 +1,11 @@
|
||||
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "bno055.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "modbus.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "mqtt.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "mutex.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "pid.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "rpc.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "rtsp.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "ssd1306.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "tb6612.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "vl53l1x.py")
|
||||
@ -10,7 +10,6 @@ VECT_TAB_OFFSET=0x40000
|
||||
MAIN_APP_ADDR=0x08040000
|
||||
OMV_HSE_VALUE=12000000
|
||||
DFU_DEVICE=0x0483:0xdf11
|
||||
FROZEN_MPY_DIR=$(TOP_DIR)/../scripts/libraries
|
||||
MICROPY_PY_ULAB = 1
|
||||
MICROPY_PY_WINC1500 = 1
|
||||
MICROPY_PY_IMU = 1
|
||||
|
||||
11
src/omv/boards/OPENMV4P/manifest.py
Normal file
11
src/omv/boards/OPENMV4P/manifest.py
Normal file
@ -0,0 +1,11 @@
|
||||
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "bno055.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "modbus.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "mqtt.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "mutex.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "pid.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "rpc.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "rtsp.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "ssd1306.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "tb6612.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "vl53l1x.py")
|
||||
@ -10,6 +10,5 @@ VECT_TAB_OFFSET=0x40000
|
||||
MAIN_APP_ADDR=0x08040000
|
||||
OMV_HSE_VALUE=12000000
|
||||
DFU_DEVICE=0x0483:0xdf11
|
||||
FROZEN_MPY_DIR=$(TOP_DIR)/../scripts/libraries
|
||||
MICROPY_PY_ULAB = 1
|
||||
MICROPY_PY_WINC1500 = 1
|
||||
|
||||
11
src/omv/boards/OPENMVPURETHERMAL/manifest.py
Normal file
11
src/omv/boards/OPENMVPURETHERMAL/manifest.py
Normal file
@ -0,0 +1,11 @@
|
||||
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "bno055.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "modbus.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "mqtt.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "mutex.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "pid.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "rpc.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "rtsp.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "ssd1306.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "tb6612.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "vl53l1x.py")
|
||||
@ -10,6 +10,5 @@ VECT_TAB_OFFSET=0x40000
|
||||
MAIN_APP_ADDR=0x08040000
|
||||
OMV_HSE_VALUE=12000000
|
||||
DFU_DEVICE=0x0483:0xdf11
|
||||
FROZEN_MPY_DIR=$(TOP_DIR)/../scripts/libraries
|
||||
MICROPY_PY_ULAB = 1
|
||||
MICROPY_PY_WINC1500 = 1
|
||||
|
||||
11
src/omv/boards/PORTENTA/manifest.py
Normal file
11
src/omv/boards/PORTENTA/manifest.py
Normal file
@ -0,0 +1,11 @@
|
||||
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "bno055.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "modbus.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "mqtt.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "mutex.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "pid.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "rpc.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "rtsp.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "ssd1306.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "tb6612.py")
|
||||
freeze ("$(MPY_LIB_DIR)/", "vl53l1x.py")
|
||||
@ -10,7 +10,6 @@ VECT_TAB_OFFSET=0x40000
|
||||
MAIN_APP_ADDR=0x08040000
|
||||
OMV_HSE_VALUE=25000000
|
||||
DFU_DEVICE=0x2341:0x035b
|
||||
FROZEN_MPY_DIR=$(TOP_DIR)/../scripts/libraries
|
||||
OMV_BOARD_EXTRA_CFLAGS = -DCORE_CM7
|
||||
MICROPY_PY_ULAB = 1
|
||||
MICROPY_PY_WINC1500 = 0
|
||||
|
||||
@ -142,60 +142,6 @@ bool ini_is_true(const char *value)
|
||||
return true;
|
||||
}
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Chris Torek.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copy src to dst, truncating or null-padding to always copy n bytes.
|
||||
* Return dst.
|
||||
*/
|
||||
char *
|
||||
strncpy(char *dst, const char *src, size_t n)
|
||||
{
|
||||
if (n != 0) {
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
do {
|
||||
if ((*d++ = *s++) == 0) {
|
||||
/* NUL pad the remaining n-1 bytes */
|
||||
while (--n != 0)
|
||||
*d++ = 0;
|
||||
break;
|
||||
}
|
||||
} while (--n != 0);
|
||||
}
|
||||
return (dst);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se)
|
||||
*
|
||||
|
||||
@ -7302,7 +7302,7 @@ mp_obj_t py_image_save_descriptor(uint n_args, const mp_obj_t *args, mp_map_t *k
|
||||
|
||||
if ((res = f_open_helper(&fp, path, FA_WRITE|FA_CREATE_ALWAYS)) == FR_OK) {
|
||||
// Find descriptor type
|
||||
mp_obj_type_t *desc_obj_type = mp_obj_get_type(args[0]);
|
||||
const mp_obj_type_t *desc_obj_type = mp_obj_get_type(args[0]);
|
||||
if (desc_obj_type == &py_lbp_type) {
|
||||
desc_type = DESC_LBP;
|
||||
} else if (desc_obj_type == &py_kp_type) {
|
||||
@ -7345,8 +7345,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_save_descriptor_obj, 2, py_image_save
|
||||
static mp_obj_t py_image_match_descriptor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
|
||||
{
|
||||
mp_obj_t match_obj = mp_const_none;
|
||||
mp_obj_type_t *desc1_type = mp_obj_get_type(args[0]);
|
||||
mp_obj_type_t *desc2_type = mp_obj_get_type(args[1]);
|
||||
const mp_obj_type_t *desc1_type = mp_obj_get_type(args[0]);
|
||||
const mp_obj_type_t *desc2_type = mp_obj_get_type(args[1]);
|
||||
PY_ASSERT_TRUE_MSG((desc1_type == desc2_type), "Descriptors have different types!");
|
||||
|
||||
if (desc1_type == &py_lbp_type) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user