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: |
| 43 | // mp_byte_code_print |
| 44 | // mp_parse_node_print |
| 45 | #ifndef MICROPY_DEBUG_PRINTERS |
| 46 | #define MICROPY_DEBUG_PRINTERS (0) |
Damien George | d3ebe48 | 2014-01-07 15:20:33 +0000 | [diff] [blame] | 47 | #endif |
| 48 | |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 49 | /*****************************************************************************/ |
| 50 | /* Fine control over Python features */ |
| 51 | |
Damien George | d3ebe48 | 2014-01-07 15:20:33 +0000 | [diff] [blame] | 52 | // Whether to include the garbage collector |
| 53 | #ifndef MICROPY_ENABLE_GC |
| 54 | #define MICROPY_ENABLE_GC (0) |
| 55 | #endif |
| 56 | |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 57 | // Whether to include REPL helper function |
| 58 | #ifndef MICROPY_ENABLE_REPL_HELPERS |
| 59 | #define MICROPY_ENABLE_REPL_HELPERS (0) |
| 60 | #endif |
| 61 | |
Damien George | d3ebe48 | 2014-01-07 15:20:33 +0000 | [diff] [blame] | 62 | // Whether to include lexer helper function for unix |
| 63 | #ifndef MICROPY_ENABLE_LEXER_UNIX |
| 64 | #define MICROPY_ENABLE_LEXER_UNIX (0) |
| 65 | #endif |
| 66 | |
Paul Sokolovsky | 48b3572 | 2014-01-12 17:30:48 +0200 | [diff] [blame] | 67 | // Long int implementation |
| 68 | #define MICROPY_LONGINT_IMPL_NONE (0) |
| 69 | #define MICROPY_LONGINT_IMPL_LONGLONG (1) |
| 70 | |
| 71 | #ifndef MICROPY_LONGINT_IMPL |
| 72 | #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE) |
| 73 | #endif |
| 74 | |
| 75 | #if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_LONGLONG |
| 76 | typedef long long mp_longint_impl_t; |
| 77 | #endif |
| 78 | |
Damien George | 62ad189 | 2014-01-29 21:51:51 +0000 | [diff] [blame^] | 79 | // Whether to include information in the byte code to determine source |
| 80 | // line number (increases RAM usage, but doesn't slow byte code execution) |
| 81 | #ifndef MICROPY_ENABLE_SOURCE_LINE |
| 82 | #define MICROPY_ENABLE_SOURCE_LINE (0) |
| 83 | #endif |
| 84 | |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 85 | // Whether to support float and complex types |
| 86 | #ifndef MICROPY_ENABLE_FLOAT |
| 87 | #define MICROPY_ENABLE_FLOAT (0) |
| 88 | #endif |
| 89 | |
| 90 | // Whether to support slice object and correspondingly |
| 91 | // slice subscript operators |
| 92 | #ifndef MICROPY_ENABLE_SLICE |
| 93 | #define MICROPY_ENABLE_SLICE (1) |
| 94 | #endif |
| 95 | |
Paul Sokolovsky | dcac880 | 2014-01-16 19:19:50 +0200 | [diff] [blame] | 96 | // Enable features which improve CPython compatibility |
| 97 | // but may lead to more code size/memory usage. |
| 98 | // TODO: Originally intended as generic category to not |
| 99 | // add bunch of once-off options. May need refactoring later |
| 100 | #ifndef MICROPY_CPYTHON_COMPAT |
| 101 | #define MICROPY_CPYTHON_COMPAT (1) |
| 102 | #endif |
| 103 | |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 104 | /*****************************************************************************/ |
| 105 | /* Miscellaneous settings */ |
| 106 | |
Paul Sokolovsky | fc5aac8 | 2014-01-12 16:10:19 +0200 | [diff] [blame] | 107 | #define BITS_PER_BYTE (8) |
| 108 | #define BITS_PER_WORD (BITS_PER_BYTE * BYTES_PER_WORD) |
Paul Sokolovsky | c260bc5 | 2014-01-12 16:15:47 +0200 | [diff] [blame] | 109 | // machine_int_t value with most significant bit set |
Damien George | 2300537 | 2014-01-13 19:39:01 +0000 | [diff] [blame] | 110 | #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] | 111 | |
Paul Sokolovsky | c90c0f6 | 2014-01-04 01:57:00 +0200 | [diff] [blame] | 112 | // printf format spec to use for machine_int_t and friends |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 113 | #ifndef INT_FMT |
Paul Sokolovsky | c90c0f6 | 2014-01-04 01:57:00 +0200 | [diff] [blame] | 114 | #ifdef __LP64__ |
| 115 | // Archs where machine_int_t == long, long != int |
| 116 | #define UINT_FMT "%lu" |
| 117 | #define INT_FMT "%ld" |
| 118 | #else |
| 119 | // Archs where machine_int_t == int |
| 120 | #define UINT_FMT "%u" |
| 121 | #define INT_FMT "%d" |
| 122 | #endif |
| 123 | #endif //INT_FMT |