2015-03-28 21:45:40 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the Micro Python project, http://micropython.org/
|
|
|
|
*
|
|
|
|
* The MIT License (MIT)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2015 Damien P. George
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_B)
|
|
|
|
#define MICROPY_ALLOC_PATH_MAX (64)
|
|
|
|
#define MICROPY_EMIT_X64 (0)
|
|
|
|
#define MICROPY_EMIT_THUMB (0)
|
|
|
|
#define MICROPY_EMIT_INLINE_THUMB (0)
|
|
|
|
#define MICROPY_COMP_MODULE_CONST (0)
|
|
|
|
#define MICROPY_COMP_CONST (0)
|
|
|
|
#define MICROPY_MEM_STATS (0)
|
|
|
|
#define MICROPY_DEBUG_PRINTERS (0)
|
|
|
|
#define MICROPY_ENABLE_GC (1)
|
|
|
|
#define MICROPY_REPL_EVENT_DRIVEN (0)
|
|
|
|
#define MICROPY_HELPER_REPL (1)
|
|
|
|
#define MICROPY_HELPER_LEXER_UNIX (0)
|
|
|
|
#define MICROPY_ENABLE_SOURCE_LINE (0)
|
|
|
|
#define MICROPY_ENABLE_DOC_STRING (0)
|
|
|
|
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
|
2016-04-13 15:31:30 +01:00
|
|
|
#define MICROPY_PY_ASYNC_AWAIT (0)
|
2015-03-28 21:45:40 +00:00
|
|
|
#define MICROPY_PY_BUILTINS_BYTEARRAY (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_SET (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_SLICE (0)
|
|
|
|
#define MICROPY_PY_BUILTINS_PROPERTY (0)
|
|
|
|
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
|
|
|
|
#define MICROPY_PY___FILE__ (0)
|
|
|
|
#define MICROPY_PY_GC (1)
|
|
|
|
#define MICROPY_PY_ARRAY (0)
|
|
|
|
#define MICROPY_PY_COLLECTIONS (0)
|
|
|
|
#define MICROPY_PY_MATH (0)
|
|
|
|
#define MICROPY_PY_CMATH (0)
|
|
|
|
#define MICROPY_PY_IO (0)
|
|
|
|
#define MICROPY_PY_STRUCT (0)
|
|
|
|
#define MICROPY_PY_SYS (0)
|
|
|
|
#define MICROPY_CPYTHON_COMPAT (0)
|
|
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
|
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
|
2015-11-26 21:10:52 +00:00
|
|
|
#define MICROPY_NO_ALLOCA (1)
|
2015-03-28 21:45:40 +00:00
|
|
|
|
|
|
|
// type definitions for the specific machine
|
|
|
|
|
|
|
|
#define MP_ENDIANNESS_LITTLE (1)
|
|
|
|
#define BYTES_PER_WORD (2)
|
|
|
|
#define MPZ_DIG_SIZE (8)
|
|
|
|
|
|
|
|
// The xc16 compiler doesn't seem to respect alignment (!!) so we
|
|
|
|
// need to use instead an object representation that allows for
|
|
|
|
// 2-byte aligned pointers (see config setting above).
|
|
|
|
//#define MICROPY_OBJ_BASE_ALIGNMENT __attribute__((aligned(4)))
|
|
|
|
|
|
|
|
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p)))
|
|
|
|
|
|
|
|
#define UINT_FMT "%u"
|
|
|
|
#define INT_FMT "%d"
|
|
|
|
typedef int mp_int_t; // must be pointer size
|
|
|
|
typedef unsigned int mp_uint_t; // must be pointer size
|
|
|
|
|
|
|
|
typedef void *machine_ptr_t; // must be pointer size
|
|
|
|
typedef const void *machine_const_ptr_t; // must be pointer size
|
|
|
|
typedef int mp_off_t;
|
|
|
|
|
2015-04-09 23:56:15 +01:00
|
|
|
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
|
|
|
|
|
2015-03-28 21:45:40 +00:00
|
|
|
// extra builtin 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 builtin modules to add to the list of known ones
|
|
|
|
extern const struct _mp_obj_module_t pyb_module;
|
|
|
|
#define MICROPY_PORT_BUILTIN_MODULES \
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \
|
|
|
|
|
|
|
|
#define MP_STATE_PORT MP_STATE_VM
|
|
|
|
|
|
|
|
#define MICROPY_PORT_ROOT_POINTERS \
|
|
|
|
char *readline_hist[8]; \
|
|
|
|
mp_obj_t keyboard_interrupt_obj; \
|
|
|
|
|
2015-10-30 23:03:58 +00:00
|
|
|
#define MICROPY_MPHALPORT_H "pic16bit_mphal.h"
|
2015-03-28 21:45:40 +00:00
|
|
|
#define MICROPY_HW_BOARD_NAME "dsPICSK"
|
|
|
|
#define MICROPY_HW_MCU_NAME "dsPIC33"
|
2016-01-16 21:07:26 +00:00
|
|
|
|
|
|
|
// XC16 toolchain doesn't seem to define these
|
|
|
|
typedef int intptr_t;
|
|
|
|
typedef unsigned int uintptr_t;
|