mpconfigport.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * This file is part of the MicroPython project, http://micropython.org/
  3. *
  4. * The MIT License (MIT)
  5. *
  6. * Copyright (c) 2015 Damien P. George
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documentation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in
  16. * all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. * THE SOFTWARE.
  25. */
  26. #include <stdint.h>
  27. // options to control how MicroPython is built
  28. #define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_B)
  29. #define MICROPY_ALLOC_PATH_MAX (64)
  30. #define MICROPY_EMIT_X64 (0)
  31. #define MICROPY_EMIT_THUMB (0)
  32. #define MICROPY_EMIT_INLINE_THUMB (0)
  33. #define MICROPY_COMP_MODULE_CONST (0)
  34. #define MICROPY_COMP_CONST (0)
  35. #define MICROPY_MEM_STATS (0)
  36. #define MICROPY_DEBUG_PRINTERS (0)
  37. #define MICROPY_ENABLE_GC (1)
  38. #define MICROPY_REPL_EVENT_DRIVEN (0)
  39. #define MICROPY_HELPER_REPL (1)
  40. #define MICROPY_HELPER_LEXER_UNIX (0)
  41. #define MICROPY_ENABLE_SOURCE_LINE (0)
  42. #define MICROPY_ENABLE_DOC_STRING (0)
  43. #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
  44. #define MICROPY_PY_ASYNC_AWAIT (0)
  45. #define MICROPY_PY_BUILTINS_BYTEARRAY (0)
  46. #define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
  47. #define MICROPY_PY_BUILTINS_FROZENSET (0)
  48. #define MICROPY_PY_BUILTINS_SET (0)
  49. #define MICROPY_PY_BUILTINS_SLICE (0)
  50. #define MICROPY_PY_BUILTINS_PROPERTY (0)
  51. #define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
  52. #define MICROPY_PY___FILE__ (0)
  53. #define MICROPY_PY_GC (1)
  54. #define MICROPY_PY_ARRAY (0)
  55. #define MICROPY_PY_COLLECTIONS (0)
  56. #define MICROPY_PY_MATH (0)
  57. #define MICROPY_PY_CMATH (0)
  58. #define MICROPY_PY_IO (0)
  59. #define MICROPY_PY_STRUCT (0)
  60. #define MICROPY_PY_SYS (0)
  61. #define MICROPY_CPYTHON_COMPAT (0)
  62. #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
  63. #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
  64. #define MICROPY_NO_ALLOCA (1)
  65. // type definitions for the specific machine
  66. #define MP_ENDIANNESS_LITTLE (1)
  67. #define MPZ_DIG_SIZE (8)
  68. // The xc16 compiler doesn't seem to respect alignment (!!) so we
  69. // need to use instead an object representation that allows for
  70. // 2-byte aligned pointers (see config setting above).
  71. //#define MICROPY_OBJ_BASE_ALIGNMENT __attribute__((aligned(4)))
  72. #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p)))
  73. #define UINT_FMT "%u"
  74. #define INT_FMT "%d"
  75. typedef int mp_int_t; // must be pointer size
  76. typedef unsigned int mp_uint_t; // must be pointer size
  77. typedef int mp_off_t;
  78. #define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
  79. // extra builtin names to add to the global namespace
  80. #define MICROPY_PORT_BUILTINS \
  81. { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
  82. // extra builtin modules to add to the list of known ones
  83. extern const struct _mp_obj_module_t pyb_module;
  84. #define MICROPY_PORT_BUILTIN_MODULES \
  85. { MP_ROM_QSTR(MP_QSTR_pyb), MP_ROM_PTR(&pyb_module) }, \
  86. #define MP_STATE_PORT MP_STATE_VM
  87. #define MICROPY_PORT_ROOT_POINTERS \
  88. char *readline_hist[8]; \
  89. mp_obj_t keyboard_interrupt_obj; \
  90. #define MICROPY_MPHALPORT_H "pic16bit_mphal.h"
  91. #define MICROPY_HW_BOARD_NAME "dsPICSK"
  92. #define MICROPY_HW_MCU_NAME "dsPIC33"
  93. // XC16 toolchain doesn't seem to define these
  94. typedef int intptr_t;
  95. typedef unsigned int uintptr_t;