blob: 9460eae6094e1f5e73120bad8ade254e13b164f5 [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 Georgefbea8102014-11-28 14:58:25 +000037#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
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 +010057void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len);
58#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
59
Damien George075d5972014-11-27 20:30:33 +000060// extra built in names to add to the global namespace
61extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
62#define MICROPY_PORT_BUILTINS \
63 { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
64
65// extra built in modules to add to the list of known ones
66extern const struct _mp_obj_module_t pyb_module;
Paul Sokolovsky6ec650b2015-01-23 00:34:16 +020067extern const struct _mp_obj_module_t esp_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 }, \
Josef Gajdusek103d12a2015-05-11 21:11:37 +020074 { MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \
Josef Gajdusek59610c42015-05-18 18:35:25 +020075 { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&uos_module }, \
Damien George075d5972014-11-27 20:30:33 +000076
Damien George4e7dc972015-05-13 00:18:41 +010077#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
78 { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&utime_module }, \
Josef Gajdusek59610c42015-05-18 18:35:25 +020079 { MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&uos_module }, \
Damien George4e7dc972015-05-13 00:18:41 +010080
Damien George3b51b3e2015-01-07 23:38:50 +000081#define MP_STATE_PORT MP_STATE_VM
82
83#define MICROPY_PORT_ROOT_POINTERS \
Josef Gajdusek9e00ac82015-05-02 21:24:25 +020084 const char *readline_hist[8]; \
85 \
86 /* Singleton instance of scan callback, meaning that there can
87 be only one concurrent AP scan. */ \
88 mp_obj_t scan_cb_obj; \
Damien George3b51b3e2015-01-07 23:38:50 +000089
Damien George075d5972014-11-27 20:30:33 +000090// We need to provide a declaration/definition of alloca()
91#include <alloca.h>
92
93// board specifics
94
95#define MICROPY_HAL_H "esp_mphal.h"
96#define MICROPY_HW_BOARD_NAME "ESP module"
97#define MICROPY_HW_MCU_NAME "ESP8266"
Josef Gajdusek59610c42015-05-18 18:35:25 +020098#define MICROPY_PY_SYS_PLATFORM "ESP8266"