2016-08-19 23:24:04 -04:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2016-08-23 20:36:29 -04:00
|
|
|
#ifndef __INCLUDED_MPCONFIGPORT_H
|
|
|
|
#define __INCLUDED_MPCONFIGPORT_H
|
|
|
|
|
2016-12-19 19:38:35 -05:00
|
|
|
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
|
|
|
|
|
2017-08-27 15:02:50 -04:00
|
|
|
// options to control how MicroPython is built
|
2016-08-19 23:24:04 -04:00
|
|
|
#define MICROPY_QSTR_BYTES_IN_HASH (1)
|
|
|
|
#define MICROPY_ALLOC_PATH_MAX (256)
|
|
|
|
#define MICROPY_ALLOC_PARSE_CHUNK_INIT (16)
|
2016-09-22 21:23:27 -04:00
|
|
|
// TODO(tannewt): Reduce this number if we want the REPL to function under 512
|
|
|
|
// free bytes.
|
|
|
|
// #define MICROPY_ALLOC_PARSE_RULE_INIT (64)
|
2018-01-09 20:41:41 -05:00
|
|
|
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
|
2016-08-19 23:24:04 -04:00
|
|
|
#define MICROPY_EMIT_X64 (0)
|
|
|
|
#define MICROPY_EMIT_THUMB (0)
|
|
|
|
#define MICROPY_EMIT_INLINE_THUMB (0)
|
2016-09-19 20:30:28 -04:00
|
|
|
#define MICROPY_COMP_MODULE_CONST (1)
|
|
|
|
#define MICROPY_COMP_CONST (1)
|
|
|
|
#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (1)
|
|
|
|
#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (1)
|
2018-01-09 20:41:41 -05:00
|
|
|
// Turn off for consistency
|
|
|
|
#define MICROPY_CPYTHON_COMPAT (0)
|
2016-08-19 23:24:04 -04:00
|
|
|
#define MICROPY_MEM_STATS (0)
|
|
|
|
#define MICROPY_DEBUG_PRINTERS (0)
|
|
|
|
#define MICROPY_ENABLE_GC (1)
|
|
|
|
#define MICROPY_GC_ALLOC_THRESHOLD (0)
|
|
|
|
#define MICROPY_REPL_EVENT_DRIVEN (0)
|
|
|
|
#define MICROPY_HELPER_REPL (1)
|
|
|
|
#define MICROPY_HELPER_LEXER_UNIX (0)
|
2016-09-20 18:16:52 -04:00
|
|
|
#define MICROPY_ENABLE_SOURCE_LINE (1)
|
2016-08-19 23:24:04 -04:00
|
|
|
#define MICROPY_ENABLE_DOC_STRING (0)
|
2016-09-21 18:13:37 -04:00
|
|
|
//#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
|
|
|
|
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
|
2016-08-19 23:24:04 -04:00
|
|
|
#define MICROPY_PY_ASYNC_AWAIT (0)
|
2016-09-02 20:00:30 -04:00
|
|
|
#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
|
2016-12-07 20:18:12 -05:00
|
|
|
#define MICROPY_PY_BUILTINS_ENUMERATE (1)
|
2017-06-20 13:56:05 -04:00
|
|
|
#define MICROPY_PY_BUILTINS_HELP (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_HELP_MODULES (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_HELP_TEXT circuitpython_help_text
|
|
|
|
#define MICROPY_PY_BUILTINS_INPUT (1)
|
2016-09-13 14:46:22 -04:00
|
|
|
#define MICROPY_PY_BUILTINS_FILTER (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_SET (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_SLICE (1)
|
2017-02-24 09:13:56 -05:00
|
|
|
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
|
2017-10-31 18:57:56 -04:00
|
|
|
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
|
2018-03-26 19:13:49 -04:00
|
|
|
#define MICROPY_NONSTANDARD_TYPECODES (0)
|
2016-09-13 14:46:22 -04:00
|
|
|
#define MICROPY_PY_BUILTINS_PROPERTY (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_MIN_MAX (1)
|
|
|
|
#define MICROPY_PY___FILE__ (1)
|
|
|
|
#define MICROPY_PY_GC (1)
|
2016-09-02 20:00:30 -04:00
|
|
|
#define MICROPY_PY_ARRAY (1)
|
|
|
|
#define MICROPY_PY_ATTRTUPLE (1)
|
2016-09-13 14:46:22 -04:00
|
|
|
#define MICROPY_PY_COLLECTIONS (1)
|
2016-11-03 18:50:59 -04:00
|
|
|
#define MICROPY_PY_DESCRIPTORS (1)
|
2017-10-20 15:21:41 -04:00
|
|
|
#define MICROPY_PY_MATH (0)
|
2016-10-31 15:18:39 -04:00
|
|
|
#define MICROPY_PY_CMATH (0)
|
2016-08-19 23:24:04 -04:00
|
|
|
#define MICROPY_PY_IO (0)
|
2017-06-27 20:37:24 -04:00
|
|
|
#define MICROPY_PY_URANDOM (0)
|
|
|
|
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (0)
|
2017-10-18 15:50:20 -04:00
|
|
|
#define MICROPY_PY_STRUCT (0)
|
2016-09-19 19:56:42 -04:00
|
|
|
#define MICROPY_PY_SYS (1)
|
2018-01-09 20:41:41 -05:00
|
|
|
#define MICROPY_PY_SYS_MAXSIZE (1)
|
2016-08-31 16:37:43 -04:00
|
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
|
2018-03-26 08:31:13 -04:00
|
|
|
#define MICROPY_FLOAT_HIGH_QUALITY_HASH (1)
|
2017-07-03 15:02:03 -04:00
|
|
|
#define MICROPY_STREAMS_NON_BLOCK (1)
|
2016-08-19 23:24:04 -04:00
|
|
|
|
2016-09-02 20:00:30 -04:00
|
|
|
// fatfs configuration used in ffconf.h
|
|
|
|
#define MICROPY_FATFS_ENABLE_LFN (1)
|
|
|
|
#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
|
|
|
|
#define MICROPY_FATFS_USE_LABEL (1)
|
|
|
|
#define MICROPY_FATFS_RPATH (2)
|
|
|
|
#define MICROPY_FATFS_VOLUMES (4)
|
|
|
|
#define MICROPY_FATFS_MULTI_PARTITION (1)
|
2017-01-12 15:33:15 -05:00
|
|
|
#define MICROPY_FATFS_NUM_PERSISTENT (1)
|
2016-10-21 18:23:26 -04:00
|
|
|
// Only enable this if you really need it. It allocates a byte cache of this
|
|
|
|
// size.
|
|
|
|
// #define MICROPY_FATFS_MAX_SS (4096)
|
2016-09-02 20:00:30 -04:00
|
|
|
|
2017-05-12 17:47:39 -04:00
|
|
|
#define FILESYSTEM_BLOCK_SIZE (512)
|
2016-10-13 17:53:31 -04:00
|
|
|
|
2017-06-20 13:56:05 -04:00
|
|
|
#define MICROPY_VFS (1)
|
2016-09-02 20:00:30 -04:00
|
|
|
#define MICROPY_VFS_FAT (1)
|
2016-08-24 20:38:08 -04:00
|
|
|
#define MICROPY_PY_MACHINE (1)
|
2016-12-19 19:38:35 -05:00
|
|
|
#define MICROPY_MODULE_WEAK_LINKS (0)
|
2016-08-24 20:38:08 -04:00
|
|
|
#define MICROPY_REPL_AUTO_INDENT (1)
|
2016-08-27 18:04:34 -04:00
|
|
|
#define MICROPY_HW_ENABLE_DAC (1)
|
|
|
|
#define MICROPY_ENABLE_FINALISER (1)
|
2016-09-19 19:56:42 -04:00
|
|
|
#define MICROPY_USE_INTERNAL_PRINTF (1)
|
2016-09-21 18:13:37 -04:00
|
|
|
#define MICROPY_PY_SYS_STDFILES (1)
|
|
|
|
#define MICROPY_PY_IO_FILEIO (1)
|
2017-06-20 13:56:05 -04:00
|
|
|
#define MICROPY_READER_VFS (1)
|
2016-09-26 18:43:52 -04:00
|
|
|
#define MICROPY_PERSISTENT_CODE_LOAD (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_STR_UNICODE (1)
|
2016-08-24 16:17:55 -04:00
|
|
|
|
2017-01-10 18:57:04 -05:00
|
|
|
#define MICROPY_KBD_EXCEPTION (1)
|
|
|
|
|
2016-08-19 23:24:04 -04:00
|
|
|
// type definitions for the specific machine
|
|
|
|
|
|
|
|
#define BYTES_PER_WORD (4)
|
|
|
|
|
|
|
|
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1))
|
|
|
|
|
2017-03-09 10:09:13 -05:00
|
|
|
#define MICROPY_STACK_CHECK (1)
|
|
|
|
|
2017-07-23 15:32:05 -04:00
|
|
|
// Track stack usage on a debug build. Expose results via ustack module.
|
|
|
|
#ifdef MICROPY_DEBUG_MODULES
|
|
|
|
#define MICROPY_MAX_STACK_USAGE (1)
|
|
|
|
#endif
|
|
|
|
|
2016-08-19 23:24:04 -04: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 MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
|
|
|
|
|
2018-07-28 13:29:47 -04:00
|
|
|
#define mp_type_fileio mp_type_vfs_fat_fileio
|
|
|
|
#define mp_type_textio mp_type_vfs_fat_textio
|
|
|
|
|
2017-06-20 13:56:05 -04:00
|
|
|
#define mp_import_stat mp_vfs_import_stat
|
|
|
|
#define mp_builtin_open_obj mp_vfs_open_obj
|
|
|
|
|
2016-09-02 20:00:30 -04:00
|
|
|
// extra built in names to add to the global namespace
|
|
|
|
#define MICROPY_PORT_BUILTINS \
|
2016-12-19 19:38:35 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \
|
2017-05-25 14:55:38 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
|
2016-09-02 20:00:30 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
|
|
|
|
|
2016-12-01 16:46:44 -05:00
|
|
|
// board specific definitions
|
|
|
|
#include "mpconfigboard.h"
|
2017-09-22 21:05:51 -04:00
|
|
|
#include "include/sam.h"
|
|
|
|
|
|
|
|
#ifdef SAMD21
|
|
|
|
#define CIRCUITPY_MCU_FAMILY samd21
|
2017-10-10 14:36:00 -04:00
|
|
|
#define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21"
|
|
|
|
#define PORT_HEAP_SIZE (16384 + 4096)
|
2018-05-18 06:31:23 -04:00
|
|
|
#endif
|
2017-09-22 21:05:51 -04:00
|
|
|
|
|
|
|
#ifdef SAMD51
|
|
|
|
#define CIRCUITPY_MCU_FAMILY samd51
|
2017-10-10 14:36:00 -04:00
|
|
|
#define MICROPY_PY_SYS_PLATFORM "MicroChip SAMD51"
|
|
|
|
#define PORT_HEAP_SIZE (0x20000) // 128KiB
|
2018-05-21 23:58:03 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef LONGINT_IMPL_NONE
|
|
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef LONGINT_IMPL_MPZ
|
|
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
2017-10-31 18:46:42 -04:00
|
|
|
#define MP_SSIZE_MAX (0x7fffffff)
|
2017-09-22 21:05:51 -04:00
|
|
|
#endif
|
2016-12-01 16:46:44 -05:00
|
|
|
|
2018-05-21 23:58:03 -04:00
|
|
|
#ifdef LONGINT_IMPL_LONGLONG
|
|
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
|
|
|
|
#endif
|
|
|
|
|
2016-08-24 16:17:55 -04:00
|
|
|
// extra built in modules to add to the list of known ones
|
2016-11-03 18:50:59 -04:00
|
|
|
extern const struct _mp_obj_module_t microcontroller_module;
|
2016-11-28 22:48:17 -05:00
|
|
|
extern const struct _mp_obj_module_t bitbangio_module;
|
2017-04-21 17:43:03 -04:00
|
|
|
extern const struct _mp_obj_module_t audioio_module;
|
2017-05-24 13:43:32 -04:00
|
|
|
extern const struct _mp_obj_module_t audiobusio_module;
|
2017-04-10 16:32:19 -04:00
|
|
|
extern const struct _mp_obj_module_t analogio_module;
|
|
|
|
extern const struct _mp_obj_module_t digitalio_module;
|
2018-08-15 14:01:01 -04:00
|
|
|
extern const struct _mp_obj_module_t displayio_module;
|
2017-04-10 16:32:19 -04:00
|
|
|
extern const struct _mp_obj_module_t pulseio_module;
|
|
|
|
extern const struct _mp_obj_module_t busio_module;
|
2016-11-03 18:50:59 -04:00
|
|
|
extern const struct _mp_obj_module_t board_module;
|
2018-08-02 08:52:27 -04:00
|
|
|
extern const struct _mp_obj_module_t i2cslave_module;
|
2017-10-20 15:21:41 -04:00
|
|
|
extern const struct _mp_obj_module_t math_module;
|
2017-06-27 18:17:30 -04:00
|
|
|
extern const struct _mp_obj_module_t os_module;
|
2017-06-27 20:37:24 -04:00
|
|
|
extern const struct _mp_obj_module_t random_module;
|
2018-05-25 21:39:16 -04:00
|
|
|
extern const struct _mp_obj_module_t rotaryio_module;
|
2018-04-07 09:10:39 -04:00
|
|
|
extern const struct _mp_obj_module_t rtc_module;
|
2018-05-04 07:13:44 -04:00
|
|
|
extern const struct _mp_obj_module_t samd_module;
|
2017-06-27 18:17:30 -04:00
|
|
|
extern const struct _mp_obj_module_t storage_module;
|
2017-10-18 15:50:20 -04:00
|
|
|
extern const struct _mp_obj_module_t struct_module;
|
2016-11-03 18:50:59 -04:00
|
|
|
extern const struct _mp_obj_module_t time_module;
|
2017-08-25 16:00:27 -04:00
|
|
|
extern const struct _mp_obj_module_t cpy_nvm_module;
|
2016-10-05 15:35:23 -04:00
|
|
|
extern const struct _mp_obj_module_t neopixel_write_module;
|
2016-11-22 20:32:28 -05:00
|
|
|
extern const struct _mp_obj_module_t uheap_module;
|
2017-07-23 15:32:05 -04:00
|
|
|
extern const struct _mp_obj_module_t ustack_module;
|
2017-11-15 17:44:14 -05:00
|
|
|
extern const struct _mp_obj_module_t supervisor_module;
|
2017-10-03 16:35:57 -04:00
|
|
|
extern const struct _mp_obj_module_t gamepad_module;
|
2018-01-29 15:24:46 -05:00
|
|
|
extern const struct _mp_obj_module_t stage_module;
|
2017-04-17 19:43:46 -04:00
|
|
|
extern const struct _mp_obj_module_t touchio_module;
|
2017-02-03 12:41:04 -05:00
|
|
|
extern const struct _mp_obj_module_t usb_hid_module;
|
2016-08-24 16:17:55 -04:00
|
|
|
|
2016-12-19 19:38:35 -05:00
|
|
|
// Internal flash size dependent settings.
|
2016-12-01 16:46:44 -05:00
|
|
|
#if BOARD_FLASH_SIZE > 192000
|
2017-05-20 14:02:37 -04:00
|
|
|
#define MICROPY_PY_BUILTINS_STR_CENTER (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_STR_PARTITION (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_FROZENSET (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (1)
|
|
|
|
#define MICROPY_PY_BUILTINS_REVERSED (1)
|
2018-05-14 14:54:16 -04:00
|
|
|
#define MICROPY_PY_UERRNO (1)
|
|
|
|
#define MICROPY_PY_UERRNO_ERRORCODE (0)
|
2017-05-20 14:02:37 -04:00
|
|
|
#define MICROPY_PY_URE (1)
|
2016-12-19 19:38:35 -05:00
|
|
|
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
|
2018-05-21 23:58:03 -04:00
|
|
|
#ifndef MICROPY_PY_FRAMEBUF
|
|
|
|
#define MICROPY_PY_FRAMEBUF (1)
|
|
|
|
#endif
|
2017-07-03 18:05:08 -04:00
|
|
|
|
|
|
|
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (1)
|
|
|
|
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
|
2017-10-03 16:35:57 -04:00
|
|
|
// Scan gamepad every 32ms
|
|
|
|
#define CIRCUITPY_GAMEPAD_TICKS 0x1f
|
2017-07-03 18:05:08 -04:00
|
|
|
|
2018-08-07 10:43:52 -04:00
|
|
|
#if defined(__SAMD51G19A__) || defined(__SAMD51G18A__) || defined(__SAMR21G18A__)
|
2018-03-12 19:09:13 -04:00
|
|
|
#define AUDIOBUSIO_MODULE
|
|
|
|
#else
|
|
|
|
#define AUDIOBUSIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_audiobusio), (mp_obj_t)&audiobusio_module },
|
|
|
|
#endif
|
|
|
|
|
2018-08-07 10:43:52 -04:00
|
|
|
#if defined(__SAMR21G18A__)
|
|
|
|
#define AUDIOIO_MODULE
|
|
|
|
#else
|
|
|
|
#define AUDIOIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_audioio), (mp_obj_t)&audioio_module },
|
|
|
|
#endif
|
|
|
|
|
2018-08-02 08:52:27 -04:00
|
|
|
#ifdef CIRCUITPY_I2CSLAVE
|
|
|
|
#define I2CSLAVE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_i2cslave), (mp_obj_t)&i2cslave_module },
|
|
|
|
#else
|
|
|
|
#define I2CSLAVE_MODULE
|
|
|
|
#endif
|
|
|
|
|
2018-08-15 14:01:01 -04:00
|
|
|
#ifdef CIRCUITPY_DISPLAYIO
|
|
|
|
#define DISPLAYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_displayio), (mp_obj_t)&displayio_module },
|
|
|
|
#else
|
|
|
|
#define DISPLAYIO_MODULE
|
|
|
|
#endif
|
|
|
|
|
2018-05-20 16:06:47 -04:00
|
|
|
#ifndef EXTRA_BUILTIN_MODULES
|
2018-02-08 19:03:05 -05:00
|
|
|
#define EXTRA_BUILTIN_MODULES \
|
2018-08-07 10:43:52 -04:00
|
|
|
AUDIOIO_MODULE \
|
2018-03-12 19:09:13 -04:00
|
|
|
AUDIOBUSIO_MODULE \
|
2018-03-11 07:52:31 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_bitbangio), (mp_obj_t)&bitbangio_module }, \
|
2018-08-15 14:01:01 -04:00
|
|
|
DISPLAYIO_MODULE \
|
2018-08-02 08:52:27 -04:00
|
|
|
I2CSLAVE_MODULE \
|
2018-05-25 21:39:16 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_rotaryio), (mp_obj_t)&rotaryio_module }, \
|
2018-03-11 07:52:31 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_gamepad),(mp_obj_t)&gamepad_module }
|
2018-05-20 16:06:47 -04:00
|
|
|
#endif
|
2016-12-20 19:39:32 -05:00
|
|
|
#define EXPRESS_BOARD
|
2018-03-12 19:09:13 -04:00
|
|
|
|
2016-12-01 16:46:44 -05:00
|
|
|
#else
|
2017-05-20 14:02:37 -04:00
|
|
|
#define MICROPY_PY_BUILTINS_REVERSED (0)
|
2016-12-19 19:38:35 -05:00
|
|
|
#define MICROPY_PY_MICROPYTHON_MEM_INFO (0)
|
2017-04-17 20:31:40 -04:00
|
|
|
#define MICROPY_PY_FRAMEBUF (0)
|
2018-05-20 16:06:47 -04:00
|
|
|
#ifndef EXTRA_BUILTIN_MODULES
|
2016-12-01 16:46:44 -05:00
|
|
|
#define EXTRA_BUILTIN_MODULES
|
2018-05-20 16:06:47 -04:00
|
|
|
#endif
|
2017-07-03 18:05:08 -04:00
|
|
|
|
2017-10-23 12:29:17 -04:00
|
|
|
#define MICROPY_PY_BUILTINS_COMPLEX (0)
|
|
|
|
|
2017-07-03 18:05:08 -04:00
|
|
|
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0)
|
2016-12-01 16:46:44 -05:00
|
|
|
#endif
|
|
|
|
|
2017-09-22 21:05:51 -04:00
|
|
|
// Disabled for now.
|
2018-01-29 15:24:46 -05:00
|
|
|
// { MP_OBJ_NEW_QSTR(MP_QSTR__stage), (mp_obj_t)&stage_module },
|
2017-09-22 21:05:51 -04:00
|
|
|
|
2018-05-02 13:18:14 -04:00
|
|
|
#ifdef SAMD21
|
|
|
|
#define TOUCHIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_touchio), (mp_obj_t)&touchio_module },
|
|
|
|
#endif
|
|
|
|
#ifdef SAMD51
|
|
|
|
#define TOUCHIO_MODULE
|
|
|
|
#endif
|
2017-09-22 21:05:51 -04:00
|
|
|
|
2018-05-24 13:28:03 -04:00
|
|
|
// A pIRKey has minimal I/O needs. Remove unneeded modules to make room
|
|
|
|
// for frozen modules. math is very large and is also removed.
|
|
|
|
#ifdef PIRKEY_M0
|
|
|
|
#define MICROPY_PORT_BUILTIN_MODULES \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_board), (mp_obj_t)&board_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_busio), (mp_obj_t)&busio_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_digitalio), (mp_obj_t)&digitalio_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_microcontroller), (mp_obj_t)µcontroller_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&os_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_pulseio), (mp_obj_t)&pulseio_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_random), (mp_obj_t)&random_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_storage), (mp_obj_t)&storage_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&struct_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_supervisor), (mp_obj_t)&supervisor_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_usb_hid),(mp_obj_t)&usb_hid_module },
|
|
|
|
#else
|
2016-08-24 16:17:55 -04:00
|
|
|
#define MICROPY_PORT_BUILTIN_MODULES \
|
2017-11-14 21:22:16 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_analogio), (mp_obj_t)&analogio_module }, \
|
2016-11-03 18:50:59 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_board), (mp_obj_t)&board_module }, \
|
2017-11-06 18:35:23 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_busio), (mp_obj_t)&busio_module }, \
|
2017-09-29 16:58:13 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_digitalio), (mp_obj_t)&digitalio_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_microcontroller), (mp_obj_t)µcontroller_module }, \
|
2017-10-10 19:56:59 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_neopixel_write),(mp_obj_t)&neopixel_write_module }, \
|
2017-10-10 14:36:00 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&os_module }, \
|
2018-02-09 03:22:29 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_pulseio), (mp_obj_t)&pulseio_module }, \
|
2017-10-10 14:36:00 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_random), (mp_obj_t)&random_module }, \
|
2018-04-07 09:10:39 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_rtc), (mp_obj_t)&rtc_module }, \
|
2018-05-04 07:13:44 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_samd),(mp_obj_t)&samd_module }, \
|
2017-11-22 23:07:21 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_storage), (mp_obj_t)&storage_module }, \
|
2017-10-18 15:50:20 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&struct_module }, \
|
2017-11-15 17:44:14 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_supervisor), (mp_obj_t)&supervisor_module }, \
|
2017-10-20 15:21:41 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_math), (mp_obj_t)&math_module }, \
|
2018-02-08 19:03:05 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_module }, \
|
2018-03-24 18:29:12 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_usb_hid),(mp_obj_t)&usb_hid_module }, \
|
2018-05-02 13:18:14 -04:00
|
|
|
TOUCHIO_MODULE \
|
2016-12-01 16:46:44 -05:00
|
|
|
EXTRA_BUILTIN_MODULES
|
2018-05-24 13:28:03 -04:00
|
|
|
#endif
|
2016-11-29 13:46:47 -05:00
|
|
|
|
|
|
|
#define MICROPY_PORT_BUILTIN_DEBUG_MODULES \
|
2017-07-23 15:32:05 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_uheap),(mp_obj_t)&uheap_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_ustack),(mp_obj_t)&ustack_module }
|
2016-08-24 16:17:55 -04:00
|
|
|
|
2018-06-01 14:01:09 -04:00
|
|
|
#define MICROPY_PY_UERRNO_LIST \
|
|
|
|
X(EPERM) \
|
|
|
|
X(ENOENT) \
|
|
|
|
X(EIO) \
|
|
|
|
X(EAGAIN) \
|
|
|
|
X(ENOMEM) \
|
|
|
|
X(EACCES) \
|
|
|
|
X(EEXIST) \
|
|
|
|
X(ENODEV) \
|
|
|
|
X(EISDIR) \
|
|
|
|
X(EINVAL) \
|
|
|
|
|
2016-08-19 23:24:04 -04:00
|
|
|
// We need to provide a declaration/definition of alloca()
|
|
|
|
#include <alloca.h>
|
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
#define MICROPY_MIN_USE_STDOUT (1)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __thumb__
|
|
|
|
#define MICROPY_MIN_USE_CORTEX_CPU (1)
|
2016-08-23 02:48:09 -04:00
|
|
|
#define MICROPY_MIN_USE_SAMD21_MCU (1)
|
2016-08-19 23:24:04 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define MP_STATE_PORT MP_STATE_VM
|
|
|
|
|
2018-06-15 19:16:21 -04:00
|
|
|
#include "peripherals/samd/dma.h"
|
2018-03-12 19:09:13 -04:00
|
|
|
|
2016-08-19 23:24:04 -04:00
|
|
|
#define MICROPY_PORT_ROOT_POINTERS \
|
2016-08-23 19:47:53 -04:00
|
|
|
const char *readline_hist[8]; \
|
2016-08-24 20:38:08 -04:00
|
|
|
vstr_t *repl_line; \
|
2018-03-12 19:09:13 -04:00
|
|
|
mp_obj_t playing_audio[AUDIO_DMA_CHANNEL_COUNT]; \
|
2018-04-07 09:10:39 -04:00
|
|
|
mp_obj_t rtc_time_source; \
|
2016-11-29 17:29:33 -05:00
|
|
|
FLASH_ROOT_POINTERS \
|
2018-05-24 05:25:21 -04:00
|
|
|
mp_obj_t gamepad_singleton; \
|
2016-08-23 20:36:29 -04:00
|
|
|
|
2017-05-10 21:21:02 -04:00
|
|
|
void run_background_tasks(void);
|
|
|
|
#define MICROPY_VM_HOOK_LOOP run_background_tasks();
|
|
|
|
#define MICROPY_VM_HOOK_RETURN run_background_tasks();
|
2016-11-29 17:58:37 -05:00
|
|
|
|
2017-05-12 19:45:38 -04:00
|
|
|
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
|
2017-06-28 17:51:46 -04:00
|
|
|
#define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt"
|
2017-05-12 19:45:38 -04:00
|
|
|
|
2018-07-25 08:06:30 -04:00
|
|
|
// TODO(tannewt): Make this 6k+ for any non-express M4 boards because they cache sectors on the
|
|
|
|
// stack.
|
2018-08-03 22:22:00 -04:00
|
|
|
#define CIRCUITPY_DEFAULT_STACK_SIZE 4096
|
2018-07-25 08:06:30 -04:00
|
|
|
|
2016-08-23 20:36:29 -04:00
|
|
|
#endif // __INCLUDED_MPCONFIGPORT_H
|