From 6cc1a7a214e573cf3efc3c53f3ecba6c65ea2d11 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 31 Mar 2017 00:06:31 +0300 Subject: [PATCH] zephyr: Integrate modusocket into build. --- zephyr/Makefile | 1 + zephyr/mpconfigport.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/zephyr/Makefile b/zephyr/Makefile index c3781322a0..b78b4be95f 100644 --- a/zephyr/Makefile +++ b/zephyr/Makefile @@ -33,6 +33,7 @@ INC += -I$(ZEPHYR_BASE)/net/ip/contiki/os SRC_C = main.c \ help.c \ + modusocket.c \ modutime.c \ modzephyr.c \ modmachine.c \ diff --git a/zephyr/mpconfigport.h b/zephyr/mpconfigport.h index ff8a593a49..e0586dcfc1 100644 --- a/zephyr/mpconfigport.h +++ b/zephyr/mpconfigport.h @@ -60,6 +60,11 @@ #define MICROPY_PY_MACHINE (1) #define MICROPY_MODULE_WEAK_LINKS (1) #define MICROPY_PY_STRUCT (0) +#ifdef CONFIG_NETWORKING +// If we have networking, we likely want errno comfort +#define MICROPY_PY_UERRNO (1) +#define MICROPY_PY_USOCKET (1) +#endif #define MICROPY_PY_UTIME (1) #define MICROPY_PY_UTIME_MP_HAL (1) #define MICROPY_PY_ZEPHYR (1) @@ -103,6 +108,7 @@ typedef long mp_off_t; extern const struct _mp_obj_module_t mp_module_machine; extern const struct _mp_obj_module_t mp_module_time; +extern const struct _mp_obj_module_t mp_module_usocket; extern const struct _mp_obj_module_t mp_module_zephyr; #if MICROPY_PY_UTIME @@ -119,11 +125,13 @@ extern const struct _mp_obj_module_t mp_module_zephyr; #define MICROPY_PORT_BUILTIN_MODULES \ { MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \ + { MP_OBJ_NEW_QSTR(MP_QSTR_usocket), (mp_obj_t)&mp_module_usocket }, \ MICROPY_PY_UTIME_DEF \ MICROPY_PY_ZEPHYR_DEF \ #define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \ { MP_OBJ_NEW_QSTR(MP_QSTR_time), MP_ROM_PTR(&mp_module_time) }, \ + { MP_OBJ_NEW_QSTR(MP_QSTR_socket), MP_ROM_PTR(&mp_module_usocket) }, \ // extra built in names to add to the global namespace #define MICROPY_PORT_BUILTINS \