2018-01-19 07:35:42 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the MicroPython project, http://micropython.org/
|
|
|
|
*
|
|
|
|
* The MIT License (MIT)
|
|
|
|
*
|
2022-10-28 02:47:58 +01:00
|
|
|
* Copyright (c) 2013-2022 Damien P. George
|
|
|
|
* Copyright (c) 2017, 2018 Rami Ali
|
2018-01-19 07:35:42 +00:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
// options to control how MicroPython is built
|
|
|
|
|
2022-10-28 02:47:58 +01:00
|
|
|
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES)
|
|
|
|
|
2018-01-19 07:35:42 +00:00
|
|
|
// You can disable the built-in MicroPython compiler by setting the following
|
|
|
|
// config option to 0. If you do this then you won't get a REPL prompt, but you
|
|
|
|
// will still be able to execute pre-compiled scripts, compiled with mpy-cross.
|
|
|
|
#define MICROPY_ENABLE_COMPILER (1)
|
|
|
|
|
|
|
|
#define MICROPY_ALLOC_PATH_MAX (256)
|
2022-10-28 02:58:05 +01:00
|
|
|
#define MICROPY_READER_VFS (MICROPY_VFS)
|
2018-01-19 07:35:42 +00:00
|
|
|
#define MICROPY_ENABLE_GC (1)
|
2022-10-28 02:47:58 +01:00
|
|
|
#define MICROPY_ENABLE_PYSTACK (1)
|
|
|
|
#define MICROPY_STACK_CHECK (0)
|
|
|
|
#define MICROPY_KBD_EXCEPTION (1)
|
2018-01-19 07:35:42 +00:00
|
|
|
#define MICROPY_REPL_EVENT_DRIVEN (1)
|
2022-10-28 02:47:58 +01:00
|
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
2018-01-19 07:35:42 +00:00
|
|
|
#define MICROPY_ENABLE_DOC_STRING (1)
|
|
|
|
#define MICROPY_WARNINGS (1)
|
|
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
|
2022-10-28 02:47:58 +01:00
|
|
|
#define MICROPY_USE_INTERNAL_ERRNO (1)
|
2018-01-19 07:35:42 +00:00
|
|
|
#define MICROPY_USE_INTERNAL_PRINTF (0)
|
2022-10-28 02:58:05 +01:00
|
|
|
#ifndef MICROPY_VFS
|
|
|
|
#define MICROPY_VFS (1)
|
|
|
|
#endif
|
|
|
|
#define MICROPY_VFS_POSIX (MICROPY_VFS)
|
2018-01-19 07:35:42 +00:00
|
|
|
#define MICROPY_PY_UTIME_MP_HAL (1)
|
2022-08-19 14:58:58 +01:00
|
|
|
#define MICROPY_PY_SYS_PLATFORM "webassembly"
|
2022-10-28 02:47:58 +01:00
|
|
|
#define MICROPY_PY_SYS_STDFILES (0)
|
2018-01-19 07:35:42 +00:00
|
|
|
|
|
|
|
#define MICROPY_EVENT_POLL_HOOK \
|
|
|
|
do { \
|
2020-02-05 14:05:47 +00:00
|
|
|
extern void mp_handle_pending(bool); \
|
|
|
|
mp_handle_pending(true); \
|
2018-01-19 07:35:42 +00:00
|
|
|
} while (0);
|
|
|
|
|
|
|
|
#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 mp_js_hook(void); \
|
|
|
|
mp_js_hook(); \
|
|
|
|
}
|
|
|
|
#define MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_POLL
|
|
|
|
#define MICROPY_VM_HOOK_RETURN MICROPY_VM_HOOK_POLL
|
|
|
|
|
|
|
|
// type definitions for the specific machine
|
|
|
|
|
2022-10-28 02:47:58 +01:00
|
|
|
#define MP_SSIZE_MAX (0x7fffffff)
|
2018-01-19 07:35:42 +00:00
|
|
|
|
|
|
|
// This port is intended to be 32-bit, but unfortunately, int32_t for
|
|
|
|
// different targets may be defined in different ways - either as int
|
|
|
|
// or as long. This requires different printf formatting specifiers
|
|
|
|
// to print such value. So, we avoid int32_t and use int directly.
|
|
|
|
#define UINT_FMT "%u"
|
|
|
|
#define INT_FMT "%d"
|
|
|
|
typedef int mp_int_t; // must be pointer size
|
|
|
|
typedef unsigned mp_uint_t; // must be pointer size
|
|
|
|
typedef long mp_off_t;
|
|
|
|
|
|
|
|
#define MICROPY_HW_BOARD_NAME "JS"
|
|
|
|
#define MICROPY_HW_MCU_NAME "Emscripten"
|
|
|
|
|
|
|
|
#define MP_STATE_PORT MP_STATE_VM
|
2022-10-28 02:58:05 +01:00
|
|
|
|
|
|
|
#if MICROPY_VFS
|
|
|
|
// _GNU_SOURCE must be defined to get definitions of DT_xxx symbols from dirent.h.
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#endif
|