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-09-02 20:00:30 -04:00
|
|
|
#define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21"
|
|
|
|
|
2016-12-19 19:38:35 -05:00
|
|
|
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
|
|
|
|
|
2016-08-19 23:24:04 -04:00
|
|
|
// options to control how Micro Python is built
|
|
|
|
|
|
|
|
#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)
|
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)
|
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_BUILTIN_METHOD_CHECK_SELF_ARG (0)
|
|
|
|
#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)
|
2016-09-13 14:46:22 -04:00
|
|
|
#define MICROPY_PY_BUILTINS_FILTER (1)
|
2016-08-19 23:24:04 -04:00
|
|
|
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_REVERSED (0)
|
2016-09-13 14:46:22 -04:00
|
|
|
#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)
|
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)
|
2016-09-13 14:46:22 -04:00
|
|
|
#define MICROPY_PY_MATH (1)
|
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)
|
2016-10-20 02:41:21 -04:00
|
|
|
#define MICROPY_PY_URANDOM (1)
|
|
|
|
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
|
2016-09-13 14:46:22 -04:00
|
|
|
#define MICROPY_PY_STRUCT (1)
|
2016-09-19 19:56:42 -04:00
|
|
|
#define MICROPY_PY_SYS (1)
|
2016-08-19 23:24:04 -04:00
|
|
|
#define MICROPY_CPYTHON_COMPAT (0)
|
|
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
|
2016-08-31 16:37:43 -04:00
|
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
|
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-09-02 20:00:30 -04:00
|
|
|
#define MICROPY_FSUSERMOUNT (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
|
|
|
|
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-01-10 18:57:04 -05:00
|
|
|
#define MICROPY_READER_FATFS (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)
|
|
|
|
|
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)
|
|
|
|
|
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 }, \
|
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"
|
|
|
|
|
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-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;
|
|
|
|
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;
|
2016-09-02 20:00:30 -04:00
|
|
|
extern const struct _mp_obj_module_t uos_module;
|
2016-11-03 18:50:59 -04:00
|
|
|
extern const struct _mp_obj_module_t time_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;
|
2016-12-13 21:04:50 -05:00
|
|
|
extern const struct _mp_obj_module_t samd_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
|
2016-12-19 19:38:35 -05:00
|
|
|
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
|
2017-04-17 20:31:40 -04:00
|
|
|
#define MICROPY_PY_FRAMEBUF (1)
|
2016-12-01 16:46:44 -05:00
|
|
|
#define EXTRA_BUILTIN_MODULES \
|
2017-04-21 17:43:03 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_audioio), (mp_obj_t)&audioio_module }, \
|
2017-04-17 19:43:46 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_pulseio), (mp_obj_t)&pulseio_module }, \
|
2016-12-01 16:46:44 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_bitbangio), (mp_obj_t)&bitbangio_module }
|
2016-12-20 19:39:32 -05:00
|
|
|
#define EXPRESS_BOARD
|
2016-12-01 16:46:44 -05:00
|
|
|
#else
|
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)
|
2016-12-01 16:46:44 -05:00
|
|
|
#define EXTRA_BUILTIN_MODULES
|
|
|
|
#endif
|
|
|
|
|
2016-08-24 16:17:55 -04:00
|
|
|
#define MICROPY_PORT_BUILTIN_MODULES \
|
2017-04-17 19:43:46 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_touchio), (mp_obj_t)&touchio_module }, \
|
2016-11-03 18:50:59 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_microcontroller), (mp_obj_t)µcontroller_module }, \
|
2017-04-10 16:32:19 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_analogio), (mp_obj_t)&analogio_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_digitalio), (mp_obj_t)&digitalio_module }, \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_busio), (mp_obj_t)&busio_module }, \
|
2016-11-03 18:50:59 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_board), (mp_obj_t)&board_module }, \
|
2016-09-02 20:00:30 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&uos_module }, \
|
2016-11-03 18:50:59 -04:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_module }, \
|
2016-12-01 16:46:44 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_neopixel_write),(mp_obj_t)&neopixel_write_module }, \
|
2016-12-13 21:04:50 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_samd),(mp_obj_t)&samd_module }, \
|
2017-02-03 12:41:04 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_usb_hid),(mp_obj_t)&usb_hid_module }, \
|
2016-12-01 16:46:44 -05:00
|
|
|
EXTRA_BUILTIN_MODULES
|
2016-11-29 13:46:47 -05:00
|
|
|
|
|
|
|
#define MICROPY_PORT_BUILTIN_DEBUG_MODULES \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_uheap),(mp_obj_t)&uheap_module }
|
2016-08-24 16:17:55 -04:00
|
|
|
|
2016-08-24 20:38:08 -04:00
|
|
|
#ifndef MICROPY_PIN_DEFS_PORT_H
|
|
|
|
#define MICROPY_PIN_DEFS_PORT_H "pins.h"
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
|
|
|
|
#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; \
|
2017-05-04 14:57:51 -04:00
|
|
|
struct tc_module* audioout_tc_instance; \
|
|
|
|
struct dac_module* audioout_dac_instance; \
|
|
|
|
struct events_resource* audioout_tc_event; \
|
|
|
|
struct events_resource* audioout_dac_event; \
|
|
|
|
struct tc_module* pulseout_tc_instance; \
|
2016-11-29 17:29:33 -05:00
|
|
|
FLASH_ROOT_POINTERS \
|
2016-08-23 20:36:29 -04:00
|
|
|
|
2016-11-29 17:58:37 -05:00
|
|
|
bool udi_msc_process_trans(void);
|
|
|
|
#define MICROPY_VM_HOOK_LOOP udi_msc_process_trans();
|
|
|
|
#define MICROPY_VM_HOOK_RETURN udi_msc_process_trans();
|
|
|
|
|
2017-05-12 19:45:38 -04:00
|
|
|
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
|
2017-05-12 21:26:14 -04:00
|
|
|
#define CIRCUITPY_BOOT_OUTPUT_FILE "/flash/boot_out.txt"
|
2017-05-12 19:45:38 -04:00
|
|
|
|
2016-08-23 20:36:29 -04:00
|
|
|
#endif // __INCLUDED_MPCONFIGPORT_H
|