Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 1 | /* |
Alexander Steffen | 55f3324 | 2017-06-30 09:22:17 +0200 | [diff] [blame^] | 2 | * This file is part of the MicroPython project, http://micropython.org/ |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 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 | |
Alexander Steffen | 55f3324 | 2017-06-30 09:22:17 +0200 | [diff] [blame^] | 27 | // options to control how MicroPython is built |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 28 | |
Paul Sokolovsky | d83177b | 2016-07-03 00:12:46 +0300 | [diff] [blame] | 29 | #define MICROPY_ALLOC_QSTR_CHUNK_INIT (64) |
| 30 | #define MICROPY_ALLOC_PARSE_RULE_INIT (8) |
| 31 | #define MICROPY_ALLOC_PARSE_RULE_INC (8) |
| 32 | #define MICROPY_ALLOC_PARSE_RESULT_INIT (8) |
| 33 | #define MICROPY_ALLOC_PARSE_RESULT_INC (8) |
| 34 | #define MICROPY_ALLOC_PARSE_CHUNK_INIT (64) |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 35 | #define MICROPY_ALLOC_PATH_MAX (PATH_MAX) |
| 36 | #define MICROPY_ENABLE_GC (1) |
Paul Sokolovsky | 6881590 | 2016-07-21 00:37:53 +0300 | [diff] [blame] | 37 | #define MICROPY_GC_ALLOC_THRESHOLD (0) |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 38 | #define MICROPY_ENABLE_FINALISER (0) |
| 39 | #define MICROPY_STACK_CHECK (0) |
| 40 | #define MICROPY_COMP_CONST (0) |
| 41 | #define MICROPY_MEM_STATS (0) |
| 42 | #define MICROPY_DEBUG_PRINTERS (0) |
Damien George | 143fa0f | 2017-01-27 13:32:15 +1100 | [diff] [blame] | 43 | #define MICROPY_READER_POSIX (1) |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 44 | #define MICROPY_HELPER_REPL (1) |
| 45 | #define MICROPY_HELPER_LEXER_UNIX (1) |
| 46 | #define MICROPY_ENABLE_SOURCE_LINE (0) |
| 47 | #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE) |
| 48 | #define MICROPY_WARNINGS (0) |
Paul Sokolovsky | b5190f1 | 2016-06-16 01:20:32 +0300 | [diff] [blame] | 49 | #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (0) |
Damien George | 6c564aa | 2017-04-10 17:17:22 +1000 | [diff] [blame] | 50 | #define MICROPY_KBD_EXCEPTION (1) |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 51 | #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE) |
| 52 | #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE) |
| 53 | #define MICROPY_STREAMS_NON_BLOCK (0) |
| 54 | #define MICROPY_OPT_COMPUTED_GOTO (0) |
| 55 | #define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (0) |
| 56 | #define MICROPY_CAN_OVERRIDE_BUILTINS (0) |
Damien George | 06593fb | 2015-06-19 12:49:10 +0000 | [diff] [blame] | 57 | #define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0) |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 58 | #define MICROPY_CPYTHON_COMPAT (0) |
| 59 | #define MICROPY_PY_BUILTINS_BYTEARRAY (0) |
| 60 | #define MICROPY_PY_BUILTINS_MEMORYVIEW (0) |
| 61 | #define MICROPY_PY_BUILTINS_COMPILE (0) |
Paul Sokolovsky | e2d44e3 | 2015-04-06 23:50:37 +0300 | [diff] [blame] | 62 | #define MICROPY_PY_BUILTINS_ENUMERATE (0) |
Paul Sokolovsky | 22ff397 | 2015-08-20 01:01:56 +0300 | [diff] [blame] | 63 | #define MICROPY_PY_BUILTINS_FILTER (0) |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 64 | #define MICROPY_PY_BUILTINS_FROZENSET (0) |
Paul Sokolovsky | 282ca09 | 2015-04-07 00:16:51 +0300 | [diff] [blame] | 65 | #define MICROPY_PY_BUILTINS_REVERSED (0) |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 66 | #define MICROPY_PY_BUILTINS_SET (0) |
| 67 | #define MICROPY_PY_BUILTINS_SLICE (0) |
| 68 | #define MICROPY_PY_BUILTINS_STR_UNICODE (0) |
| 69 | #define MICROPY_PY_BUILTINS_PROPERTY (0) |
pohmelie | 354e688 | 2015-12-07 15:35:48 +0300 | [diff] [blame] | 70 | #define MICROPY_PY_BUILTINS_MIN_MAX (0) |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 71 | #define MICROPY_PY___FILE__ (0) |
| 72 | #define MICROPY_PY_MICROPYTHON_MEM_INFO (0) |
| 73 | #define MICROPY_PY_GC (0) |
| 74 | #define MICROPY_PY_GC_COLLECT_RETVAL (0) |
| 75 | #define MICROPY_PY_ARRAY (0) |
| 76 | #define MICROPY_PY_COLLECTIONS (0) |
| 77 | #define MICROPY_PY_MATH (0) |
| 78 | #define MICROPY_PY_CMATH (0) |
| 79 | #define MICROPY_PY_IO (0) |
| 80 | #define MICROPY_PY_IO_FILEIO (0) |
| 81 | #define MICROPY_PY_STRUCT (0) |
| 82 | #define MICROPY_PY_SYS (1) |
| 83 | #define MICROPY_PY_SYS_EXIT (0) |
| 84 | #define MICROPY_PY_SYS_PLATFORM "linux" |
| 85 | #define MICROPY_PY_SYS_MAXSIZE (0) |
| 86 | #define MICROPY_PY_SYS_STDFILES (0) |
| 87 | #define MICROPY_PY_CMATH (0) |
| 88 | #define MICROPY_PY_UCTYPES (0) |
Paul Sokolovsky | 6f8880d | 2016-06-17 23:35:00 +0300 | [diff] [blame] | 89 | #define MICROPY_PY_UTIME (0) |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 90 | #define MICROPY_PY_UZLIB (0) |
| 91 | #define MICROPY_PY_UJSON (0) |
| 92 | #define MICROPY_PY_URE (0) |
| 93 | #define MICROPY_PY_UHEAPQ (0) |
| 94 | #define MICROPY_PY_UHASHLIB (0) |
| 95 | #define MICROPY_PY_UBINASCII (0) |
| 96 | |
Paul Sokolovsky | b5190f1 | 2016-06-16 01:20:32 +0300 | [diff] [blame] | 97 | extern const struct _mp_obj_module_t mp_module_os; |
| 98 | |
| 99 | #define MICROPY_PORT_BUILTIN_MODULES \ |
| 100 | { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&mp_module_os }, \ |
| 101 | |
| 102 | #define MICROPY_PORT_ROOT_POINTERS \ |
Paul Sokolovsky | b5190f1 | 2016-06-16 01:20:32 +0300 | [diff] [blame] | 103 | |
| 104 | ////////////////////////////////////////// |
| 105 | // Do not change anything beyond this line |
| 106 | ////////////////////////////////////////// |
| 107 | |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 108 | // Define to 1 to use undertested inefficient GC helper implementation |
| 109 | // (if more efficient arch-specific one is not available). |
| 110 | #ifndef MICROPY_GCREGS_SETJMP |
| 111 | #ifdef __mips__ |
| 112 | #define MICROPY_GCREGS_SETJMP (1) |
| 113 | #else |
| 114 | #define MICROPY_GCREGS_SETJMP (0) |
| 115 | #endif |
| 116 | #endif |
| 117 | |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 118 | // type definitions for the specific machine |
| 119 | |
| 120 | #ifdef __LP64__ |
| 121 | typedef long mp_int_t; // must be pointer size |
| 122 | typedef unsigned long mp_uint_t; // must be pointer size |
| 123 | #else |
| 124 | // These are definitions for machines where sizeof(int) == sizeof(void*), |
| 125 | // regardless for actual size. |
| 126 | typedef int mp_int_t; // must be pointer size |
| 127 | typedef unsigned int mp_uint_t; // must be pointer size |
| 128 | #endif |
| 129 | |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 130 | // Cannot include <sys/types.h>, as it may lead to symbol name clashes |
| 131 | #if _FILE_OFFSET_BITS == 64 && !defined(__LP64__) |
| 132 | typedef long long mp_off_t; |
| 133 | #else |
| 134 | typedef long mp_off_t; |
| 135 | #endif |
| 136 | |
Damien George | 3926c72 | 2015-01-11 17:28:27 +0000 | [diff] [blame] | 137 | // We need to provide a declaration/definition of alloca() |
| 138 | #ifdef __FreeBSD__ |
| 139 | #include <stdlib.h> |
| 140 | #else |
| 141 | #include <alloca.h> |
| 142 | #endif |