blob: c80f78d45c217a1e3d315ebb4342215971a777b4 [file] [log] [blame]
Damien George075d5972014-11-27 20:30:33 +00001#include <stdint.h>
2
3// options to control how Micro Python is built
4
5#define MICROPY_ALLOC_PATH_MAX (128)
6#define MICROPY_EMIT_X64 (0)
7#define MICROPY_EMIT_THUMB (0)
8#define MICROPY_EMIT_INLINE_THUMB (0)
9#define MICROPY_MEM_STATS (0)
10#define MICROPY_DEBUG_PRINTERS (0)
11#define MICROPY_ENABLE_GC (1)
Paul Sokolovskyf12ea7c2015-01-16 01:54:40 +020012#define MICROPY_STACK_CHECK (0)
13#define MICROPY_REPL_EVENT_DRIVEN (1)
Damien George075d5972014-11-27 20:30:33 +000014#define MICROPY_HELPER_REPL (1)
15#define MICROPY_HELPER_LEXER_UNIX (0)
16#define MICROPY_ENABLE_SOURCE_LINE (1)
Damien George4e7dc972015-05-13 00:18:41 +010017#define MICROPY_MODULE_WEAK_LINKS (1)
Damien George075d5972014-11-27 20:30:33 +000018#define MICROPY_PY_BUILTINS_STR_UNICODE (1)
19#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
20#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
21#define MICROPY_PY_BUILTINS_FROZENSET (1)
22#define MICROPY_PY_BUILTINS_SET (1)
23#define MICROPY_PY_BUILTINS_SLICE (1)
24#define MICROPY_PY_BUILTINS_PROPERTY (1)
25#define MICROPY_PY___FILE__ (0)
26#define MICROPY_PY_GC (1)
27#define MICROPY_PY_ARRAY (1)
28#define MICROPY_PY_COLLECTIONS (1)
29#define MICROPY_PY_MATH (0)
30#define MICROPY_PY_CMATH (0)
31#define MICROPY_PY_IO (1)
32#define MICROPY_PY_STRUCT (1)
33#define MICROPY_PY_SYS (1)
34#define MICROPY_PY_SYS_EXIT (1)
35#define MICROPY_PY_SYS_STDFILES (1)
36#define MICROPY_CPYTHON_COMPAT (0)
Damien Georgeecd12722015-12-17 22:15:04 +000037#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
Damien George075d5972014-11-27 20:30:33 +000038#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
39#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
Josef Gajdusekbda70412015-05-06 00:19:26 +020040#define MICROPY_MODULE_FROZEN (1)
Damien George075d5972014-11-27 20:30:33 +000041
42// type definitions for the specific machine
43
44#define BYTES_PER_WORD (4)
45
46#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p)))
47
48#define UINT_FMT "%u"
49#define INT_FMT "%d"
50
51typedef int32_t mp_int_t; // must be pointer size
52typedef uint32_t mp_uint_t; // must be pointer size
53typedef void *machine_ptr_t; // must be of pointer size
54typedef const void *machine_const_ptr_t; // must be of pointer size
55typedef long mp_off_t;
56
Damien George7f9d1d62015-04-09 23:56:15 +010057#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
58
Damien George075d5972014-11-27 20:30:33 +000059// extra built in names to add to the global namespace
60extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
61#define MICROPY_PORT_BUILTINS \
62 { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
63
64// extra built in modules to add to the list of known ones
65extern const struct _mp_obj_module_t pyb_module;
Paul Sokolovsky6ec650b2015-01-23 00:34:16 +020066extern const struct _mp_obj_module_t esp_module;
Paul Sokolovskyee3fec32015-06-12 17:16:52 +030067extern const struct _mp_obj_module_t network_module;
Josef Gajdusek103d12a2015-05-11 21:11:37 +020068extern const struct _mp_obj_module_t utime_module;
Josef Gajdusek59610c42015-05-18 18:35:25 +020069extern const struct _mp_obj_module_t uos_module;
Damien George075d5972014-11-27 20:30:33 +000070
71#define MICROPY_PORT_BUILTIN_MODULES \
72 { MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \
Paul Sokolovsky6ec650b2015-01-23 00:34:16 +020073 { MP_OBJ_NEW_QSTR(MP_QSTR_esp), (mp_obj_t)&esp_module }, \
Paul Sokolovskyee3fec32015-06-12 17:16:52 +030074 { MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&network_module }, \
Josef Gajdusek103d12a2015-05-11 21:11:37 +020075 { MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \
Josef Gajdusek59610c42015-05-18 18:35:25 +020076 { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&uos_module }, \
Damien George075d5972014-11-27 20:30:33 +000077
Damien George4e7dc972015-05-13 00:18:41 +010078#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
79 { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&utime_module }, \
Josef Gajdusek59610c42015-05-18 18:35:25 +020080 { MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&uos_module }, \
Damien George4e7dc972015-05-13 00:18:41 +010081
Damien George3b51b3e2015-01-07 23:38:50 +000082#define MP_STATE_PORT MP_STATE_VM
83
84#define MICROPY_PORT_ROOT_POINTERS \
Josef Gajdusek9e00ac82015-05-02 21:24:25 +020085 const char *readline_hist[8]; \
86 \
87 /* Singleton instance of scan callback, meaning that there can
88 be only one concurrent AP scan. */ \
89 mp_obj_t scan_cb_obj; \
Damien George3b51b3e2015-01-07 23:38:50 +000090
Damien George075d5972014-11-27 20:30:33 +000091// We need to provide a declaration/definition of alloca()
92#include <alloca.h>
93
94// board specifics
95
Damien George731f3592015-10-30 23:03:58 +000096#define MICROPY_MPHALPORT_H "esp_mphal.h"
Damien George075d5972014-11-27 20:30:33 +000097#define MICROPY_HW_BOARD_NAME "ESP module"
98#define MICROPY_HW_MCU_NAME "ESP8266"
Josef Gajdusek59610c42015-05-18 18:35:25 +020099#define MICROPY_PY_SYS_PLATFORM "ESP8266"