2019-09-18 01:08:06 -04:00
|
|
|
// Options to control how MicroPython is built for this port,
|
|
|
|
// overriding defaults in py/mpconfig.h.
|
|
|
|
|
|
|
|
// Board-specific definitions
|
|
|
|
#include "mpconfigboard.h"
|
2014-11-27 15:30:33 -05:00
|
|
|
|
2019-09-18 01:08:06 -04:00
|
|
|
#include <stdint.h>
|
2014-11-27 15:30:33 -05:00
|
|
|
|
2022-06-22 22:58:11 -04:00
|
|
|
// Set the rom feature level.
|
|
|
|
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES)
|
|
|
|
|
|
|
|
// Disable items from the extra level that are not wanted.
|
|
|
|
#define MICROPY_COMP_MODULE_CONST (0)
|
|
|
|
#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (0)
|
|
|
|
#define MICROPY_COMP_RETURN_IF_EXPR (0)
|
|
|
|
#define MICROPY_OPT_LOAD_ATTR_FAST_PATH (0)
|
|
|
|
#define MICROPY_OPT_MAP_LOOKUP_CACHE (0)
|
|
|
|
#define MICROPY_OPT_MPZ_BITWISE (0)
|
|
|
|
#define MICROPY_OPT_MATH_FACTORIAL (0)
|
|
|
|
#define MICROPY_REPL_EMACS_KEYS (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_COMPLEX (0)
|
|
|
|
#define MICROPY_MODULE_ATTR_DELEGATION (0)
|
|
|
|
#define MICROPY_PY_FUNCTION_ATTRS (0)
|
|
|
|
#define MICROPY_PY_DELATTR_SETATTR (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_STR_CENTER (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_STR_PARTITION (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_SLICE_INDICES (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_COMPILE (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_EXECFILE (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_POW3 (0)
|
|
|
|
#define MICROPY_PY___FILE__ (0)
|
|
|
|
#define MICROPY_PY_MATH_CONSTANTS (0)
|
|
|
|
#define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (0)
|
|
|
|
#define MICROPY_PY_MATH_FACTORIAL (0)
|
|
|
|
#define MICROPY_PY_MATH_ISCLOSE (0)
|
|
|
|
#define MICROPY_PY_SYS_PS1_PS2 (0)
|
|
|
|
#define MICROPY_PY_UBINASCII_CRC32 (0)
|
|
|
|
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (0)
|
|
|
|
|
|
|
|
// Configure other options.
|
2015-12-18 16:07:58 -05:00
|
|
|
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
|
2018-12-04 02:32:10 -05:00
|
|
|
#define MICROPY_GC_STACK_ENTRY_TYPE uint16_t
|
2014-11-27 15:30:33 -05:00
|
|
|
#define MICROPY_ALLOC_PATH_MAX (128)
|
2016-05-10 08:34:30 -04: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)
|
2018-08-02 00:04:44 -04:00
|
|
|
#define MICROPY_DEBUG_PRINTER (&mp_debug_print)
|
2014-11-27 15:30:33 -05:00
|
|
|
#define MICROPY_ENABLE_GC (1)
|
2016-10-13 10:27:53 -04:00
|
|
|
#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
|
2016-04-01 07:22:28 -04:00
|
|
|
#define MICROPY_REPL_EVENT_DRIVEN (0)
|
2016-05-12 07:49:36 -04:00
|
|
|
#define MICROPY_USE_INTERNAL_ERRNO (1)
|
2017-01-21 07:22:44 -05:00
|
|
|
#define MICROPY_PY_BUILTINS_HELP_TEXT esp_help_text
|
2016-10-05 21:28:28 -04:00
|
|
|
#define MICROPY_PY_UHASHLIB_SHA1 (MICROPY_PY_USSL && MICROPY_SSL_AXTLS)
|
2020-08-23 06:12:11 -04:00
|
|
|
#define MICROPY_PY_URANDOM_SEED_INIT_FUNC (*WDEV_HWRNG)
|
2016-10-14 13:13:02 -04:00
|
|
|
#define MICROPY_PY_UTIME_MP_HAL (1)
|
2015-12-28 05:23:30 -05:00
|
|
|
#define MICROPY_PY_LWIP (1)
|
2019-07-30 08:58:54 -04:00
|
|
|
#define MICROPY_PY_LWIP_SOCK_RAW (1)
|
2015-12-30 17:52:01 -05:00
|
|
|
#define MICROPY_PY_MACHINE (1)
|
2017-04-10 17:12:20 -04:00
|
|
|
#define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new
|
2021-08-11 01:14:46 -04:00
|
|
|
#define MICROPY_PY_MACHINE_BITSTREAM (1)
|
2016-05-31 09:25:19 -04:00
|
|
|
#define MICROPY_PY_MACHINE_PULSE (1)
|
2021-06-23 22:37:50 -04:00
|
|
|
#define MICROPY_PY_MACHINE_PWM (1)
|
|
|
|
#define MICROPY_PY_MACHINE_PWM_INIT (1)
|
|
|
|
#define MICROPY_PY_MACHINE_PWM_DUTY (1)
|
|
|
|
#define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/esp8266/machine_pwm.c"
|
2016-04-12 08:55:20 -04:00
|
|
|
#define MICROPY_PY_MACHINE_I2C (1)
|
2021-09-01 22:37:00 -04:00
|
|
|
#define MICROPY_PY_MACHINE_SOFTI2C (1)
|
2016-09-01 01:10:27 -04:00
|
|
|
#define MICROPY_PY_MACHINE_SPI (1)
|
2021-09-01 22:39:28 -04:00
|
|
|
#define MICROPY_PY_MACHINE_SOFTSPI (1)
|
2019-02-10 15:35:18 -05:00
|
|
|
#define MICROPY_PY_UWEBSOCKET (1)
|
2021-09-01 22:39:50 -04:00
|
|
|
#define MICROPY_PY_ONEWIRE (1)
|
2016-04-29 12:38:21 -04:00
|
|
|
#define MICROPY_PY_WEBREPL (1)
|
2016-04-29 12:15:26 -04:00
|
|
|
#define MICROPY_PY_WEBREPL_DELAY (20)
|
2019-07-02 22:55:57 -04:00
|
|
|
#define MICROPY_PY_WEBREPL_STATIC_FILEBUF (1)
|
2022-03-03 07:46:16 -05:00
|
|
|
#define MICROPY_PY_UOS_INCLUDEFILE "ports/esp8266/moduos.c"
|
2018-05-15 01:13:58 -04:00
|
|
|
#define MICROPY_PY_OS_DUPTERM (2)
|
2022-03-03 07:46:16 -05:00
|
|
|
#define MICROPY_PY_UOS_DUPTERM_NOTIFY (1)
|
|
|
|
#define MICROPY_PY_UOS_DUPTERM_STREAM_DETACHED_ATTACHED (1)
|
|
|
|
#define MICROPY_PY_UOS_UNAME (1)
|
|
|
|
#define MICROPY_PY_UOS_UNAME_RELEASE_DYNAMIC (1)
|
|
|
|
#define MICROPY_PY_UOS_URANDOM (1)
|
2015-12-17 17:15:04 -05:00
|
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
2015-12-18 16:07:58 -05:00
|
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
|
2016-07-21 17:57:55 -04:00
|
|
|
#define MICROPY_WARNINGS (1)
|
|
|
|
#define MICROPY_PY_STR_BYTES_CMP_WARN (1)
|
2016-07-30 13:05:56 -04:00
|
|
|
#define MICROPY_STREAMS_POSIX_API (1)
|
2016-03-17 11:06:47 -04:00
|
|
|
#define MICROPY_MODULE_FROZEN_LEXER mp_lexer_new_from_str32
|
2014-11-27 15:30:33 -05:00
|
|
|
|
2016-03-27 10:13:47 -04:00
|
|
|
#define MICROPY_FATFS_ENABLE_LFN (1)
|
|
|
|
#define MICROPY_FATFS_RPATH (2)
|
|
|
|
#define MICROPY_FATFS_MAX_SS (4096)
|
2019-02-25 07:46:17 -05:00
|
|
|
#define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
|
2016-07-31 17:03:55 -04:00
|
|
|
#define MICROPY_ESP8266_APA102 (1)
|
2016-03-27 10:13:47 -04:00
|
|
|
|
2016-03-10 22:41:10 -05:00
|
|
|
#define MICROPY_EVENT_POLL_HOOK {ets_event_poll();}
|
2016-04-01 18:32:55 -04: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-10 22:41:10 -05:00
|
|
|
|
2020-04-23 02:19:43 -04:00
|
|
|
#include "xtirq.h"
|
|
|
|
#define MICROPY_BEGIN_ATOMIC_SECTION() disable_irq()
|
|
|
|
#define MICROPY_END_ATOMIC_SECTION(state) enable_irq(state)
|
|
|
|
|
2014-11-27 15:30:33 -05:00
|
|
|
// type definitions for the specific machine
|
|
|
|
|
|
|
|
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p)))
|
|
|
|
|
2016-02-12 18:36:26 -05:00
|
|
|
#define MP_SSIZE_MAX (0x7fffffff)
|
|
|
|
|
2014-11-27 15:30:33 -05: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 05:23:30 -05:00
|
|
|
typedef uint32_t sys_prot_t; // for modlwip
|
2016-07-30 10:46:36 -04:00
|
|
|
// ssize_t, off_t as required by POSIX-signatured functions in stream.h
|
|
|
|
#include <sys/types.h>
|
2014-11-27 15:30:33 -05:00
|
|
|
|
2019-10-06 08:29:40 -04:00
|
|
|
void *esp_native_code_commit(void *, size_t, void *);
|
|
|
|
#define MP_PLAT_COMMIT_EXEC(buf, len, reloc) esp_native_code_commit(buf, len, reloc)
|
2015-04-09 18:56:15 -04:00
|
|
|
|
2018-08-02 00:04:44 -04:00
|
|
|
// printer for debugging output, goes to UART only
|
|
|
|
extern const struct _mp_print_t mp_debug_print;
|
|
|
|
|
2015-01-07 18:38:50 -05:00
|
|
|
#define MP_STATE_PORT MP_STATE_VM
|
|
|
|
|
2020-07-24 03:13:05 -04:00
|
|
|
// We need an implementation of the log2 function which is not a macro
|
|
|
|
#define MP_NEED_LOG2 (1)
|
|
|
|
|
2014-11-27 15:30:33 -05:00
|
|
|
// We need to provide a declaration/definition of alloca()
|
|
|
|
#include <alloca.h>
|
|
|
|
|
|
|
|
// board specifics
|
|
|
|
|
2015-10-30 19:03:58 -04:00
|
|
|
#define MICROPY_MPHALPORT_H "esp_mphal.h"
|
2016-05-02 13:54:46 -04:00
|
|
|
#define MICROPY_PY_SYS_PLATFORM "esp8266"
|
2015-12-29 13:44:55 -05:00
|
|
|
|
2016-10-18 17:20:10 -04:00
|
|
|
#define MP_FASTCODE(n) __attribute__((section(".iram0.text." #n))) n
|
2021-04-27 20:52:19 -04:00
|
|
|
#define MICROPY_WRAP_MP_SCHED_EXCEPTION(f) MP_FASTCODE(f)
|
2021-04-27 20:57:34 -04:00
|
|
|
#define MICROPY_WRAP_MP_SCHED_KEYBOARD_INTERRUPT(f) MP_FASTCODE(f)
|
2020-04-23 02:19:15 -04:00
|
|
|
#define MICROPY_WRAP_MP_SCHED_SCHEDULE(f) MP_FASTCODE(f)
|
2016-10-18 17:20:10 -04:00
|
|
|
|
2020-08-23 06:12:11 -04:00
|
|
|
#define WDEV_HWRNG ((volatile uint32_t *)0x3ff20e44)
|
|
|
|
|
2015-12-29 13:44:55 -05:00
|
|
|
#define _assert(expr) ((expr) ? (void)0 : __assert_func(__FILE__, __LINE__, __func__, #expr))
|