blob: 04d4a7ddc9723ff055472f6a2dd4d287a60cac57 [file] [log] [blame]
Paul Sokolovskyb372bfc2014-01-03 17:15:53 +02001// 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 George136f6752014-01-07 14:54:15 +00007// 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 Georgecbd2f742014-01-19 11:48:48 +000042// Whether to build functions that print debugging info:
Damien Georgec5966122014-02-15 16:10:44 +000043// mp_token_show
Damien Georgecbd2f742014-01-19 11:48:48 +000044// mp_byte_code_print
45// mp_parse_node_print
46#ifndef MICROPY_DEBUG_PRINTERS
47#define MICROPY_DEBUG_PRINTERS (0)
Damien Georged3ebe482014-01-07 15:20:33 +000048#endif
49
Damien George136f6752014-01-07 14:54:15 +000050/*****************************************************************************/
51/* Fine control over Python features */
52
Damien Georged3ebe482014-01-07 15:20:33 +000053// Whether to include the garbage collector
54#ifndef MICROPY_ENABLE_GC
55#define MICROPY_ENABLE_GC (0)
56#endif
57
Damien George12bab722014-04-05 20:35:48 +010058// Whether to enable finalisers in the garbage collector (ie call __del__)
59#ifndef MICROPY_ENABLE_GC_FINALISER
60#define MICROPY_ENABLE_GC_FINALISER (0)
61#endif
62
Damien George136f6752014-01-07 14:54:15 +000063// Whether to include REPL helper function
64#ifndef MICROPY_ENABLE_REPL_HELPERS
65#define MICROPY_ENABLE_REPL_HELPERS (0)
66#endif
67
Damien Georged3ebe482014-01-07 15:20:33 +000068// Whether to include lexer helper function for unix
69#ifndef MICROPY_ENABLE_LEXER_UNIX
70#define MICROPY_ENABLE_LEXER_UNIX (0)
71#endif
72
Paul Sokolovsky48b35722014-01-12 17:30:48 +020073// Long int implementation
74#define MICROPY_LONGINT_IMPL_NONE (0)
75#define MICROPY_LONGINT_IMPL_LONGLONG (1)
Damien George438c88d2014-02-22 19:25:23 +000076#define MICROPY_LONGINT_IMPL_MPZ (2)
Paul Sokolovsky48b35722014-01-12 17:30:48 +020077
78#ifndef MICROPY_LONGINT_IMPL
79#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
80#endif
81
82#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_LONGLONG
83typedef long long mp_longint_impl_t;
84#endif
85
Damien George62ad1892014-01-29 21:51:51 +000086// Whether to include information in the byte code to determine source
87// line number (increases RAM usage, but doesn't slow byte code execution)
88#ifndef MICROPY_ENABLE_SOURCE_LINE
89#define MICROPY_ENABLE_SOURCE_LINE (0)
90#endif
91
Damien George1463c1f2014-04-25 23:52:57 +010092// Whether to include doc strings (increases RAM usage)
93#ifndef MICROPY_ENABLE_DOC_STRING
94#define MICROPY_ENABLE_DOC_STRING (0)
95#endif
96
Damien George0c36da02014-03-08 15:24:39 +000097// Float and complex implementation
98#define MICROPY_FLOAT_IMPL_NONE (0)
99#define MICROPY_FLOAT_IMPL_FLOAT (1)
100#define MICROPY_FLOAT_IMPL_DOUBLE (2)
101
102#ifndef MICROPY_FLOAT_IMPL
103#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
104#endif
105
106#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
107#define MICROPY_ENABLE_FLOAT (1)
108#define MICROPY_FLOAT_C_FUN(fun) fun##f
109typedef float mp_float_t;
110#elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
111#define MICROPY_ENABLE_FLOAT (1)
112#define MICROPY_FLOAT_C_FUN(fun) fun
113typedef double mp_float_t;
114#else
Damien George136f6752014-01-07 14:54:15 +0000115#define MICROPY_ENABLE_FLOAT (0)
116#endif
117
Damien George107c9fb2014-04-26 10:31:15 +0100118// Whether to provide "collections" module
119#ifndef MICROPY_ENABLE_MOD_COLLECTIONS
120#define MICROPY_ENABLE_MOD_COLLECTIONS (1)
121#endif
122
Damien Georgedbdfee12014-04-17 17:11:03 +0100123// Whether to provide "math" module
124#ifndef MICROPY_ENABLE_MOD_MATH
125#define MICROPY_ENABLE_MOD_MATH (1)
126#endif
127
128// Whether to provide "cmath" module
129#ifndef MICROPY_ENABLE_MOD_CMATH
130#define MICROPY_ENABLE_MOD_CMATH (0)
131#endif
132
Paul Sokolovsky98a627d2014-04-03 14:57:53 +0300133// Whether to provide "io" module
134#ifndef MICROPY_ENABLE_MOD_IO
135#define MICROPY_ENABLE_MOD_IO (1)
136#endif
137
Paul Sokolovskye9db8402014-04-10 03:45:38 +0300138// Whether to provide "struct" module
139#ifndef MICROPY_ENABLE_MOD_STRUCT
140#define MICROPY_ENABLE_MOD_STRUCT (1)
141#endif
142
Paul Sokolovsky5500cde2014-04-13 06:43:18 +0300143// Whether to provide "sys" module
144#ifndef MICROPY_ENABLE_MOD_SYS
145#define MICROPY_ENABLE_MOD_SYS (1)
146#endif
147
Paul Sokolovsky4165cd12014-04-13 07:00:37 +0300148#ifndef MICROPY_MOD_SYS_STDFILES
149#define MICROPY_MOD_SYS_STDFILES (0)
150#endif
151
Damien George136f6752014-01-07 14:54:15 +0000152// Whether to support slice object and correspondingly
153// slice subscript operators
154#ifndef MICROPY_ENABLE_SLICE
155#define MICROPY_ENABLE_SLICE (1)
156#endif
157
Damien George777b0f32014-04-13 18:59:45 +0100158// Whether to support the property object
159#ifndef MICROPY_ENABLE_PROPERTY
Damien Georgec9f6f6b2014-04-17 17:02:30 +0100160#define MICROPY_ENABLE_PROPERTY (1)
Damien George777b0f32014-04-13 18:59:45 +0100161#endif
162
Paul Sokolovskydcac8802014-01-16 19:19:50 +0200163// Enable features which improve CPython compatibility
164// but may lead to more code size/memory usage.
165// TODO: Originally intended as generic category to not
166// add bunch of once-off options. May need refactoring later
167#ifndef MICROPY_CPYTHON_COMPAT
168#define MICROPY_CPYTHON_COMPAT (1)
169#endif
170
Damien George354d15a2014-02-06 21:11:19 +0000171// Maximum length of a path in the filesystem
172// So we can allocate a buffer on the stack for path manipulation in import
173#ifndef MICROPY_PATH_MAX
174#define MICROPY_PATH_MAX (512)
175#endif
176
Damien George3bb8bd82014-04-14 21:20:30 +0100177// Whether to use computed gotos in the VM, or a switch
178// Computed gotos are roughly 10% faster, and increase VM code size by a little
Damien George5b65f0c2014-04-17 23:24:13 +0100179#ifndef MICROPY_USE_COMPUTED_GOTO
180#define MICROPY_USE_COMPUTED_GOTO (0)
Damien George3bb8bd82014-04-14 21:20:30 +0100181#endif
182
Damien Georgecaac5422014-03-25 14:18:18 +0000183// Additional builtin function definitions - see builtintables.c:builtin_object_table for format.
Paul Sokolovsky910843e2014-02-14 12:02:34 +0200184#ifndef MICROPY_EXTRA_BUILTINS
185#define MICROPY_EXTRA_BUILTINS
186#endif
Damien Georgecaac5422014-03-25 14:18:18 +0000187
188// Additional builtin module definitions - see builtintables.c:builtin_module_table for format.
189#ifndef MICROPY_EXTRA_BUILTIN_MODULES
190#define MICROPY_EXTRA_BUILTIN_MODULES
191#endif
192
Damien George57e99eb2014-04-10 22:42:11 +0100193// Additional constant definitions for the compiler - see compile.c:mp_constants_table.
194#ifndef MICROPY_EXTRA_CONSTANTS
195#define MICROPY_EXTRA_CONSTANTS
196#endif
197
Damien George136f6752014-01-07 14:54:15 +0000198/*****************************************************************************/
199/* Miscellaneous settings */
200
Paul Sokolovskyd5df6cd2014-02-12 18:15:40 +0200201// Allow to override static modifier for global objects, e.g. to use with
202// object code analysis tools which don't support static symbols.
203#ifndef STATIC
204#define STATIC static
205#endif
206
Paul Sokolovskyfc5aac82014-01-12 16:10:19 +0200207#define BITS_PER_BYTE (8)
208#define BITS_PER_WORD (BITS_PER_BYTE * BYTES_PER_WORD)
Paul Sokolovskyc260bc52014-01-12 16:15:47 +0200209// machine_int_t value with most significant bit set
Damien George23005372014-01-13 19:39:01 +0000210#define WORD_MSBIT_HIGH (((machine_uint_t)1) << (BYTES_PER_WORD * 8 - 1))
Paul Sokolovskyfc5aac82014-01-12 16:10:19 +0200211
Paul Sokolovsky2da81fa2014-04-11 03:44:00 +0300212#if !defined(MP_ENDIANNESS_LITTLE) && !defined(MP_ENDIANNESS_BIG)
213// Just because most archs are such?
214#define MP_ENDIANNESS_LITTLE (1)
215#endif
Andrew Schellercc837372014-04-14 02:39:56 +0100216// Ensure we don't accidentally set both endiannesses
217#if MP_ENDIANNESS_BIG
218#define MP_ENDIANNESS_LITTLE (0)
219#endif
Paul Sokolovsky2da81fa2014-04-11 03:44:00 +0300220
Paul Sokolovskyc90c0f62014-01-04 01:57:00 +0200221// printf format spec to use for machine_int_t and friends
Damien George136f6752014-01-07 14:54:15 +0000222#ifndef INT_FMT
Paul Sokolovskyc90c0f62014-01-04 01:57:00 +0200223#ifdef __LP64__
224// Archs where machine_int_t == long, long != int
225#define UINT_FMT "%lu"
226#define INT_FMT "%ld"
227#else
228// Archs where machine_int_t == int
229#define UINT_FMT "%u"
230#define INT_FMT "%d"
231#endif
232#endif //INT_FMT
Paul Sokolovskye9085912014-04-30 05:35:18 +0300233
234// Modifier for function which doesn't return
235#define NORETURN __attribute__((noreturn))