89 lines
3.1 KiB
C
89 lines
3.1 KiB
C
#include <stdint.h>
|
|
|
|
// options to control how Micro Python is built
|
|
|
|
#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)
|
|
#define MICROPY_DEBUG_PRINTERS (0)
|
|
#define MICROPY_ENABLE_GC (1)
|
|
#define MICROPY_STACK_CHECK (0)
|
|
#define MICROPY_REPL_EVENT_DRIVEN (1)
|
|
#define MICROPY_HELPER_REPL (1)
|
|
#define MICROPY_HELPER_LEXER_UNIX (0)
|
|
#define MICROPY_ENABLE_SOURCE_LINE (1)
|
|
#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)
|
|
#define MICROPY_PY_COLLECTIONS (1)
|
|
#define MICROPY_PY_MATH (0)
|
|
#define MICROPY_PY_CMATH (0)
|
|
#define MICROPY_PY_IO (1)
|
|
#define MICROPY_PY_STRUCT (1)
|
|
#define MICROPY_PY_SYS (1)
|
|
#define MICROPY_PY_SYS_EXIT (1)
|
|
#define MICROPY_PY_SYS_STDFILES (1)
|
|
#define MICROPY_CPYTHON_COMPAT (0)
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
|
|
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
|
|
#define MICROPY_MODULE_FROZEN (1)
|
|
|
|
// type definitions for the specific machine
|
|
|
|
#define BYTES_PER_WORD (4)
|
|
|
|
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p)))
|
|
|
|
#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;
|
|
|
|
void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len);
|
|
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
|
|
|
|
// 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;
|
|
extern const struct _mp_obj_module_t esp_module;
|
|
|
|
#define MICROPY_PORT_BUILTIN_MODULES \
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_esp), (mp_obj_t)&esp_module }, \
|
|
|
|
#define MP_STATE_PORT MP_STATE_VM
|
|
|
|
#define MICROPY_PORT_ROOT_POINTERS \
|
|
const char *readline_hist[8]; \
|
|
\
|
|
/* Singleton instance of scan callback, meaning that there can
|
|
be only one concurrent AP scan. */ \
|
|
mp_obj_t scan_cb_obj; \
|
|
|
|
// We need to provide a declaration/definition of alloca()
|
|
#include <alloca.h>
|
|
|
|
// board specifics
|
|
|
|
#define MICROPY_HAL_H "esp_mphal.h"
|
|
#define MICROPY_HW_BOARD_NAME "ESP module"
|
|
#define MICROPY_HW_MCU_NAME "ESP8266"
|