diff options
Diffstat (limited to 'zephyr/mpconfigport.h')
-rw-r--r-- | zephyr/mpconfigport.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/zephyr/mpconfigport.h b/zephyr/mpconfigport.h index 26fb1410f..98a033be4 100644 --- a/zephyr/mpconfigport.h +++ b/zephyr/mpconfigport.h @@ -27,12 +27,15 @@ // Include Zephyr's autoconf.h, which should be made first by Zephyr makefiles #include "autoconf.h" +// Included here to get basic Zephyr environment (macros, etc.) +#include <zephyr.h> // Usually passed from Makefile #ifndef MICROPY_HEAP_SIZE #define MICROPY_HEAP_SIZE (16 * 1024) #endif +#define MICROPY_ENABLE_SOURCE_LINE (1) #define MICROPY_STACK_CHECK (1) #define MICROPY_ENABLE_GC (1) #define MICROPY_HELPER_REPL (1) @@ -48,16 +51,25 @@ #define MICROPY_PY_BUILTINS_RANGE_ATTRS (0) #define MICROPY_PY_BUILTINS_REVERSED (0) #define MICROPY_PY_BUILTINS_SET (0) +#define MICROPY_PY_BUILTINS_HELP (1) +#define MICROPY_PY_BUILTINS_HELP_TEXT zephyr_help_text #define MICROPY_PY_ARRAY (0) #define MICROPY_PY_COLLECTIONS (0) #define MICROPY_PY_CMATH (0) #define MICROPY_PY_IO (0) #define MICROPY_PY_MICROPYTHON_MEM_INFO (1) #define MICROPY_PY_MACHINE (1) +#define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new #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) #define MICROPY_PY_SYS_MODULES (0) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) @@ -89,8 +101,6 @@ typedef void *machine_ptr_t; // must be of pointer size typedef const void *machine_const_ptr_t; // must be of pointer size typedef long mp_off_t; -#define BYTES_PER_WORD (sizeof(mp_int_t)) - #define MP_STATE_PORT MP_STATE_VM #define MICROPY_PORT_ROOT_POINTERS \ @@ -98,6 +108,16 @@ 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_USOCKET +#define MICROPY_PY_USOCKET_DEF { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_usocket) }, +#define MICROPY_PY_USOCKET_WEAK_DEF { MP_OBJ_NEW_QSTR(MP_QSTR_socket), MP_ROM_PTR(&mp_module_usocket) }, +#else +#define MICROPY_PY_USOCKET_DEF +#define MICROPY_PY_USOCKET_WEAK_DEF +#endif #if MICROPY_PY_UTIME #define MICROPY_PY_UTIME_DEF { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) }, @@ -105,14 +125,22 @@ extern const struct _mp_obj_module_t mp_module_time; #define MICROPY_PY_UTIME_DEF #endif +#if MICROPY_PY_ZEPHYR +#define MICROPY_PY_ZEPHYR_DEF { MP_ROM_QSTR(MP_QSTR_zephyr), MP_ROM_PTR(&mp_module_zephyr) }, +#else +#define MICROPY_PY_ZEPHYR_DEF +#endif + #define MICROPY_PORT_BUILTIN_MODULES \ { MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \ + MICROPY_PY_USOCKET_DEF \ 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) }, \ + MICROPY_PY_USOCKET_WEAK_DEF \ // extra built in names to add to the global namespace #define MICROPY_PORT_BUILTINS \ - { MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \ |