2014-11-27 20:30:33 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
// options to control how Micro Python is built
|
|
|
|
|
2015-12-18 21:07:58 +00:00
|
|
|
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
|
2014-11-27 20:30:33 +00:00
|
|
|
#define MICROPY_ALLOC_PATH_MAX (128)
|
2016-05-10 13:34:30 +01:00
|
|
|
#define MICROPY_ALLOC_LEXER_INDENT_INIT (8)
|
|
|
|
#define MICROPY_ALLOC_PARSE_RULE_INIT (48)
|
|
|
|
#define MICROPY_ALLOC_PARSE_RULE_INC (8)
|
|
|
|
#define MICROPY_ALLOC_PARSE_RESULT_INC (8)
|
|
|
|
#define MICROPY_ALLOC_PARSE_CHUNK_INIT (64)
|
2016-10-11 06:23:20 +01:00
|
|
|
#define MICROPY_PERSISTENT_CODE_LOAD (1)
|
2014-11-27 20:30:33 +00:00
|
|
|
#define MICROPY_EMIT_X64 (0)
|
|
|
|
#define MICROPY_EMIT_THUMB (0)
|
|
|
|
#define MICROPY_EMIT_INLINE_THUMB (0)
|
|
|
|
#define MICROPY_MEM_STATS (0)
|
2015-12-26 14:30:37 +00:00
|
|
|
#define MICROPY_DEBUG_PRINTERS (1)
|
2016-04-13 09:46:18 +01:00
|
|
|
#define MICROPY_DEBUG_PRINTER_DEST mp_debug_print
|
2014-11-27 20:30:33 +00:00
|
|
|
#define MICROPY_ENABLE_GC (1)
|
2016-02-13 13:44:53 +00:00
|
|
|
#define MICROPY_STACK_CHECK (1)
|
2016-04-01 12:22:28 +01:00
|
|
|
#define MICROPY_REPL_EVENT_DRIVEN (0)
|
2016-01-30 18:05:57 +00:00
|
|
|
#define MICROPY_REPL_AUTO_INDENT (1)
|
2014-11-27 20:30:33 +00:00
|
|
|
#define MICROPY_HELPER_REPL (1)
|
|
|
|
#define MICROPY_HELPER_LEXER_UNIX (0)
|
|
|
|
#define MICROPY_ENABLE_SOURCE_LINE (1)
|
2015-05-13 00:18:41 +01:00
|
|
|
#define MICROPY_MODULE_WEAK_LINKS (1)
|
2016-02-12 23:36:26 +00:00
|
|
|
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
|
2016-05-12 12:49:36 +01:00
|
|
|
#define MICROPY_USE_INTERNAL_ERRNO (1)
|
2016-08-13 23:02:35 +01:00
|
|
|
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
|
2015-12-18 21:07:58 +00:00
|
|
|
#define MICROPY_PY_BUILTINS_COMPLEX (0)
|
2014-11-27 20:30:33 +00: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)
|
2016-10-11 11:22:36 +01:00
|
|
|
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
|
2014-11-27 20:30:33 +00:00
|
|
|
#define MICROPY_PY_BUILTINS_PROPERTY (1)
|
|
|
|
#define MICROPY_PY___FILE__ (0)
|
|
|
|
#define MICROPY_PY_GC (1)
|
|
|
|
#define MICROPY_PY_ARRAY (1)
|
2016-02-12 23:36:26 +00:00
|
|
|
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
|
2014-11-27 20:30:33 +00:00
|
|
|
#define MICROPY_PY_COLLECTIONS (1)
|
2016-05-22 00:57:05 +01:00
|
|
|
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)
|
2015-12-18 21:43:01 +00:00
|
|
|
#define MICROPY_PY_MATH (1)
|
2014-11-27 20:30:33 +00:00
|
|
|
#define MICROPY_PY_CMATH (0)
|
|
|
|
#define MICROPY_PY_IO (1)
|
2016-05-31 19:46:02 +01:00
|
|
|
#define MICROPY_PY_IO_FILEIO (1)
|
2014-11-27 20:30:33 +00:00
|
|
|
#define MICROPY_PY_STRUCT (1)
|
|
|
|
#define MICROPY_PY_SYS (1)
|
2016-02-12 23:36:26 +00:00
|
|
|
#define MICROPY_PY_SYS_MAXSIZE (1)
|
2014-11-27 20:30:33 +00:00
|
|
|
#define MICROPY_PY_SYS_EXIT (1)
|
|
|
|
#define MICROPY_PY_SYS_STDFILES (1)
|
2016-10-11 06:22:21 +01:00
|
|
|
#define MICROPY_PY_SYS_STDIO_BUFFER (1)
|
2016-05-10 23:27:29 +01:00
|
|
|
#define MICROPY_PY_UERRNO (1)
|
2015-12-25 20:04:24 +00:00
|
|
|
#define MICROPY_PY_UBINASCII (1)
|
|
|
|
#define MICROPY_PY_UCTYPES (1)
|
2015-12-31 14:09:00 +00:00
|
|
|
#define MICROPY_PY_UHASHLIB (1)
|
2016-10-06 02:28:28 +01:00
|
|
|
#define MICROPY_PY_UHASHLIB_SHA1 (MICROPY_PY_USSL && MICROPY_SSL_AXTLS)
|
2016-02-13 10:41:10 +00:00
|
|
|
#define MICROPY_PY_UHEAPQ (1)
|
2015-12-25 20:04:24 +00:00
|
|
|
#define MICROPY_PY_UJSON (1)
|
2016-01-24 23:08:24 +00:00
|
|
|
#define MICROPY_PY_URANDOM (1)
|
2016-02-13 10:41:10 +00:00
|
|
|
#define MICROPY_PY_URE (1)
|
|
|
|
#define MICROPY_PY_UZLIB (1)
|
2015-12-28 10:23:30 +00:00
|
|
|
#define MICROPY_PY_LWIP (1)
|
2015-12-30 22:52:01 +00:00
|
|
|
#define MICROPY_PY_MACHINE (1)
|
2016-05-31 14:25:19 +01:00
|
|
|
#define MICROPY_PY_MACHINE_PULSE (1)
|
2016-04-12 13:55:20 +01:00
|
|
|
#define MICROPY_PY_MACHINE_I2C (1)
|
2016-09-01 06:10:27 +01:00
|
|
|
#define MICROPY_PY_MACHINE_SPI (1)
|
2016-04-11 19:25:28 +01:00
|
|
|
#define MICROPY_PY_WEBSOCKET (1)
|
2016-04-29 17:38:21 +01:00
|
|
|
#define MICROPY_PY_WEBREPL (1)
|
2016-04-29 17:15:26 +01:00
|
|
|
#define MICROPY_PY_WEBREPL_DELAY (20)
|
2016-04-12 13:55:50 +01:00
|
|
|
#define MICROPY_PY_FRAMEBUF (1)
|
2015-12-26 14:30:37 +00:00
|
|
|
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
|
2016-03-29 09:13:32 +01:00
|
|
|
#define MICROPY_PY_OS_DUPTERM (1)
|
2016-02-12 23:36:26 +00:00
|
|
|
#define MICROPY_CPYTHON_COMPAT (1)
|
2015-12-17 22:15:04 +00:00
|
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
2015-12-18 21:07:58 +00:00
|
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
|
2016-04-06 22:38:08 +01:00
|
|
|
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
|
2016-07-21 22:57:55 +01:00
|
|
|
#define MICROPY_WARNINGS (1)
|
|
|
|
#define MICROPY_PY_STR_BYTES_CMP_WARN (1)
|
2016-01-03 05:19:04 +00:00
|
|
|
#define MICROPY_STREAMS_NON_BLOCK (1)
|
2016-07-30 18:05:56 +01:00
|
|
|
#define MICROPY_STREAMS_POSIX_API (1)
|
2016-01-31 22:24:16 +00:00
|
|
|
#define MICROPY_MODULE_FROZEN_STR (1)
|
2016-05-11 16:57:29 +01:00
|
|
|
#define MICROPY_MODULE_FROZEN_MPY (1)
|
2016-03-17 15:06:47 +00:00
|
|
|
#define MICROPY_MODULE_FROZEN_LEXER mp_lexer_new_from_str32
|
2016-05-11 16:57:29 +01:00
|
|
|
#define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool
|
2014-11-27 20:30:33 +00:00
|
|
|
|
2016-03-27 15:13:47 +01:00
|
|
|
#define MICROPY_FATFS_ENABLE_LFN (1)
|
|
|
|
#define MICROPY_FATFS_RPATH (2)
|
|
|
|
#define MICROPY_FATFS_VOLUMES (2)
|
|
|
|
#define MICROPY_FATFS_MAX_SS (4096)
|
|
|
|
#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
|
|
|
|
#define MICROPY_FSUSERMOUNT (1)
|
|
|
|
#define MICROPY_VFS_FAT (1)
|
2016-07-31 22:03:55 +01:00
|
|
|
#define MICROPY_ESP8266_APA102 (1)
|
2016-10-08 22:56:46 +01:00
|
|
|
#define MICROPY_ESP8266_NEOPIXEL (1)
|
2016-03-27 15:13:47 +01:00
|
|
|
|
2016-03-11 03:41:10 +00:00
|
|
|
#define MICROPY_EVENT_POLL_HOOK {ets_event_poll();}
|
2016-04-01 23:32:55 +01:00
|
|
|
#define MICROPY_VM_HOOK_COUNT (10)
|
|
|
|
#define MICROPY_VM_HOOK_INIT static uint vm_hook_divisor = MICROPY_VM_HOOK_COUNT;
|
|
|
|
#define MICROPY_VM_HOOK_POLL if (--vm_hook_divisor == 0) { \
|
|
|
|
vm_hook_divisor = MICROPY_VM_HOOK_COUNT; \
|
|
|
|
extern void ets_loop_iter(void); \
|
|
|
|
ets_loop_iter(); \
|
|
|
|
}
|
|
|
|
#define MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_POLL
|
|
|
|
#define MICROPY_VM_HOOK_RETURN MICROPY_VM_HOOK_POLL
|
2016-03-11 03:41:10 +00:00
|
|
|
|
2014-11-27 20:30:33 +00: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 23:36:26 +00:00
|
|
|
#define MP_SSIZE_MAX (0x7fffffff)
|
|
|
|
|
2014-11-27 20:30:33 +00: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 long mp_off_t;
|
2015-12-28 10:23:30 +00:00
|
|
|
typedef uint32_t sys_prot_t; // for modlwip
|
2016-07-30 15:46:36 +01:00
|
|
|
// ssize_t, off_t as required by POSIX-signatured functions in stream.h
|
|
|
|
#include <sys/types.h>
|
2014-11-27 20:30:33 +00:00
|
|
|
|
2015-04-09 23:56:15 +01:00
|
|
|
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
|
|
|
|
|
2016-05-31 19:46:02 +01:00
|
|
|
#define mp_type_fileio fatfs_type_fileio
|
|
|
|
#define mp_type_textio fatfs_type_textio
|
|
|
|
|
2014-11-27 20:30:33 +00:00
|
|
|
// extra built in names to add to the global namespace
|
|
|
|
#define MICROPY_PORT_BUILTINS \
|
2016-04-28 22:17:11 +01:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \
|
2016-04-14 22:08:39 +01:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
|
2014-11-27 20:30:33 +00:00
|
|
|
{ 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
|
2015-01-22 22:34:16 +00:00
|
|
|
extern const struct _mp_obj_module_t esp_module;
|
2015-06-12 15:16:52 +01:00
|
|
|
extern const struct _mp_obj_module_t network_module;
|
2015-05-11 20:11:37 +01:00
|
|
|
extern const struct _mp_obj_module_t utime_module;
|
2015-05-18 17:35:25 +01:00
|
|
|
extern const struct _mp_obj_module_t uos_module;
|
2015-12-28 10:23:30 +00:00
|
|
|
extern const struct _mp_obj_module_t mp_module_lwip;
|
2015-12-30 22:52:01 +00:00
|
|
|
extern const struct _mp_obj_module_t mp_module_machine;
|
2015-12-29 00:20:34 +00:00
|
|
|
extern const struct _mp_obj_module_t onewire_module;
|
2014-11-27 20:30:33 +00:00
|
|
|
|
|
|
|
#define MICROPY_PORT_BUILTIN_MODULES \
|
2015-01-22 22:34:16 +00:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_esp), (mp_obj_t)&esp_module }, \
|
2015-12-28 10:23:30 +00:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_lwip), (mp_obj_t)&mp_module_lwip }, \
|
2016-03-23 14:25:55 +00:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&mp_module_lwip }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_usocket), (mp_obj_t)&mp_module_lwip }, \
|
2015-06-12 15:16:52 +01:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&network_module }, \
|
2015-05-11 20:11:37 +01:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \
|
2015-05-18 17:35:25 +01:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&uos_module }, \
|
2015-12-30 22:52:01 +00:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \
|
2015-12-29 00:20:34 +00:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR__onewire), (mp_obj_t)&onewire_module }, \
|
2014-11-27 20:30:33 +00:00
|
|
|
|
2015-05-13 00:18:41 +01:00
|
|
|
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&utime_module }, \
|
2015-05-18 17:35:25 +01:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&uos_module }, \
|
2016-02-11 11:36:19 +00:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_json), (mp_obj_t)&mp_module_ujson }, \
|
2016-05-10 23:27:29 +01:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_errno), (mp_obj_t)&mp_module_uerrno }, \
|
2015-05-13 00:18:41 +01:00
|
|
|
|
2015-01-07 23:38:50 +00:00
|
|
|
#define MP_STATE_PORT MP_STATE_VM
|
|
|
|
|
|
|
|
#define MICROPY_PORT_ROOT_POINTERS \
|
2015-05-02 20:24:25 +01:00
|
|
|
const char *readline_hist[8]; \
|
2016-03-30 16:13:03 +01:00
|
|
|
vstr_t *repl_line; \
|
2015-12-20 11:58:58 +00:00
|
|
|
mp_obj_t mp_kbd_exception; \
|
2016-04-14 11:15:43 +01:00
|
|
|
mp_obj_t pin_irq_handler[16]; \
|
2015-01-07 23:38:50 +00:00
|
|
|
|
2014-11-27 20:30:33 +00:00
|
|
|
// We need to provide a declaration/definition of alloca()
|
|
|
|
#include <alloca.h>
|
|
|
|
|
|
|
|
// board specifics
|
|
|
|
|
2015-10-30 23:03:58 +00:00
|
|
|
#define MICROPY_MPHALPORT_H "esp_mphal.h"
|
2014-11-27 20:30:33 +00:00
|
|
|
#define MICROPY_HW_BOARD_NAME "ESP module"
|
|
|
|
#define MICROPY_HW_MCU_NAME "ESP8266"
|
2016-05-02 18:54:46 +01:00
|
|
|
#define MICROPY_PY_SYS_PLATFORM "esp8266"
|
2015-12-29 18:44:55 +00:00
|
|
|
|
|
|
|
#define _assert(expr) ((expr) ? (void)0 : __assert_func(__FILE__, __LINE__, __func__, #expr))
|