Paul Sokolovsky | b372bfc | 2014-01-03 17:15:53 +0200 | [diff] [blame] | 1 | // This file contains default configuration settings for MicroPython. |
| 2 | // You can override any of these options using mpconfigport.h file located |
| 3 | // in a directory of your port. |
| 4 | |
| 5 | #include <mpconfigport.h> |
| 6 | |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 7 | // Any options not explicitly set in mpconfigport.h will get default |
| 8 | // values below. |
| 9 | |
| 10 | /*****************************************************************************/ |
| 11 | /* Micro Python emitters */ |
| 12 | |
| 13 | // Whether to emit CPython byte codes (for debugging/testing) |
| 14 | // Enabling this overrides all other emitters |
| 15 | #ifndef MICROPY_EMIT_CPYTHON |
| 16 | #define MICROPY_EMIT_CPYTHON (0) |
| 17 | #endif |
| 18 | |
| 19 | // Whether to emit x64 native code |
| 20 | #ifndef MICROPY_EMIT_X64 |
| 21 | #define MICROPY_EMIT_X64 (0) |
| 22 | #endif |
| 23 | |
| 24 | // Whether to emit thumb native code |
| 25 | #ifndef MICROPY_EMIT_THUMB |
| 26 | #define MICROPY_EMIT_THUMB (0) |
| 27 | #endif |
| 28 | |
| 29 | // Whether to enable the thumb inline assembler |
| 30 | #ifndef MICROPY_EMIT_INLINE_THUMB |
| 31 | #define MICROPY_EMIT_INLINE_THUMB (0) |
| 32 | #endif |
| 33 | |
| 34 | /*****************************************************************************/ |
| 35 | /* Internal debugging stuff */ |
| 36 | |
| 37 | // Whether to collect memory allocation stats |
| 38 | #ifndef MICROPY_MEM_STATS |
| 39 | #define MICROPY_MEM_STATS (0) |
| 40 | #endif |
| 41 | |
Damien George | cbd2f74 | 2014-01-19 11:48:48 +0000 | [diff] [blame] | 42 | // Whether to build functions that print debugging info: |
Damien George | c596612 | 2014-02-15 16:10:44 +0000 | [diff] [blame] | 43 | // mp_token_show |
Damien George | cbd2f74 | 2014-01-19 11:48:48 +0000 | [diff] [blame] | 44 | // mp_byte_code_print |
| 45 | // mp_parse_node_print |
| 46 | #ifndef MICROPY_DEBUG_PRINTERS |
| 47 | #define MICROPY_DEBUG_PRINTERS (0) |
Damien George | d3ebe48 | 2014-01-07 15:20:33 +0000 | [diff] [blame] | 48 | #endif |
| 49 | |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 50 | /*****************************************************************************/ |
| 51 | /* Fine control over Python features */ |
| 52 | |
Damien George | d3ebe48 | 2014-01-07 15:20:33 +0000 | [diff] [blame] | 53 | // Whether to include the garbage collector |
| 54 | #ifndef MICROPY_ENABLE_GC |
| 55 | #define MICROPY_ENABLE_GC (0) |
| 56 | #endif |
| 57 | |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 58 | // Whether to include REPL helper function |
| 59 | #ifndef MICROPY_ENABLE_REPL_HELPERS |
| 60 | #define MICROPY_ENABLE_REPL_HELPERS (0) |
| 61 | #endif |
| 62 | |
Damien George | d3ebe48 | 2014-01-07 15:20:33 +0000 | [diff] [blame] | 63 | // Whether to include lexer helper function for unix |
| 64 | #ifndef MICROPY_ENABLE_LEXER_UNIX |
| 65 | #define MICROPY_ENABLE_LEXER_UNIX (0) |
| 66 | #endif |
| 67 | |
Paul Sokolovsky | 48b3572 | 2014-01-12 17:30:48 +0200 | [diff] [blame] | 68 | // Long int implementation |
| 69 | #define MICROPY_LONGINT_IMPL_NONE (0) |
| 70 | #define MICROPY_LONGINT_IMPL_LONGLONG (1) |
Damien George | 438c88d | 2014-02-22 19:25:23 +0000 | [diff] [blame] | 71 | #define MICROPY_LONGINT_IMPL_MPZ (2) |
Paul Sokolovsky | 48b3572 | 2014-01-12 17:30:48 +0200 | [diff] [blame] | 72 | |
| 73 | #ifndef MICROPY_LONGINT_IMPL |
| 74 | #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE) |
| 75 | #endif |
| 76 | |
| 77 | #if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_LONGLONG |
| 78 | typedef long long mp_longint_impl_t; |
| 79 | #endif |
| 80 | |
Damien George | 62ad189 | 2014-01-29 21:51:51 +0000 | [diff] [blame] | 81 | // Whether to include information in the byte code to determine source |
| 82 | // line number (increases RAM usage, but doesn't slow byte code execution) |
| 83 | #ifndef MICROPY_ENABLE_SOURCE_LINE |
| 84 | #define MICROPY_ENABLE_SOURCE_LINE (0) |
| 85 | #endif |
| 86 | |
Damien George | 0c36da0 | 2014-03-08 15:24:39 +0000 | [diff] [blame] | 87 | // Float and complex implementation |
| 88 | #define MICROPY_FLOAT_IMPL_NONE (0) |
| 89 | #define MICROPY_FLOAT_IMPL_FLOAT (1) |
| 90 | #define MICROPY_FLOAT_IMPL_DOUBLE (2) |
| 91 | |
| 92 | #ifndef MICROPY_FLOAT_IMPL |
| 93 | #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE) |
| 94 | #endif |
| 95 | |
| 96 | #if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT |
| 97 | #define MICROPY_ENABLE_FLOAT (1) |
| 98 | #define MICROPY_FLOAT_C_FUN(fun) fun##f |
| 99 | typedef float mp_float_t; |
| 100 | #elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE |
| 101 | #define MICROPY_ENABLE_FLOAT (1) |
| 102 | #define MICROPY_FLOAT_C_FUN(fun) fun |
| 103 | typedef double mp_float_t; |
| 104 | #else |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 105 | #define MICROPY_ENABLE_FLOAT (0) |
| 106 | #endif |
| 107 | |
| 108 | // Whether to support slice object and correspondingly |
| 109 | // slice subscript operators |
| 110 | #ifndef MICROPY_ENABLE_SLICE |
| 111 | #define MICROPY_ENABLE_SLICE (1) |
| 112 | #endif |
| 113 | |
Paul Sokolovsky | dcac880 | 2014-01-16 19:19:50 +0200 | [diff] [blame] | 114 | // Enable features which improve CPython compatibility |
| 115 | // but may lead to more code size/memory usage. |
| 116 | // TODO: Originally intended as generic category to not |
| 117 | // add bunch of once-off options. May need refactoring later |
| 118 | #ifndef MICROPY_CPYTHON_COMPAT |
| 119 | #define MICROPY_CPYTHON_COMPAT (1) |
| 120 | #endif |
| 121 | |
Damien George | 354d15a | 2014-02-06 21:11:19 +0000 | [diff] [blame] | 122 | // Maximum length of a path in the filesystem |
| 123 | // So we can allocate a buffer on the stack for path manipulation in import |
| 124 | #ifndef MICROPY_PATH_MAX |
| 125 | #define MICROPY_PATH_MAX (512) |
| 126 | #endif |
| 127 | |
Damien George | caac542 | 2014-03-25 14:18:18 +0000 | [diff] [blame] | 128 | // Additional builtin function definitions - see builtintables.c:builtin_object_table for format. |
Paul Sokolovsky | 910843e | 2014-02-14 12:02:34 +0200 | [diff] [blame] | 129 | #ifndef MICROPY_EXTRA_BUILTINS |
| 130 | #define MICROPY_EXTRA_BUILTINS |
| 131 | #endif |
Damien George | caac542 | 2014-03-25 14:18:18 +0000 | [diff] [blame] | 132 | |
| 133 | // Additional builtin module definitions - see builtintables.c:builtin_module_table for format. |
| 134 | #ifndef MICROPY_EXTRA_BUILTIN_MODULES |
| 135 | #define MICROPY_EXTRA_BUILTIN_MODULES |
| 136 | #endif |
| 137 | |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 138 | /*****************************************************************************/ |
| 139 | /* Miscellaneous settings */ |
| 140 | |
Paul Sokolovsky | d5df6cd | 2014-02-12 18:15:40 +0200 | [diff] [blame] | 141 | // Allow to override static modifier for global objects, e.g. to use with |
| 142 | // object code analysis tools which don't support static symbols. |
| 143 | #ifndef STATIC |
| 144 | #define STATIC static |
| 145 | #endif |
| 146 | |
Paul Sokolovsky | fc5aac8 | 2014-01-12 16:10:19 +0200 | [diff] [blame] | 147 | #define BITS_PER_BYTE (8) |
| 148 | #define BITS_PER_WORD (BITS_PER_BYTE * BYTES_PER_WORD) |
Paul Sokolovsky | c260bc5 | 2014-01-12 16:15:47 +0200 | [diff] [blame] | 149 | // machine_int_t value with most significant bit set |
Damien George | 2300537 | 2014-01-13 19:39:01 +0000 | [diff] [blame] | 150 | #define WORD_MSBIT_HIGH (((machine_uint_t)1) << (BYTES_PER_WORD * 8 - 1)) |
Paul Sokolovsky | fc5aac8 | 2014-01-12 16:10:19 +0200 | [diff] [blame] | 151 | |
Paul Sokolovsky | c90c0f6 | 2014-01-04 01:57:00 +0200 | [diff] [blame] | 152 | // printf format spec to use for machine_int_t and friends |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 153 | #ifndef INT_FMT |
Paul Sokolovsky | c90c0f6 | 2014-01-04 01:57:00 +0200 | [diff] [blame] | 154 | #ifdef __LP64__ |
| 155 | // Archs where machine_int_t == long, long != int |
| 156 | #define UINT_FMT "%lu" |
| 157 | #define INT_FMT "%ld" |
| 158 | #else |
| 159 | // Archs where machine_int_t == int |
| 160 | #define UINT_FMT "%u" |
| 161 | #define INT_FMT "%d" |
| 162 | #endif |
| 163 | #endif //INT_FMT |