2014-11-27 15:30:33 -05:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
// options to control how Micro Python is built
|
|
|
|
|
2015-12-18 16:07:58 -05:00
|
|
|
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
|
2014-11-27 15:30:33 -05:00
|
|
|
#define MICROPY_ALLOC_PATH_MAX (128)
|
|
|
|
#define MICROPY_EMIT_X64 (0)
|
|
|
|
#define MICROPY_EMIT_THUMB (0)
|
|
|
|
#define MICROPY_EMIT_INLINE_THUMB (0)
|
|
|
|
#define MICROPY_MEM_STATS (0)
|
2015-12-26 09:30:37 -05:00
|
|
|
#define MICROPY_DEBUG_PRINTERS (1)
|
2014-11-27 15:30:33 -05:00
|
|
|
#define MICROPY_ENABLE_GC (1)
|
2016-02-13 08:44:53 -05:00
|
|
|
#define MICROPY_STACK_CHECK (1)
|
2015-01-15 18:54:40 -05:00
|
|
|
#define MICROPY_REPL_EVENT_DRIVEN (1)
|
2014-11-27 15:30:33 -05:00
|
|
|
#define MICROPY_HELPER_REPL (1)
|
|
|
|
#define MICROPY_HELPER_LEXER_UNIX (0)
|
|
|
|
#define MICROPY_ENABLE_SOURCE_LINE (1)
|
2015-05-12 19:18:41 -04:00
|
|
|
#define MICROPY_MODULE_WEAK_LINKS (1)
|
2016-02-12 18:36:26 -05:00
|
|
|
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
|
2015-12-18 16:07:58 -05:00
|
|
|
#define MICROPY_PY_BUILTINS_COMPLEX (0)
|
2014-11-27 15:30:33 -05:00
|
|
|
#define MICROPY_PY_BUILTINS_STR_UNICODE (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_FROZENSET (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_SET (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_SLICE (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_PROPERTY (1)
|
|
|
|
#define MICROPY_PY___FILE__ (0)
|
|
|
|
#define MICROPY_PY_GC (1)
|
|
|
|
#define MICROPY_PY_ARRAY (1)
|
2016-02-12 18:36:26 -05:00
|
|
|
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
|
2014-11-27 15:30:33 -05:00
|
|
|
#define MICROPY_PY_COLLECTIONS (1)
|
2015-12-18 16:43:01 -05:00
|
|
|
#define MICROPY_PY_MATH (1)
|
2014-11-27 15:30:33 -05:00
|
|
|
#define MICROPY_PY_CMATH (0)
|
|
|
|
#define MICROPY_PY_IO (1)
|
|
|
|
#define MICROPY_PY_STRUCT (1)
|
|
|
|
#define MICROPY_PY_SYS (1)
|
2016-02-12 18:36:26 -05:00
|
|
|
#define MICROPY_PY_SYS_MAXSIZE (1)
|
2014-11-27 15:30:33 -05:00
|
|
|
#define MICROPY_PY_SYS_EXIT (1)
|
|
|
|
#define MICROPY_PY_SYS_STDFILES (1)
|
2015-12-25 15:04:24 -05:00
|
|
|
#define MICROPY_PY_UBINASCII (1)
|
|
|
|
#define MICROPY_PY_UCTYPES (1)
|
2015-12-31 09:09:00 -05:00
|
|
|
#define MICROPY_PY_UHASHLIB (1)
|
|
|
|
#define MICROPY_PY_UHASHLIB_SHA1 (1)
|
2015-12-25 15:04:24 -05:00
|
|
|
#define MICROPY_PY_UJSON (1)
|
2015-12-28 05:23:30 -05:00
|
|
|
#define MICROPY_PY_LWIP (1)
|
2015-12-30 17:52:01 -05:00
|
|
|
#define MICROPY_PY_MACHINE (1)
|
2015-12-26 09:30:37 -05:00
|
|
|
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
|
2016-02-12 18:36:26 -05:00
|
|
|
#define MICROPY_CPYTHON_COMPAT (1)
|
2015-12-17 17:15:04 -05:00
|
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
2015-12-18 16:07:58 -05:00
|
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
|
2014-11-27 15:30:33 -05:00
|
|
|
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
|
2015-05-05 18:19:26 -04:00
|
|
|
#define MICROPY_MODULE_FROZEN (1)
|
2014-11-27 15:30:33 -05:00
|
|
|
|
2016-03-10 22:41:10 -05:00
|
|
|
#define MICROPY_EVENT_POLL_HOOK {ets_event_poll();}
|
|
|
|
|
2014-11-27 15:30:33 -05:00
|
|
|
// type definitions for the specific machine
|
|
|
|
|
|
|
|
#define BYTES_PER_WORD (4)
|
|
|
|
|
|
|
|
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p)))
|
|
|
|
|
2016-02-12 18:36:26 -05:00
|
|
|
#define MP_SSIZE_MAX (0x7fffffff)
|
|
|
|
|
2014-11-27 15:30:33 -05:00
|
|
|
#define UINT_FMT "%u"
|
|
|
|
#define INT_FMT "%d"
|
|
|
|
|
|
|
|
typedef int32_t mp_int_t; // must be pointer size
|
|
|
|
typedef uint32_t mp_uint_t; // must be pointer size
|
|
|
|
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;
|
2015-12-28 05:23:30 -05:00
|
|
|
typedef uint32_t sys_prot_t; // for modlwip
|
2014-11-27 15:30:33 -05:00
|
|
|
|
2015-04-09 18:56:15 -04:00
|
|
|
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
|
|
|
|
|
2014-11-27 15:30:33 -05:00
|
|
|
// extra built in names to add to the global namespace
|
|
|
|
extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
|
|
|
|
#define MICROPY_PORT_BUILTINS \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
|
|
|
|
|
|
|
|
// extra built in modules to add to the list of known ones
|
|
|
|
extern const struct _mp_obj_module_t pyb_module;
|
2015-01-22 17:34:16 -05:00
|
|
|
extern const struct _mp_obj_module_t esp_module;
|
2015-06-12 10:16:52 -04:00
|
|
|
extern const struct _mp_obj_module_t network_module;
|
2015-05-11 15:11:37 -04:00
|
|
|
extern const struct _mp_obj_module_t utime_module;
|
2015-05-18 12:35:25 -04:00
|
|
|
extern const struct _mp_obj_module_t uos_module;
|
2015-12-28 05:23:30 -05:00
|
|
|
extern const struct _mp_obj_module_t mp_module_lwip;
|
2015-12-30 17:52:01 -05:00
|
|
|
extern const struct _mp_obj_module_t mp_module_machine;
|
2014-11-27 15:30:33 -05:00
|
|
|
|
|
|
|
#define MICROPY_PORT_BUILTIN_MODULES \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \
|
2015-01-22 17:34:16 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_esp), (mp_obj_t)&esp_module }, \
|
2015-12-28 05:23:30 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_lwip), (mp_obj_t)&mp_module_lwip }, \
|
2015-06-12 10:16:52 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&network_module }, \
|
2015-05-11 15:11:37 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \
|
2015-05-18 12:35:25 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&uos_module }, \
|
2015-12-30 17:52:01 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \
|
2014-11-27 15:30:33 -05:00
|
|
|
|
2015-05-12 19:18:41 -04:00
|
|
|
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&utime_module }, \
|
2015-05-18 12:35:25 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&uos_module }, \
|
2015-05-12 19:18:41 -04:00
|
|
|
|
2015-01-07 18:38:50 -05:00
|
|
|
#define MP_STATE_PORT MP_STATE_VM
|
|
|
|
|
|
|
|
#define MICROPY_PORT_ROOT_POINTERS \
|
2015-05-02 15:24:25 -04:00
|
|
|
const char *readline_hist[8]; \
|
2015-12-20 06:58:58 -05:00
|
|
|
mp_obj_t mp_kbd_exception; \
|
2015-05-02 15:24:25 -04:00
|
|
|
\
|
|
|
|
/* Singleton instance of scan callback, meaning that there can
|
|
|
|
be only one concurrent AP scan. */ \
|
|
|
|
mp_obj_t scan_cb_obj; \
|
2015-01-07 18:38:50 -05:00
|
|
|
|
2014-11-27 15:30:33 -05:00
|
|
|
// We need to provide a declaration/definition of alloca()
|
|
|
|
#include <alloca.h>
|
|
|
|
|
|
|
|
// board specifics
|
|
|
|
|
2015-10-30 19:03:58 -04:00
|
|
|
#define MICROPY_MPHALPORT_H "esp_mphal.h"
|
2014-11-27 15:30:33 -05:00
|
|
|
#define MICROPY_HW_BOARD_NAME "ESP module"
|
|
|
|
#define MICROPY_HW_MCU_NAME "ESP8266"
|
2015-05-18 12:35:25 -04:00
|
|
|
#define MICROPY_PY_SYS_PLATFORM "ESP8266"
|
2015-12-29 13:44:55 -05:00
|
|
|
|
|
|
|
#define _assert(expr) ((expr) ? (void)0 : __assert_func(__FILE__, __LINE__, __func__, #expr))
|