mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #1582 from openmv/micropython-1.18
micropython: Update to 1.18.
This commit is contained in:
commit
388021d83e
@ -1 +1 @@
|
||||
Subproject commit 188f051dea799e1cdd5e369b013b01ddb4fec25e
|
||||
Subproject commit ca3d3e9474f89f9d20822261b21ece2b29891560
|
||||
@ -48,7 +48,7 @@
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_NETWORK
|
||||
#include "modnetwork.h"
|
||||
#include "extmod/modnetwork.h"
|
||||
#endif
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
@ -157,7 +157,7 @@ int main(int argc, char **argv) {
|
||||
.year = 2021,
|
||||
.month = 1,
|
||||
.day = 1,
|
||||
.dotw = 5, // 0 is Sunday, so 5 is Friday
|
||||
.dotw = 4, // 0 is Monday, so 4 is Friday
|
||||
.hour = 0,
|
||||
.min = 0,
|
||||
.sec = 0,
|
||||
@ -177,10 +177,7 @@ soft_reset:
|
||||
|
||||
// Initialise MicroPython runtime.
|
||||
mp_init();
|
||||
mp_obj_list_init(MP_OBJ_TO_PTR(mp_sys_path), 0);
|
||||
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_));
|
||||
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib));
|
||||
mp_obj_list_init(MP_OBJ_TO_PTR(mp_sys_argv), 0);
|
||||
|
||||
// Initialise sub-systems.
|
||||
mp_hal_init();
|
||||
|
||||
@ -23,7 +23,6 @@ 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(FROZEN_MANIFEST ${OMV_BOARD_CONFIG_DIR}/manifest.py)
|
||||
set(OMV_COMMON_DIR ${TOP_DIR}/${OMV_DIR}/common)
|
||||
set(PORT_DIR ${TOP_DIR}/${OMV_DIR}/ports/${PORT})
|
||||
|
||||
@ -59,9 +58,6 @@ file(GLOB OMV_SRC_QSTR1 ${TOP_DIR}/${OMV_DIR}/modules/*.c)
|
||||
file(GLOB OMV_SRC_QSTR2 ${TOP_DIR}/${OMV_DIR}/ports/${PORT}/modules/*.c)
|
||||
list(APPEND MICROPY_SOURCE_QSTR ${OMV_SRC_QSTR1} ${OMV_SRC_QSTR2})
|
||||
|
||||
# Override manifest file
|
||||
set(MICROPY_FROZEN_MANIFEST ${FROZEN_MANIFEST})
|
||||
|
||||
target_include_directories(${MICROPY_TARGET} PRIVATE
|
||||
${TOP_DIR}/${CMSIS_DIR}/include/
|
||||
${TOP_DIR}/${CMSIS_DIR}/include/rpi/
|
||||
@ -264,27 +260,6 @@ if(MICROPY_PY_ULAB)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MICROPY_PY_NINAW10)
|
||||
target_include_directories(${MICROPY_TARGET} PRIVATE
|
||||
${TOP_DIR}/${NINAW10_DIR}/include/
|
||||
)
|
||||
|
||||
set(NINA_SOURCES
|
||||
${TOP_DIR}/${NINAW10_DIR}/src/nina.c
|
||||
${TOP_DIR}/${OMV_DIR}/ports/${PORT}/nina_bsp.c
|
||||
${TOP_DIR}/${OMV_DIR}/ports/${PORT}/modules/py_nina.c
|
||||
)
|
||||
|
||||
target_sources(${MICROPY_TARGET} PRIVATE ${NINA_SOURCES})
|
||||
|
||||
target_compile_definitions(${MICROPY_TARGET} PRIVATE
|
||||
NINA_DEBUG=0
|
||||
MICROPY_PY_USOCKET=1
|
||||
MICROPY_PY_NETWORK=1
|
||||
MICROPY_PY_NINAW10=1
|
||||
)
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET ${MICROPY_TARGET}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${BIN_DIR}
|
||||
|
||||
@ -15,7 +15,9 @@ export CC=
|
||||
export CXX=
|
||||
|
||||
# Note this overrides USER_C_MODULES.
|
||||
MICROPY_ARGS += BOARD=$(TARGET) BUILD=$(BUILD)/rp2 OMV_CMAKE=$(TOP_DIR)/$(OMV_DIR)/ports/$(PORT)/omv_portconfig.cmake USER_C_MODULES=""
|
||||
MICROPY_ARGS += BOARD=$(TARGET) FROZEN_MANIFEST=$(FROZEN_MANIFEST)\
|
||||
BUILD=$(BUILD)/rp2 USER_C_MODULES="" \
|
||||
OMV_CMAKE=$(TOP_DIR)/$(OMV_DIR)/ports/$(PORT)/omv_portconfig.cmake
|
||||
|
||||
###################################################
|
||||
all: $(OPENMV)
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#include "storage.h"
|
||||
#include "sdcard.h"
|
||||
#include "ff.h"
|
||||
#include "modnetwork.h"
|
||||
#include "extmod/modnetwork.h"
|
||||
#include "modmachine.h"
|
||||
|
||||
#include "extmod/vfs.h"
|
||||
@ -359,8 +359,6 @@ soft_reset:
|
||||
|
||||
// Micro Python init
|
||||
mp_init();
|
||||
mp_obj_list_init(mp_sys_path, 0);
|
||||
mp_obj_list_init(mp_sys_argv, 0);
|
||||
|
||||
// Initialise low-level sub-systems. Here we need to do the very basic
|
||||
// things like zeroing out memory and resetting any of the sub-systems.
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include "py/stream.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared/netutils/netutils.h"
|
||||
#include "modnetwork.h"
|
||||
#include "extmod/modnetwork.h"
|
||||
#include "pin.h"
|
||||
#include "genhdr/pins.h"
|
||||
#include "spi.h"
|
||||
@ -358,12 +358,12 @@ static int py_winc_socket_socket(mod_network_socket_obj_t *socket, int *_errno)
|
||||
{
|
||||
uint8_t type;
|
||||
|
||||
if (socket->u_param.domain != MOD_NETWORK_AF_INET) {
|
||||
if (socket->domain != MOD_NETWORK_AF_INET) {
|
||||
*_errno = MP_EAFNOSUPPORT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (socket->u_param.type) {
|
||||
switch (socket->type) {
|
||||
case MOD_NETWORK_SOCK_STREAM:
|
||||
type = SOCK_STREAM;
|
||||
break;
|
||||
@ -385,23 +385,26 @@ static int py_winc_socket_socket(mod_network_socket_obj_t *socket, int *_errno)
|
||||
}
|
||||
|
||||
// store state of this socket
|
||||
socket->fd = fd;
|
||||
socket->fileno = fd;
|
||||
socket->timeout = 0; // blocking
|
||||
socket->state = m_new0(winc_socket_buf_t, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void py_winc_socket_close(mod_network_socket_obj_t *socket)
|
||||
{
|
||||
if (socket->fd >= 0) {
|
||||
winc_socket_close(socket->fd);
|
||||
socket->fd = -1; // Mark socket FD as invalid
|
||||
if (socket->fileno >= 0) {
|
||||
winc_socket_close(socket->fileno);
|
||||
socket->fileno = -1; // Mark socket FD as invalid
|
||||
m_del(winc_socket_buf_t, socket->state, 1);
|
||||
socket->state = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int py_winc_socket_bind(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno)
|
||||
{
|
||||
MAKE_SOCKADDR(addr, ip, port)
|
||||
int ret = winc_socket_bind(socket->fd, &addr);
|
||||
int ret = winc_socket_bind(socket->fileno, &addr);
|
||||
if (ret < 0) {
|
||||
*_errno = ret;
|
||||
py_winc_socket_close(socket);
|
||||
@ -412,7 +415,7 @@ static int py_winc_socket_bind(mod_network_socket_obj_t *socket, byte *ip, mp_ui
|
||||
|
||||
static int py_winc_socket_listen(mod_network_socket_obj_t *socket, mp_int_t backlog, int *_errno)
|
||||
{
|
||||
int ret = winc_socket_listen(socket->fd, backlog);
|
||||
int ret = winc_socket_listen(socket->fileno, backlog);
|
||||
if (ret < 0) {
|
||||
*_errno = ret;
|
||||
py_winc_socket_close(socket);
|
||||
@ -428,7 +431,7 @@ static int py_winc_socket_accept(mod_network_socket_obj_t *socket,
|
||||
sockaddr addr;
|
||||
|
||||
// Call accept.
|
||||
int ret = winc_socket_accept(socket->fd, &addr, &fd, socket->timeout);
|
||||
int ret = winc_socket_accept(socket->fileno, &addr, &fd, socket->timeout);
|
||||
if (ret < 0) {
|
||||
*_errno = ret;
|
||||
py_winc_socket_close(socket);
|
||||
@ -436,8 +439,9 @@ static int py_winc_socket_accept(mod_network_socket_obj_t *socket,
|
||||
}
|
||||
|
||||
// Set default socket timeout.
|
||||
socket2->fd = fd;
|
||||
socket2->fileno = fd;
|
||||
socket2->timeout = 0;
|
||||
socket2->state = m_new0(winc_socket_buf_t, 1);
|
||||
UNPACK_SOCKADDR((&addr), ip, *port);
|
||||
|
||||
return 0;
|
||||
@ -446,7 +450,7 @@ static int py_winc_socket_accept(mod_network_socket_obj_t *socket,
|
||||
static int py_winc_socket_connect(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno)
|
||||
{
|
||||
MAKE_SOCKADDR(addr, ip, port)
|
||||
int ret = winc_socket_connect(socket->fd, &addr, socket->timeout);
|
||||
int ret = winc_socket_connect(socket->fileno, &addr, socket->timeout);
|
||||
if (ret < 0) {
|
||||
*_errno = ret;
|
||||
py_winc_socket_close(socket);
|
||||
@ -457,7 +461,7 @@ static int py_winc_socket_connect(mod_network_socket_obj_t *socket, byte *ip, mp
|
||||
|
||||
static mp_uint_t py_winc_socket_send(mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, int *_errno)
|
||||
{
|
||||
int ret = winc_socket_send(socket->fd, buf, len, socket->timeout);
|
||||
int ret = winc_socket_send(socket->fileno, buf, len, socket->timeout);
|
||||
if (ret == SOCK_ERR_TIMEOUT) {
|
||||
// The socket is Not closed on timeout when calling
|
||||
// WINC1500 functions that actually accept a timeout.
|
||||
@ -474,7 +478,7 @@ static mp_uint_t py_winc_socket_send(mod_network_socket_obj_t *socket, const byt
|
||||
|
||||
static mp_uint_t py_winc_socket_recv(mod_network_socket_obj_t *socket, byte *buf, mp_uint_t len, int *_errno)
|
||||
{
|
||||
int ret = winc_socket_recv(socket->fd, buf, len, &socket->sockbuf, socket->timeout);
|
||||
int ret = winc_socket_recv(socket->fileno, buf, len, socket->state, socket->timeout);
|
||||
if (ret == SOCK_ERR_TIMEOUT) {
|
||||
// The socket is Not closed on timeout when calling
|
||||
// WINC1500 functions that actually accept a timeout.
|
||||
@ -493,7 +497,7 @@ static mp_uint_t py_winc_socket_sendto(mod_network_socket_obj_t *socket,
|
||||
const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno)
|
||||
{
|
||||
MAKE_SOCKADDR(addr, ip, port)
|
||||
int ret = winc_socket_sendto(socket->fd, buf, len, &addr, socket->timeout);
|
||||
int ret = winc_socket_sendto(socket->fileno, buf, len, &addr, socket->timeout);
|
||||
if (ret == SOCK_ERR_TIMEOUT) {
|
||||
// The socket is Not closed on timeout when calling
|
||||
// WINC1500 functions that actually accept a timeout.
|
||||
@ -511,7 +515,7 @@ static mp_uint_t py_winc_socket_recvfrom(mod_network_socket_obj_t *socket,
|
||||
byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno)
|
||||
{
|
||||
sockaddr addr;
|
||||
int ret = winc_socket_recvfrom(socket->fd, buf, len, &addr, socket->timeout);
|
||||
int ret = winc_socket_recvfrom(socket->fileno, buf, len, &addr, socket->timeout);
|
||||
UNPACK_SOCKADDR((&addr), ip, *port);
|
||||
if (ret == SOCK_ERR_TIMEOUT) {
|
||||
// The socket is Not closed on timeout when calling
|
||||
@ -530,7 +534,7 @@ static mp_uint_t py_winc_socket_recvfrom(mod_network_socket_obj_t *socket,
|
||||
static int py_winc_socket_setsockopt(mod_network_socket_obj_t *socket, mp_uint_t
|
||||
level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno)
|
||||
{
|
||||
int ret = winc_socket_setsockopt(socket->fd, level, opt, optval, optlen);
|
||||
int ret = winc_socket_setsockopt(socket->fileno, level, opt, optval, optlen);
|
||||
if (ret < 0) {
|
||||
*_errno = ret;
|
||||
py_winc_socket_close(socket);
|
||||
|
||||
@ -26,6 +26,8 @@ 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 += -DMICROPY_PY_USSL=1 -DMICROPY_SSL_MBEDTLS=1
|
||||
MICROPY_ARGS += MICROPY_PY_USSL=1 MICROPY_SSL_MBEDTLS=1 MICROPY_PY_BTREE=1
|
||||
|
||||
OMV_CFLAGS += -I$(OMV_BOARD_CONFIG_DIR)
|
||||
OMV_CFLAGS += -I$(TOP_DIR)/$(OMV_DIR)/
|
||||
@ -277,9 +279,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
|
||||
modstm.o \
|
||||
moduos.o \
|
||||
modutime.o \
|
||||
modusocket.o \
|
||||
network_lan.o \
|
||||
modnetwork.o \
|
||||
modmachine.o \
|
||||
machine_i2c.o \
|
||||
machine_spi.o \
|
||||
@ -393,6 +393,9 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\
|
||||
moducryptolib.o \
|
||||
modussl_mbedtls.o \
|
||||
moduasyncio.o \
|
||||
modusocket.o \
|
||||
modnetwork.o \
|
||||
moduplatform.o \
|
||||
)
|
||||
|
||||
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/oofatfs/,\
|
||||
@ -450,6 +453,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
|
||||
extmod/modlwip.o \
|
||||
extmod/moduwebsocket.o \
|
||||
extmod/modwebrepl.o \
|
||||
mpnetworkport.o \
|
||||
)
|
||||
endif
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user