mpconfig.h 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527
  1. /*
  2. * This file is part of the MicroPython project, http://micropython.org/
  3. *
  4. * The MIT License (MIT)
  5. *
  6. * Copyright (c) 2013, 2014 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. #ifndef MICROPY_INCLUDED_PY_MPCONFIG_H
  27. #define MICROPY_INCLUDED_PY_MPCONFIG_H
  28. // Current version of MicroPython
  29. #define MICROPY_VERSION_MAJOR 1
  30. #define MICROPY_VERSION_MINOR 10
  31. #define MICROPY_VERSION_MICRO 0
  32. // Combined version as a 32-bit number for convenience
  33. #define MICROPY_VERSION ( \
  34. MICROPY_VERSION_MAJOR << 16 \
  35. | MICROPY_VERSION_MINOR << 8 \
  36. | MICROPY_VERSION_MICRO)
  37. // String version
  38. #define MICROPY_VERSION_STRING \
  39. MP_STRINGIFY(MICROPY_VERSION_MAJOR) "." \
  40. MP_STRINGIFY(MICROPY_VERSION_MINOR) "." \
  41. MP_STRINGIFY(MICROPY_VERSION_MICRO)
  42. // This file contains default configuration settings for MicroPython.
  43. // You can override any of the options below using mpconfigport.h file
  44. // located in a directory of your port.
  45. // mpconfigport.h is a file containing configuration settings for a
  46. // particular port. mpconfigport.h is actually a default name for
  47. // such config, and it can be overridden using MP_CONFIGFILE preprocessor
  48. // define (you can do that by passing CFLAGS_EXTRA='-DMP_CONFIGFILE="<file.h>"'
  49. // argument to make when using standard MicroPython makefiles).
  50. // This is useful to have more than one config per port, for example,
  51. // release vs debug configs, etc. Note that if you switch from one config
  52. // to another, you must rebuild from scratch using "-B" switch to make.
  53. #ifdef MP_CONFIGFILE
  54. #include MP_CONFIGFILE
  55. #else
  56. #include <mpconfigport.h>
  57. #endif
  58. // Any options not explicitly set in mpconfigport.h will get default
  59. // values below.
  60. /*****************************************************************************/
  61. /* Object representation */
  62. // A MicroPython object is a machine word having the following form:
  63. // - xxxx...xxx1 : a small int, bits 1 and above are the value
  64. // - xxxx...xx10 : a qstr, bits 2 and above are the value
  65. // - xxxx...xx00 : a pointer to an mp_obj_base_t (unless a fake object)
  66. #define MICROPY_OBJ_REPR_A (0)
  67. // A MicroPython object is a machine word having the following form:
  68. // - xxxx...xx01 : a small int, bits 2 and above are the value
  69. // - xxxx...xx11 : a qstr, bits 2 and above are the value
  70. // - xxxx...xxx0 : a pointer to an mp_obj_base_t (unless a fake object)
  71. #define MICROPY_OBJ_REPR_B (1)
  72. // A MicroPython object is a machine word having the following form (called R):
  73. // - iiiiiiii iiiiiiii iiiiiiii iiiiiii1 small int with 31-bit signed value
  74. // - 01111111 1qqqqqqq qqqqqqqq qqqqq110 str with 20-bit qstr value
  75. // - s1111111 10000000 00000000 00000010 +/- inf
  76. // - s1111111 1xxxxxxx xxxxxxxx xxxxx010 nan, x != 0
  77. // - seeeeeee efffffff ffffffff ffffff10 30-bit fp, e != 0xff
  78. // - pppppppp pppppppp pppppppp pppppp00 ptr (4 byte alignment)
  79. // Str and float stored as O = R + 0x80800000, retrieved as R = O - 0x80800000.
  80. // This makes strs easier to encode/decode as they have zeros in the top 9 bits.
  81. // This scheme only works with 32-bit word size and float enabled.
  82. #define MICROPY_OBJ_REPR_C (2)
  83. // A MicroPython object is a 64-bit word having the following form (called R):
  84. // - seeeeeee eeeeffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 64-bit fp, e != 0x7ff
  85. // - s1111111 11110000 00000000 00000000 00000000 00000000 00000000 00000000 +/- inf
  86. // - 01111111 11111000 00000000 00000000 00000000 00000000 00000000 00000000 normalised nan
  87. // - 01111111 11111101 iiiiiiii iiiiiiii iiiiiiii iiiiiiii iiiiiiii iiiiiii1 small int
  88. // - 01111111 11111110 00000000 00000000 qqqqqqqq qqqqqqqq qqqqqqqq qqqqqqq1 str
  89. // - 01111111 11111100 00000000 00000000 pppppppp pppppppp pppppppp pppppp00 ptr (4 byte alignment)
  90. // Stored as O = R + 0x8004000000000000, retrieved as R = O - 0x8004000000000000.
  91. // This makes pointers have all zeros in the top 32 bits.
  92. // Small-ints and strs have 1 as LSB to make sure they don't look like pointers
  93. // to the garbage collector.
  94. #define MICROPY_OBJ_REPR_D (3)
  95. #ifndef MICROPY_OBJ_REPR
  96. #define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_A)
  97. #endif
  98. /*****************************************************************************/
  99. /* Memory allocation policy */
  100. // Number of bytes in memory allocation/GC block. Any size allocated will be
  101. // rounded up to be multiples of this.
  102. #ifndef MICROPY_BYTES_PER_GC_BLOCK
  103. #define MICROPY_BYTES_PER_GC_BLOCK (4 * BYTES_PER_WORD)
  104. #endif
  105. // Number of words allocated (in BSS) to the GC stack (minimum is 1)
  106. #ifndef MICROPY_ALLOC_GC_STACK_SIZE
  107. #define MICROPY_ALLOC_GC_STACK_SIZE (64)
  108. #endif
  109. // The C-type to use for entries in the GC stack. By default it allows the
  110. // heap to be as large as the address space, but the bit-width of this type can
  111. // be reduced to save memory when the heap is small enough. The type must be
  112. // big enough to index all blocks in the heap, which is set by
  113. // heap-size-in-bytes / MICROPY_BYTES_PER_GC_BLOCK.
  114. #ifndef MICROPY_GC_STACK_ENTRY_TYPE
  115. #define MICROPY_GC_STACK_ENTRY_TYPE size_t
  116. #endif
  117. // Be conservative and always clear to zero newly (re)allocated memory in the GC.
  118. // This helps eliminate stray pointers that hold on to memory that's no longer
  119. // used. It decreases performance due to unnecessary memory clearing.
  120. // A memory manager which always clears memory can set this to 0.
  121. // TODO Do analysis to understand why some memory is not properly cleared and
  122. // find a more efficient way to clear it.
  123. #ifndef MICROPY_GC_CONSERVATIVE_CLEAR
  124. #define MICROPY_GC_CONSERVATIVE_CLEAR (MICROPY_ENABLE_GC)
  125. #endif
  126. // Support automatic GC when reaching allocation threshold,
  127. // configurable by gc.threshold().
  128. #ifndef MICROPY_GC_ALLOC_THRESHOLD
  129. #define MICROPY_GC_ALLOC_THRESHOLD (1)
  130. #endif
  131. // Number of bytes to allocate initially when creating new chunks to store
  132. // interned string data. Smaller numbers lead to more chunks being needed
  133. // and more wastage at the end of the chunk. Larger numbers lead to wasted
  134. // space at the end when no more strings need interning.
  135. #ifndef MICROPY_ALLOC_QSTR_CHUNK_INIT
  136. #define MICROPY_ALLOC_QSTR_CHUNK_INIT (128)
  137. #endif
  138. // Initial amount for lexer indentation level
  139. #ifndef MICROPY_ALLOC_LEXER_INDENT_INIT
  140. #define MICROPY_ALLOC_LEXER_INDENT_INIT (10)
  141. #endif
  142. // Increment for lexer indentation level
  143. #ifndef MICROPY_ALLOC_LEXEL_INDENT_INC
  144. #define MICROPY_ALLOC_LEXEL_INDENT_INC (8)
  145. #endif
  146. // Initial amount for parse rule stack
  147. #ifndef MICROPY_ALLOC_PARSE_RULE_INIT
  148. #define MICROPY_ALLOC_PARSE_RULE_INIT (64)
  149. #endif
  150. // Increment for parse rule stack
  151. #ifndef MICROPY_ALLOC_PARSE_RULE_INC
  152. #define MICROPY_ALLOC_PARSE_RULE_INC (16)
  153. #endif
  154. // Initial amount for parse result stack
  155. #ifndef MICROPY_ALLOC_PARSE_RESULT_INIT
  156. #define MICROPY_ALLOC_PARSE_RESULT_INIT (32)
  157. #endif
  158. // Increment for parse result stack
  159. #ifndef MICROPY_ALLOC_PARSE_RESULT_INC
  160. #define MICROPY_ALLOC_PARSE_RESULT_INC (16)
  161. #endif
  162. // Strings this length or less will be interned by the parser
  163. #ifndef MICROPY_ALLOC_PARSE_INTERN_STRING_LEN
  164. #define MICROPY_ALLOC_PARSE_INTERN_STRING_LEN (10)
  165. #endif
  166. // Number of bytes to allocate initially when creating new chunks to store
  167. // parse nodes. Small leads to fragmentation, large leads to excess use.
  168. #ifndef MICROPY_ALLOC_PARSE_CHUNK_INIT
  169. #define MICROPY_ALLOC_PARSE_CHUNK_INIT (128)
  170. #endif
  171. // Initial amount for ids in a scope
  172. #ifndef MICROPY_ALLOC_SCOPE_ID_INIT
  173. #define MICROPY_ALLOC_SCOPE_ID_INIT (4)
  174. #endif
  175. // Increment for ids in a scope
  176. #ifndef MICROPY_ALLOC_SCOPE_ID_INC
  177. #define MICROPY_ALLOC_SCOPE_ID_INC (6)
  178. #endif
  179. // Maximum length of a path in the filesystem
  180. // So we can allocate a buffer on the stack for path manipulation in import
  181. #ifndef MICROPY_ALLOC_PATH_MAX
  182. #define MICROPY_ALLOC_PATH_MAX (512)
  183. #endif
  184. // Initial size of module dict
  185. #ifndef MICROPY_MODULE_DICT_SIZE
  186. #define MICROPY_MODULE_DICT_SIZE (1)
  187. #endif
  188. // Whether realloc/free should be passed allocated memory region size
  189. // You must enable this if MICROPY_MEM_STATS is enabled
  190. #ifndef MICROPY_MALLOC_USES_ALLOCATED_SIZE
  191. #define MICROPY_MALLOC_USES_ALLOCATED_SIZE (0)
  192. #endif
  193. // Number of bytes used to store qstr length
  194. // Dictates hard limit on maximum Python identifier length, but 1 byte
  195. // (limit of 255 bytes in an identifier) should be enough for everyone
  196. #ifndef MICROPY_QSTR_BYTES_IN_LEN
  197. #define MICROPY_QSTR_BYTES_IN_LEN (1)
  198. #endif
  199. // Number of bytes used to store qstr hash
  200. #ifndef MICROPY_QSTR_BYTES_IN_HASH
  201. #define MICROPY_QSTR_BYTES_IN_HASH (2)
  202. #endif
  203. // Avoid using C stack when making Python function calls. C stack still
  204. // may be used if there's no free heap.
  205. #ifndef MICROPY_STACKLESS
  206. #define MICROPY_STACKLESS (0)
  207. #endif
  208. // Never use C stack when making Python function calls. This may break
  209. // testsuite as will subtly change which exception is thrown in case
  210. // of too deep recursion and other similar cases.
  211. #ifndef MICROPY_STACKLESS_STRICT
  212. #define MICROPY_STACKLESS_STRICT (0)
  213. #endif
  214. // Don't use alloca calls. As alloca() is not part of ANSI C, this
  215. // workaround option is provided for compilers lacking this de-facto
  216. // standard function. The way it works is allocating from heap, and
  217. // relying on garbage collection to free it eventually. This is of
  218. // course much less optimal than real alloca().
  219. #if defined(MICROPY_NO_ALLOCA) && MICROPY_NO_ALLOCA
  220. #undef alloca
  221. #define alloca(x) m_malloc(x)
  222. #endif
  223. /*****************************************************************************/
  224. /* MicroPython emitters */
  225. // Whether to support loading of persistent code
  226. #ifndef MICROPY_PERSISTENT_CODE_LOAD
  227. #define MICROPY_PERSISTENT_CODE_LOAD (0)
  228. #endif
  229. // Whether to support saving of persistent code
  230. #ifndef MICROPY_PERSISTENT_CODE_SAVE
  231. #define MICROPY_PERSISTENT_CODE_SAVE (0)
  232. #endif
  233. // Whether generated code can persist independently of the VM/runtime instance
  234. // This is enabled automatically when needed by other features
  235. #ifndef MICROPY_PERSISTENT_CODE
  236. #define MICROPY_PERSISTENT_CODE (MICROPY_PERSISTENT_CODE_LOAD || MICROPY_PERSISTENT_CODE_SAVE || MICROPY_MODULE_FROZEN_MPY)
  237. #endif
  238. // Whether to emit x64 native code
  239. #ifndef MICROPY_EMIT_X64
  240. #define MICROPY_EMIT_X64 (0)
  241. #endif
  242. // Whether to emit x86 native code
  243. #ifndef MICROPY_EMIT_X86
  244. #define MICROPY_EMIT_X86 (0)
  245. #endif
  246. // Whether to emit thumb native code
  247. #ifndef MICROPY_EMIT_THUMB
  248. #define MICROPY_EMIT_THUMB (0)
  249. #endif
  250. // Whether to enable the thumb inline assembler
  251. #ifndef MICROPY_EMIT_INLINE_THUMB
  252. #define MICROPY_EMIT_INLINE_THUMB (0)
  253. #endif
  254. // Whether to enable ARMv7-M instruction support in the Thumb2 inline assembler
  255. #ifndef MICROPY_EMIT_INLINE_THUMB_ARMV7M
  256. #define MICROPY_EMIT_INLINE_THUMB_ARMV7M (1)
  257. #endif
  258. // Whether to enable float support in the Thumb2 inline assembler
  259. #ifndef MICROPY_EMIT_INLINE_THUMB_FLOAT
  260. #define MICROPY_EMIT_INLINE_THUMB_FLOAT (1)
  261. #endif
  262. // Whether to emit ARM native code
  263. #ifndef MICROPY_EMIT_ARM
  264. #define MICROPY_EMIT_ARM (0)
  265. #endif
  266. // Whether to emit Xtensa native code
  267. #ifndef MICROPY_EMIT_XTENSA
  268. #define MICROPY_EMIT_XTENSA (0)
  269. #endif
  270. // Whether to enable the Xtensa inline assembler
  271. #ifndef MICROPY_EMIT_INLINE_XTENSA
  272. #define MICROPY_EMIT_INLINE_XTENSA (0)
  273. #endif
  274. // Convenience definition for whether any native emitter is enabled
  275. #define MICROPY_EMIT_NATIVE (MICROPY_EMIT_X64 || MICROPY_EMIT_X86 || MICROPY_EMIT_THUMB || MICROPY_EMIT_ARM || MICROPY_EMIT_XTENSA)
  276. // Convenience definition for whether any inline assembler emitter is enabled
  277. #define MICROPY_EMIT_INLINE_ASM (MICROPY_EMIT_INLINE_THUMB || MICROPY_EMIT_INLINE_XTENSA)
  278. /*****************************************************************************/
  279. /* Compiler configuration */
  280. // Whether to include the compiler
  281. #ifndef MICROPY_ENABLE_COMPILER
  282. #define MICROPY_ENABLE_COMPILER (1)
  283. #endif
  284. // Whether the compiler is dynamically configurable (ie at runtime)
  285. #ifndef MICROPY_DYNAMIC_COMPILER
  286. #define MICROPY_DYNAMIC_COMPILER (0)
  287. #endif
  288. // Configure dynamic compiler macros
  289. #if MICROPY_DYNAMIC_COMPILER
  290. #define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE_DYNAMIC (mp_dynamic_compiler.opt_cache_map_lookup_in_bytecode)
  291. #define MICROPY_PY_BUILTINS_STR_UNICODE_DYNAMIC (mp_dynamic_compiler.py_builtins_str_unicode)
  292. #else
  293. #define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE_DYNAMIC MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE
  294. #define MICROPY_PY_BUILTINS_STR_UNICODE_DYNAMIC MICROPY_PY_BUILTINS_STR_UNICODE
  295. #endif
  296. // Whether to enable constant folding; eg 1+2 rewritten as 3
  297. #ifndef MICROPY_COMP_CONST_FOLDING
  298. #define MICROPY_COMP_CONST_FOLDING (1)
  299. #endif
  300. // Whether to enable lookup of constants in modules; eg module.CONST
  301. #ifndef MICROPY_COMP_MODULE_CONST
  302. #define MICROPY_COMP_MODULE_CONST (0)
  303. #endif
  304. // Whether to enable constant optimisation; id = const(value)
  305. #ifndef MICROPY_COMP_CONST
  306. #define MICROPY_COMP_CONST (1)
  307. #endif
  308. // Whether to enable optimisation of: a, b = c, d
  309. // Costs 124 bytes (Thumb2)
  310. #ifndef MICROPY_COMP_DOUBLE_TUPLE_ASSIGN
  311. #define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (1)
  312. #endif
  313. // Whether to enable optimisation of: a, b, c = d, e, f
  314. // Requires MICROPY_COMP_DOUBLE_TUPLE_ASSIGN and costs 68 bytes (Thumb2)
  315. #ifndef MICROPY_COMP_TRIPLE_TUPLE_ASSIGN
  316. #define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (0)
  317. #endif
  318. // Whether to enable optimisation of: return a if b else c
  319. // Costs about 80 bytes (Thumb2) and saves 2 bytes of bytecode for each use
  320. #ifndef MICROPY_COMP_RETURN_IF_EXPR
  321. #define MICROPY_COMP_RETURN_IF_EXPR (0)
  322. #endif
  323. /*****************************************************************************/
  324. /* Internal debugging stuff */
  325. // Whether to collect memory allocation stats
  326. #ifndef MICROPY_MEM_STATS
  327. #define MICROPY_MEM_STATS (0)
  328. #endif
  329. // The mp_print_t printer used for debugging output
  330. #ifndef MICROPY_DEBUG_PRINTER
  331. #define MICROPY_DEBUG_PRINTER (&mp_plat_print)
  332. #endif
  333. // Whether to build functions that print debugging info:
  334. // mp_bytecode_print
  335. // mp_parse_node_print
  336. #ifndef MICROPY_DEBUG_PRINTERS
  337. #define MICROPY_DEBUG_PRINTERS (0)
  338. #endif
  339. // Whether to enable all debugging outputs (it will be extremely verbose)
  340. #ifndef MICROPY_DEBUG_VERBOSE
  341. #define MICROPY_DEBUG_VERBOSE (0)
  342. #endif
  343. // Whether to enable a simple VM stack overflow check
  344. #ifndef MICROPY_DEBUG_VM_STACK_OVERFLOW
  345. #define MICROPY_DEBUG_VM_STACK_OVERFLOW (0)
  346. #endif
  347. /*****************************************************************************/
  348. /* Optimisations */
  349. // Whether to use computed gotos in the VM, or a switch
  350. // Computed gotos are roughly 10% faster, and increase VM code size by a little
  351. // Note: enabling this will use the gcc-specific extensions of ranged designated
  352. // initialisers and addresses of labels, which are not part of the C99 standard.
  353. #ifndef MICROPY_OPT_COMPUTED_GOTO
  354. #define MICROPY_OPT_COMPUTED_GOTO (0)
  355. #endif
  356. // Whether to cache result of map lookups in LOAD_NAME, LOAD_GLOBAL, LOAD_ATTR,
  357. // STORE_ATTR bytecodes. Uses 1 byte extra RAM for each of these opcodes and
  358. // uses a bit of extra code ROM, but greatly improves lookup speed.
  359. #ifndef MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE
  360. #define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (0)
  361. #endif
  362. // Whether to use fast versions of bitwise operations (and, or, xor) when the
  363. // arguments are both positive. Increases Thumb2 code size by about 250 bytes.
  364. #ifndef MICROPY_OPT_MPZ_BITWISE
  365. #define MICROPY_OPT_MPZ_BITWISE (0)
  366. #endif
  367. // Whether math.factorial is large, fast and recursive (1) or small and slow (0).
  368. #ifndef MICROPY_OPT_MATH_FACTORIAL
  369. #define MICROPY_OPT_MATH_FACTORIAL (0)
  370. #endif
  371. /*****************************************************************************/
  372. /* Python internal features */
  373. // Whether to enable import of external modules
  374. // When disabled, only importing of built-in modules is supported
  375. // When enabled, a port must implement mp_import_stat (among other things)
  376. #ifndef MICROPY_ENABLE_EXTERNAL_IMPORT
  377. #define MICROPY_ENABLE_EXTERNAL_IMPORT (1)
  378. #endif
  379. // Whether to use the POSIX reader for importing files
  380. #ifndef MICROPY_READER_POSIX
  381. #define MICROPY_READER_POSIX (0)
  382. #endif
  383. // Whether to use the VFS reader for importing files
  384. #ifndef MICROPY_READER_VFS
  385. #define MICROPY_READER_VFS (0)
  386. #endif
  387. // Whether any readers have been defined
  388. #ifndef MICROPY_HAS_FILE_READER
  389. #define MICROPY_HAS_FILE_READER (MICROPY_READER_POSIX || MICROPY_READER_VFS)
  390. #endif
  391. // Hook for the VM at the start of the opcode loop (can contain variable
  392. // definitions usable by the other hook functions)
  393. #ifndef MICROPY_VM_HOOK_INIT
  394. #define MICROPY_VM_HOOK_INIT
  395. #endif
  396. // Hook for the VM during the opcode loop (but only after jump opcodes)
  397. #ifndef MICROPY_VM_HOOK_LOOP
  398. #define MICROPY_VM_HOOK_LOOP
  399. #endif
  400. // Hook for the VM just before return opcode is finished being interpreted
  401. #ifndef MICROPY_VM_HOOK_RETURN
  402. #define MICROPY_VM_HOOK_RETURN
  403. #endif
  404. // Whether to include the garbage collector
  405. #ifndef MICROPY_ENABLE_GC
  406. #define MICROPY_ENABLE_GC (0)
  407. #endif
  408. // Whether to enable finalisers in the garbage collector (ie call __del__)
  409. #ifndef MICROPY_ENABLE_FINALISER
  410. #define MICROPY_ENABLE_FINALISER (0)
  411. #endif
  412. // Whether to enable a separate allocator for the Python stack.
  413. // If enabled then the code must call mp_pystack_init before mp_init.
  414. #ifndef MICROPY_ENABLE_PYSTACK
  415. #define MICROPY_ENABLE_PYSTACK (0)
  416. #endif
  417. // Number of bytes that memory returned by mp_pystack_alloc will be aligned by.
  418. #ifndef MICROPY_PYSTACK_ALIGN
  419. #define MICROPY_PYSTACK_ALIGN (8)
  420. #endif
  421. // Whether to check C stack usage. C stack used for calling Python functions,
  422. // etc. Not checking means segfault on overflow.
  423. #ifndef MICROPY_STACK_CHECK
  424. #define MICROPY_STACK_CHECK (0)
  425. #endif
  426. // Whether to have an emergency exception buffer
  427. #ifndef MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF
  428. #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (0)
  429. #endif
  430. #if MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF
  431. # ifndef MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE
  432. # define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (0) // 0 - implies dynamic allocation
  433. # endif
  434. #endif
  435. // Whether to provide the mp_kbd_exception object, and micropython.kbd_intr function
  436. #ifndef MICROPY_KBD_EXCEPTION
  437. #define MICROPY_KBD_EXCEPTION (0)
  438. #endif
  439. // Prefer to raise KeyboardInterrupt asynchronously (from signal or interrupt
  440. // handler) - if supported by a particular port.
  441. #ifndef MICROPY_ASYNC_KBD_INTR
  442. #define MICROPY_ASYNC_KBD_INTR (0)
  443. #endif
  444. // Whether to include REPL helper function
  445. #ifndef MICROPY_HELPER_REPL
  446. #define MICROPY_HELPER_REPL (0)
  447. #endif
  448. // Whether to include emacs-style readline behavior in REPL
  449. #ifndef MICROPY_REPL_EMACS_KEYS
  450. #define MICROPY_REPL_EMACS_KEYS (0)
  451. #endif
  452. // Whether to implement auto-indent in REPL
  453. #ifndef MICROPY_REPL_AUTO_INDENT
  454. #define MICROPY_REPL_AUTO_INDENT (0)
  455. #endif
  456. // Whether port requires event-driven REPL functions
  457. #ifndef MICROPY_REPL_EVENT_DRIVEN
  458. #define MICROPY_REPL_EVENT_DRIVEN (0)
  459. #endif
  460. // Whether to include lexer helper function for unix
  461. #ifndef MICROPY_HELPER_LEXER_UNIX
  462. #define MICROPY_HELPER_LEXER_UNIX (0)
  463. #endif
  464. // Long int implementation
  465. #define MICROPY_LONGINT_IMPL_NONE (0)
  466. #define MICROPY_LONGINT_IMPL_LONGLONG (1)
  467. #define MICROPY_LONGINT_IMPL_MPZ (2)
  468. #ifndef MICROPY_LONGINT_IMPL
  469. #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
  470. #endif
  471. #if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_LONGLONG
  472. typedef long long mp_longint_impl_t;
  473. #endif
  474. // Whether to include information in the byte code to determine source
  475. // line number (increases RAM usage, but doesn't slow byte code execution)
  476. #ifndef MICROPY_ENABLE_SOURCE_LINE
  477. #define MICROPY_ENABLE_SOURCE_LINE (0)
  478. #endif
  479. // Whether to include doc strings (increases RAM usage)
  480. #ifndef MICROPY_ENABLE_DOC_STRING
  481. #define MICROPY_ENABLE_DOC_STRING (0)
  482. #endif
  483. // Exception messages are short static strings
  484. #define MICROPY_ERROR_REPORTING_TERSE (1)
  485. // Exception messages provide basic error details
  486. #define MICROPY_ERROR_REPORTING_NORMAL (2)
  487. // Exception messages provide full info, e.g. object names
  488. #define MICROPY_ERROR_REPORTING_DETAILED (3)
  489. #ifndef MICROPY_ERROR_REPORTING
  490. #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
  491. #endif
  492. // Whether issue warnings during compiling/execution
  493. #ifndef MICROPY_WARNINGS
  494. #define MICROPY_WARNINGS (0)
  495. #endif
  496. // Whether to support warning categories
  497. #ifndef MICROPY_WARNINGS_CATEGORY
  498. #define MICROPY_WARNINGS_CATEGORY (0)
  499. #endif
  500. // This macro is used when printing runtime warnings and errors
  501. #ifndef MICROPY_ERROR_PRINTER
  502. #define MICROPY_ERROR_PRINTER (&mp_plat_print)
  503. #endif
  504. // Float and complex implementation
  505. #define MICROPY_FLOAT_IMPL_NONE (0)
  506. #define MICROPY_FLOAT_IMPL_FLOAT (1)
  507. #define MICROPY_FLOAT_IMPL_DOUBLE (2)
  508. #ifndef MICROPY_FLOAT_IMPL
  509. #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
  510. #endif
  511. #if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
  512. #define MICROPY_PY_BUILTINS_FLOAT (1)
  513. #define MICROPY_FLOAT_CONST(x) x##F
  514. #define MICROPY_FLOAT_C_FUN(fun) fun##f
  515. typedef float mp_float_t;
  516. #elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
  517. #define MICROPY_PY_BUILTINS_FLOAT (1)
  518. #define MICROPY_FLOAT_CONST(x) x
  519. #define MICROPY_FLOAT_C_FUN(fun) fun
  520. typedef double mp_float_t;
  521. #else
  522. #define MICROPY_PY_BUILTINS_FLOAT (0)
  523. #endif
  524. #ifndef MICROPY_PY_BUILTINS_COMPLEX
  525. #define MICROPY_PY_BUILTINS_COMPLEX (MICROPY_PY_BUILTINS_FLOAT)
  526. #endif
  527. // Whether to provide a high-quality hash for float and complex numbers.
  528. // Otherwise the default is a very simple but correct hashing function.
  529. #ifndef MICROPY_FLOAT_HIGH_QUALITY_HASH
  530. #define MICROPY_FLOAT_HIGH_QUALITY_HASH (0)
  531. #endif
  532. // Enable features which improve CPython compatibility
  533. // but may lead to more code size/memory usage.
  534. // TODO: Originally intended as generic category to not
  535. // add bunch of once-off options. May need refactoring later
  536. #ifndef MICROPY_CPYTHON_COMPAT
  537. #define MICROPY_CPYTHON_COMPAT (1)
  538. #endif
  539. // Perform full checks as done by CPython. Disabling this
  540. // may produce incorrect results, if incorrect data is fed,
  541. // but should not lead to MicroPython crashes or similar
  542. // grave issues (in other words, only user app should be,
  543. // affected, not system).
  544. #ifndef MICROPY_FULL_CHECKS
  545. #define MICROPY_FULL_CHECKS (1)
  546. #endif
  547. // Whether POSIX-semantics non-blocking streams are supported
  548. #ifndef MICROPY_STREAMS_NON_BLOCK
  549. #define MICROPY_STREAMS_NON_BLOCK (0)
  550. #endif
  551. // Whether to provide stream functions with POSIX-like signatures
  552. // (useful for porting existing libraries to MicroPython).
  553. #ifndef MICROPY_STREAMS_POSIX_API
  554. #define MICROPY_STREAMS_POSIX_API (0)
  555. #endif
  556. // Whether to call __init__ when importing builtin modules for the first time
  557. #ifndef MICROPY_MODULE_BUILTIN_INIT
  558. #define MICROPY_MODULE_BUILTIN_INIT (0)
  559. #endif
  560. // Whether to support module-level __getattr__ (see PEP 562)
  561. #ifndef MICROPY_MODULE_GETATTR
  562. #define MICROPY_MODULE_GETATTR (0)
  563. #endif
  564. // Whether module weak links are supported
  565. #ifndef MICROPY_MODULE_WEAK_LINKS
  566. #define MICROPY_MODULE_WEAK_LINKS (0)
  567. #endif
  568. // Whether frozen modules are supported in the form of strings
  569. #ifndef MICROPY_MODULE_FROZEN_STR
  570. #define MICROPY_MODULE_FROZEN_STR (0)
  571. #endif
  572. // Whether frozen modules are supported in the form of .mpy files
  573. #ifndef MICROPY_MODULE_FROZEN_MPY
  574. #define MICROPY_MODULE_FROZEN_MPY (0)
  575. #endif
  576. // Convenience macro for whether frozen modules are supported
  577. #ifndef MICROPY_MODULE_FROZEN
  578. #define MICROPY_MODULE_FROZEN (MICROPY_MODULE_FROZEN_STR || MICROPY_MODULE_FROZEN_MPY)
  579. #endif
  580. // Whether you can override builtins in the builtins module
  581. #ifndef MICROPY_CAN_OVERRIDE_BUILTINS
  582. #define MICROPY_CAN_OVERRIDE_BUILTINS (0)
  583. #endif
  584. // Whether to check that the "self" argument of a builtin method has the
  585. // correct type. Such an explicit check is only needed if a builtin
  586. // method escapes to Python land without a first argument, eg
  587. // list.append([], 1). Without this check such calls will have undefined
  588. // behaviour (usually segfault) if the first argument is the wrong type.
  589. #ifndef MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG
  590. #define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (1)
  591. #endif
  592. // Whether to use internally defined errno's (otherwise system provided ones)
  593. #ifndef MICROPY_USE_INTERNAL_ERRNO
  594. #define MICROPY_USE_INTERNAL_ERRNO (0)
  595. #endif
  596. // Whether to use internally defined *printf() functions (otherwise external ones)
  597. #ifndef MICROPY_USE_INTERNAL_PRINTF
  598. #define MICROPY_USE_INTERNAL_PRINTF (1)
  599. #endif
  600. // Support for internal scheduler
  601. #ifndef MICROPY_ENABLE_SCHEDULER
  602. #define MICROPY_ENABLE_SCHEDULER (0)
  603. #endif
  604. // Maximum number of entries in the scheduler
  605. #ifndef MICROPY_SCHEDULER_DEPTH
  606. #define MICROPY_SCHEDULER_DEPTH (4)
  607. #endif
  608. // Support for generic VFS sub-system
  609. #ifndef MICROPY_VFS
  610. #define MICROPY_VFS (0)
  611. #endif
  612. // Support for VFS POSIX component, to mount a POSIX filesystem within VFS
  613. #ifndef MICROPY_VFS
  614. #define MICROPY_VFS_POSIX (0)
  615. #endif
  616. // Support for VFS FAT component, to mount a FAT filesystem within VFS
  617. #ifndef MICROPY_VFS
  618. #define MICROPY_VFS_FAT (0)
  619. #endif
  620. /*****************************************************************************/
  621. /* Fine control over Python builtins, classes, modules, etc */
  622. // Whether to support multiple inheritance of Python classes. Multiple
  623. // inheritance makes some C functions inherently recursive, and adds a bit of
  624. // code overhead.
  625. #ifndef MICROPY_MULTIPLE_INHERITANCE
  626. #define MICROPY_MULTIPLE_INHERITANCE (1)
  627. #endif
  628. // Whether to implement attributes on functions
  629. #ifndef MICROPY_PY_FUNCTION_ATTRS
  630. #define MICROPY_PY_FUNCTION_ATTRS (0)
  631. #endif
  632. // Whether to support the descriptors __get__, __set__, __delete__
  633. // This costs some code size and makes load/store/delete of instance
  634. // attributes slower for the classes that use this feature
  635. #ifndef MICROPY_PY_DESCRIPTORS
  636. #define MICROPY_PY_DESCRIPTORS (0)
  637. #endif
  638. // Whether to support class __delattr__ and __setattr__ methods
  639. // This costs some code size and makes store/delete of instance
  640. // attributes slower for the classes that use this feature
  641. #ifndef MICROPY_PY_DELATTR_SETATTR
  642. #define MICROPY_PY_DELATTR_SETATTR (0)
  643. #endif
  644. // Support for async/await/async for/async with
  645. #ifndef MICROPY_PY_ASYNC_AWAIT
  646. #define MICROPY_PY_ASYNC_AWAIT (1)
  647. #endif
  648. // Non-standard .pend_throw() method for generators, allowing for
  649. // Future-like behavior with respect to exception handling: an
  650. // exception set with .pend_throw() will activate on the next call
  651. // to generator's .send() or .__next__(). (This is useful to implement
  652. // async schedulers.)
  653. #ifndef MICROPY_PY_GENERATOR_PEND_THROW
  654. #define MICROPY_PY_GENERATOR_PEND_THROW (1)
  655. #endif
  656. // Issue a warning when comparing str and bytes objects
  657. #ifndef MICROPY_PY_STR_BYTES_CMP_WARN
  658. #define MICROPY_PY_STR_BYTES_CMP_WARN (0)
  659. #endif
  660. // Whether str object is proper unicode
  661. #ifndef MICROPY_PY_BUILTINS_STR_UNICODE
  662. #define MICROPY_PY_BUILTINS_STR_UNICODE (0)
  663. #endif
  664. // Whether to check for valid UTF-8 when converting bytes to str
  665. #ifndef MICROPY_PY_BUILTINS_STR_UNICODE_CHECK
  666. #define MICROPY_PY_BUILTINS_STR_UNICODE_CHECK (MICROPY_PY_BUILTINS_STR_UNICODE)
  667. #endif
  668. // Whether str.center() method provided
  669. #ifndef MICROPY_PY_BUILTINS_STR_CENTER
  670. #define MICROPY_PY_BUILTINS_STR_CENTER (0)
  671. #endif
  672. // Whether str.count() method provided
  673. #ifndef MICROPY_PY_BUILTINS_STR_COUNT
  674. #define MICROPY_PY_BUILTINS_STR_COUNT (1)
  675. #endif
  676. // Whether str % (...) formatting operator provided
  677. #ifndef MICROPY_PY_BUILTINS_STR_OP_MODULO
  678. #define MICROPY_PY_BUILTINS_STR_OP_MODULO (1)
  679. #endif
  680. // Whether str.partition()/str.rpartition() method provided
  681. #ifndef MICROPY_PY_BUILTINS_STR_PARTITION
  682. #define MICROPY_PY_BUILTINS_STR_PARTITION (0)
  683. #endif
  684. // Whether str.splitlines() method provided
  685. #ifndef MICROPY_PY_BUILTINS_STR_SPLITLINES
  686. #define MICROPY_PY_BUILTINS_STR_SPLITLINES (0)
  687. #endif
  688. // Whether to support bytearray object
  689. #ifndef MICROPY_PY_BUILTINS_BYTEARRAY
  690. #define MICROPY_PY_BUILTINS_BYTEARRAY (1)
  691. #endif
  692. // Whether to support dict.fromkeys() class method
  693. #ifndef MICROPY_PY_BUILTINS_DICT_FROMKEYS
  694. #define MICROPY_PY_BUILTINS_DICT_FROMKEYS (1)
  695. #endif
  696. // Whether to support memoryview object
  697. #ifndef MICROPY_PY_BUILTINS_MEMORYVIEW
  698. #define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
  699. #endif
  700. // Whether to support set object
  701. #ifndef MICROPY_PY_BUILTINS_SET
  702. #define MICROPY_PY_BUILTINS_SET (1)
  703. #endif
  704. // Whether to support slice subscript operators and slice object
  705. #ifndef MICROPY_PY_BUILTINS_SLICE
  706. #define MICROPY_PY_BUILTINS_SLICE (1)
  707. #endif
  708. // Whether to support slice attribute read access,
  709. // i.e. slice.start, slice.stop, slice.step
  710. #ifndef MICROPY_PY_BUILTINS_SLICE_ATTRS
  711. #define MICROPY_PY_BUILTINS_SLICE_ATTRS (0)
  712. #endif
  713. // Whether to support frozenset object
  714. #ifndef MICROPY_PY_BUILTINS_FROZENSET
  715. #define MICROPY_PY_BUILTINS_FROZENSET (0)
  716. #endif
  717. // Whether to support property object
  718. #ifndef MICROPY_PY_BUILTINS_PROPERTY
  719. #define MICROPY_PY_BUILTINS_PROPERTY (1)
  720. #endif
  721. // Whether to implement the start/stop/step attributes (readback) on
  722. // the "range" builtin type. Rarely used, and costs ~60 bytes (x86).
  723. #ifndef MICROPY_PY_BUILTINS_RANGE_ATTRS
  724. #define MICROPY_PY_BUILTINS_RANGE_ATTRS (1)
  725. #endif
  726. // Whether to support binary ops [only (in)equality is defined] between range
  727. // objects. With this option disabled all range objects that are not exactly
  728. // the same object will compare as not-equal. With it enabled the semantics
  729. // match CPython and ranges are equal if they yield the same sequence of items.
  730. #ifndef MICROPY_PY_BUILTINS_RANGE_BINOP
  731. #define MICROPY_PY_BUILTINS_RANGE_BINOP (0)
  732. #endif
  733. // Support for callling next() with second argument
  734. #ifndef MICROPY_PY_BUILTINS_NEXT2
  735. #define MICROPY_PY_BUILTINS_NEXT2 (0)
  736. #endif
  737. // Whether to support rounding of integers (incl bignum); eg round(123,-1)=120
  738. #ifndef MICROPY_PY_BUILTINS_ROUND_INT
  739. #define MICROPY_PY_BUILTINS_ROUND_INT (0)
  740. #endif
  741. // Whether to support timeout exceptions (like socket.timeout)
  742. #ifndef MICROPY_PY_BUILTINS_TIMEOUTERROR
  743. #define MICROPY_PY_BUILTINS_TIMEOUTERROR (0)
  744. #endif
  745. // Whether to support complete set of special methods for user
  746. // classes, or only the most used ones. "Inplace" methods are
  747. // controlled by MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS below.
  748. // "Reverse" methods are controlled by
  749. // MICROPY_PY_REVERSE_SPECIAL_METHODS below.
  750. #ifndef MICROPY_PY_ALL_SPECIAL_METHODS
  751. #define MICROPY_PY_ALL_SPECIAL_METHODS (0)
  752. #endif
  753. // Whether to support all inplace arithmetic operarion methods
  754. // (__imul__, etc.)
  755. #ifndef MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS
  756. #define MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS (0)
  757. #endif
  758. // Whether to support reverse arithmetic operarion methods
  759. // (__radd__, etc.). Additionally gated by
  760. // MICROPY_PY_ALL_SPECIAL_METHODS.
  761. #ifndef MICROPY_PY_REVERSE_SPECIAL_METHODS
  762. #define MICROPY_PY_REVERSE_SPECIAL_METHODS (0)
  763. #endif
  764. // Whether to support compile function
  765. #ifndef MICROPY_PY_BUILTINS_COMPILE
  766. #define MICROPY_PY_BUILTINS_COMPILE (0)
  767. #endif
  768. // Whether to support enumerate function(type)
  769. #ifndef MICROPY_PY_BUILTINS_ENUMERATE
  770. #define MICROPY_PY_BUILTINS_ENUMERATE (1)
  771. #endif
  772. // Whether to support eval and exec functions
  773. // By default they are supported if the compiler is enabled
  774. #ifndef MICROPY_PY_BUILTINS_EVAL_EXEC
  775. #define MICROPY_PY_BUILTINS_EVAL_EXEC (MICROPY_ENABLE_COMPILER)
  776. #endif
  777. // Whether to support the Python 2 execfile function
  778. #ifndef MICROPY_PY_BUILTINS_EXECFILE
  779. #define MICROPY_PY_BUILTINS_EXECFILE (0)
  780. #endif
  781. // Whether to support filter function(type)
  782. #ifndef MICROPY_PY_BUILTINS_FILTER
  783. #define MICROPY_PY_BUILTINS_FILTER (1)
  784. #endif
  785. // Whether to support reversed function(type)
  786. #ifndef MICROPY_PY_BUILTINS_REVERSED
  787. #define MICROPY_PY_BUILTINS_REVERSED (1)
  788. #endif
  789. // Whether to define "NotImplemented" special constant
  790. #ifndef MICROPY_PY_BUILTINS_NOTIMPLEMENTED
  791. #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
  792. #endif
  793. // Whether to provide the built-in input() function. The implementation of this
  794. // uses mp-readline, so can only be enabled if the port uses this readline.
  795. #ifndef MICROPY_PY_BUILTINS_INPUT
  796. #define MICROPY_PY_BUILTINS_INPUT (0)
  797. #endif
  798. // Whether to support min/max functions
  799. #ifndef MICROPY_PY_BUILTINS_MIN_MAX
  800. #define MICROPY_PY_BUILTINS_MIN_MAX (1)
  801. #endif
  802. // Support for calls to pow() with 3 integer arguments
  803. #ifndef MICROPY_PY_BUILTINS_POW3
  804. #define MICROPY_PY_BUILTINS_POW3 (0)
  805. #endif
  806. // Whether to provide the help function
  807. #ifndef MICROPY_PY_BUILTINS_HELP
  808. #define MICROPY_PY_BUILTINS_HELP (0)
  809. #endif
  810. // Use this to configure the help text shown for help(). It should be a
  811. // variable with the type "const char*". A sensible default is provided.
  812. #ifndef MICROPY_PY_BUILTINS_HELP_TEXT
  813. #define MICROPY_PY_BUILTINS_HELP_TEXT mp_help_default_text
  814. #endif
  815. // Add the ability to list the available modules when executing help('modules')
  816. #ifndef MICROPY_PY_BUILTINS_HELP_MODULES
  817. #define MICROPY_PY_BUILTINS_HELP_MODULES (0)
  818. #endif
  819. // Whether to set __file__ for imported modules
  820. #ifndef MICROPY_PY___FILE__
  821. #define MICROPY_PY___FILE__ (1)
  822. #endif
  823. // Whether to provide mem-info related functions in micropython module
  824. #ifndef MICROPY_PY_MICROPYTHON_MEM_INFO
  825. #define MICROPY_PY_MICROPYTHON_MEM_INFO (0)
  826. #endif
  827. // Whether to provide "micropython.stack_use" function
  828. #ifndef MICROPY_PY_MICROPYTHON_STACK_USE
  829. #define MICROPY_PY_MICROPYTHON_STACK_USE (MICROPY_PY_MICROPYTHON_MEM_INFO)
  830. #endif
  831. // Whether to provide "array" module. Note that large chunk of the
  832. // underlying code is shared with "bytearray" builtin type, so to
  833. // get real savings, it should be disabled too.
  834. #ifndef MICROPY_PY_ARRAY
  835. #define MICROPY_PY_ARRAY (1)
  836. #endif
  837. // Whether to support slice assignments for array (and bytearray).
  838. // This is rarely used, but adds ~0.5K of code.
  839. #ifndef MICROPY_PY_ARRAY_SLICE_ASSIGN
  840. #define MICROPY_PY_ARRAY_SLICE_ASSIGN (0)
  841. #endif
  842. // Whether to support attrtuple type (MicroPython extension)
  843. // It provides space-efficient tuples with attribute access
  844. #ifndef MICROPY_PY_ATTRTUPLE
  845. #define MICROPY_PY_ATTRTUPLE (1)
  846. #endif
  847. // Whether to provide "collections" module
  848. #ifndef MICROPY_PY_COLLECTIONS
  849. #define MICROPY_PY_COLLECTIONS (1)
  850. #endif
  851. // Whether to provide "ucollections.deque" type
  852. #ifndef MICROPY_PY_COLLECTIONS_DEQUE
  853. #define MICROPY_PY_COLLECTIONS_DEQUE (0)
  854. #endif
  855. // Whether to provide "collections.OrderedDict" type
  856. #ifndef MICROPY_PY_COLLECTIONS_ORDEREDDICT
  857. #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
  858. #endif
  859. // Whether to provide the _asdict function for namedtuple
  860. #ifndef MICROPY_PY_COLLECTIONS_NAMEDTUPLE__ASDICT
  861. #define MICROPY_PY_COLLECTIONS_NAMEDTUPLE__ASDICT (0)
  862. #endif
  863. // Whether to provide "math" module
  864. #ifndef MICROPY_PY_MATH
  865. #define MICROPY_PY_MATH (1)
  866. #endif
  867. // Whether to provide special math functions: math.{erf,erfc,gamma,lgamma}
  868. #ifndef MICROPY_PY_MATH_SPECIAL_FUNCTIONS
  869. #define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (0)
  870. #endif
  871. // Whether to provide math.factorial function
  872. #ifndef MICROPY_PY_MATH_FACTORIAL
  873. #define MICROPY_PY_MATH_FACTORIAL (0)
  874. #endif
  875. // Whether to provide "cmath" module
  876. #ifndef MICROPY_PY_CMATH
  877. #define MICROPY_PY_CMATH (0)
  878. #endif
  879. // Whether to provide "gc" module
  880. #ifndef MICROPY_PY_GC
  881. #define MICROPY_PY_GC (1)
  882. #endif
  883. // Whether to return number of collected objects from gc.collect()
  884. #ifndef MICROPY_PY_GC_COLLECT_RETVAL
  885. #define MICROPY_PY_GC_COLLECT_RETVAL (0)
  886. #endif
  887. // Whether to provide "io" module
  888. #ifndef MICROPY_PY_IO
  889. #define MICROPY_PY_IO (1)
  890. #endif
  891. // Whether to provide "io.IOBase" class to support user streams
  892. #ifndef MICROPY_PY_IO_IOBASE
  893. #define MICROPY_PY_IO_IOBASE (0)
  894. #endif
  895. // Whether to provide "uio.resource_stream()" function with
  896. // the semantics of CPython's pkg_resources.resource_stream()
  897. // (allows to access binary resources in frozen source packages).
  898. // Note that the same functionality can be achieved in "pure
  899. // Python" by prepocessing binary resources into Python source
  900. // and bytecode-freezing it (with a simple helper module available
  901. // e.g. in micropython-lib).
  902. #ifndef MICROPY_PY_IO_RESOURCE_STREAM
  903. #define MICROPY_PY_IO_RESOURCE_STREAM (0)
  904. #endif
  905. // Whether to provide "io.FileIO" class
  906. #ifndef MICROPY_PY_IO_FILEIO
  907. #define MICROPY_PY_IO_FILEIO (0)
  908. #endif
  909. // Whether to provide "io.BytesIO" class
  910. #ifndef MICROPY_PY_IO_BYTESIO
  911. #define MICROPY_PY_IO_BYTESIO (1)
  912. #endif
  913. // Whether to provide "io.BufferedWriter" class
  914. #ifndef MICROPY_PY_IO_BUFFEREDWRITER
  915. #define MICROPY_PY_IO_BUFFEREDWRITER (0)
  916. #endif
  917. // Whether to provide "struct" module
  918. #ifndef MICROPY_PY_STRUCT
  919. #define MICROPY_PY_STRUCT (1)
  920. #endif
  921. // Whether to provide "sys" module
  922. #ifndef MICROPY_PY_SYS
  923. #define MICROPY_PY_SYS (1)
  924. #endif
  925. // Whether to provide "sys.maxsize" constant
  926. #ifndef MICROPY_PY_SYS_MAXSIZE
  927. #define MICROPY_PY_SYS_MAXSIZE (0)
  928. #endif
  929. // Whether to provide "sys.modules" dictionary
  930. #ifndef MICROPY_PY_SYS_MODULES
  931. #define MICROPY_PY_SYS_MODULES (1)
  932. #endif
  933. // Whether to provide "sys.exc_info" function
  934. // Avoid enabling this, this function is Python2 heritage
  935. #ifndef MICROPY_PY_SYS_EXC_INFO
  936. #define MICROPY_PY_SYS_EXC_INFO (0)
  937. #endif
  938. // Whether to provide "sys.exit" function
  939. #ifndef MICROPY_PY_SYS_EXIT
  940. #define MICROPY_PY_SYS_EXIT (1)
  941. #endif
  942. // Whether to provide "sys.getsizeof" function
  943. #ifndef MICROPY_PY_SYS_GETSIZEOF
  944. #define MICROPY_PY_SYS_GETSIZEOF (0)
  945. #endif
  946. // Whether to provide sys.{stdin,stdout,stderr} objects
  947. #ifndef MICROPY_PY_SYS_STDFILES
  948. #define MICROPY_PY_SYS_STDFILES (0)
  949. #endif
  950. // Whether to provide sys.{stdin,stdout,stderr}.buffer object
  951. // This is implemented per-port
  952. #ifndef MICROPY_PY_SYS_STDIO_BUFFER
  953. #define MICROPY_PY_SYS_STDIO_BUFFER (0)
  954. #endif
  955. // Whether to provide "uerrno" module
  956. #ifndef MICROPY_PY_UERRNO
  957. #define MICROPY_PY_UERRNO (0)
  958. #endif
  959. // Whether to provide the uerrno.errorcode dict
  960. #ifndef MICROPY_PY_UERRNO_ERRORCODE
  961. #define MICROPY_PY_UERRNO_ERRORCODE (1)
  962. #endif
  963. // Whether to provide "uselect" module (baremetal implementation)
  964. #ifndef MICROPY_PY_USELECT
  965. #define MICROPY_PY_USELECT (0)
  966. #endif
  967. // Whether to provide "utime" module functions implementation
  968. // in terms of mp_hal_* functions.
  969. #ifndef MICROPY_PY_UTIME_MP_HAL
  970. #define MICROPY_PY_UTIME_MP_HAL (0)
  971. #endif
  972. // Period of values returned by utime.ticks_ms(), ticks_us(), ticks_cpu()
  973. // functions. Should be power of two. All functions above use the same
  974. // period, so if underlying hardware/API has different periods, the
  975. // minimum of them should be used. The value below is the maximum value
  976. // this parameter can take (corresponding to 30 bit tick values on 32-bit
  977. // system).
  978. #ifndef MICROPY_PY_UTIME_TICKS_PERIOD
  979. #define MICROPY_PY_UTIME_TICKS_PERIOD (MP_SMALL_INT_POSITIVE_MASK + 1)
  980. #endif
  981. // Whether to provide "_thread" module
  982. #ifndef MICROPY_PY_THREAD
  983. #define MICROPY_PY_THREAD (0)
  984. #endif
  985. // Whether to make the VM/runtime thread-safe using a global lock
  986. // If not enabled then thread safety must be provided at the Python level
  987. #ifndef MICROPY_PY_THREAD_GIL
  988. #define MICROPY_PY_THREAD_GIL (MICROPY_PY_THREAD)
  989. #endif
  990. // Number of VM jump-loops to do before releasing the GIL.
  991. // Set this to 0 to disable the divisor.
  992. #ifndef MICROPY_PY_THREAD_GIL_VM_DIVISOR
  993. #define MICROPY_PY_THREAD_GIL_VM_DIVISOR (32)
  994. #endif
  995. // Extended modules
  996. #ifndef MICROPY_PY_UCTYPES
  997. #define MICROPY_PY_UCTYPES (0)
  998. #endif
  999. // Whether to provide SHORT, INT, LONG, etc. types in addition to
  1000. // exact-bitness types like INT16, INT32, etc.
  1001. #ifndef MICROPY_PY_UCTYPES_NATIVE_C_TYPES
  1002. #define MICROPY_PY_UCTYPES_NATIVE_C_TYPES (1)
  1003. #endif
  1004. #ifndef MICROPY_PY_UZLIB
  1005. #define MICROPY_PY_UZLIB (0)
  1006. #endif
  1007. #ifndef MICROPY_PY_UJSON
  1008. #define MICROPY_PY_UJSON (0)
  1009. #endif
  1010. #ifndef MICROPY_PY_URE
  1011. #define MICROPY_PY_URE (0)
  1012. #endif
  1013. #ifndef MICROPY_PY_URE_MATCH_GROUPS
  1014. #define MICROPY_PY_URE_MATCH_GROUPS (0)
  1015. #endif
  1016. #ifndef MICROPY_PY_URE_MATCH_SPAN_START_END
  1017. #define MICROPY_PY_URE_MATCH_SPAN_START_END (0)
  1018. #endif
  1019. #ifndef MICROPY_PY_URE_SUB
  1020. #define MICROPY_PY_URE_SUB (0)
  1021. #endif
  1022. #ifndef MICROPY_PY_UHEAPQ
  1023. #define MICROPY_PY_UHEAPQ (0)
  1024. #endif
  1025. // Optimized heap queue for relative timestamps
  1026. #ifndef MICROPY_PY_UTIMEQ
  1027. #define MICROPY_PY_UTIMEQ (0)
  1028. #endif
  1029. #ifndef MICROPY_PY_UHASHLIB
  1030. #define MICROPY_PY_UHASHLIB (0)
  1031. #endif
  1032. #ifndef MICROPY_PY_UHASHLIB_MD5
  1033. #define MICROPY_PY_UHASHLIB_MD5 (0)
  1034. #endif
  1035. #ifndef MICROPY_PY_UHASHLIB_SHA1
  1036. #define MICROPY_PY_UHASHLIB_SHA1 (0)
  1037. #endif
  1038. #ifndef MICROPY_PY_UHASHLIB_SHA256
  1039. #define MICROPY_PY_UHASHLIB_SHA256 (1)
  1040. #endif
  1041. #ifndef MICROPY_PY_UCRYPTOLIB
  1042. #define MICROPY_PY_UCRYPTOLIB (0)
  1043. #endif
  1044. #ifndef MICROPY_PY_UCRYPTOLIB_CONSTS
  1045. #define MICROPY_PY_UCRYPTOLIB_CONSTS (0)
  1046. #endif
  1047. #ifndef MICROPY_PY_UBINASCII
  1048. #define MICROPY_PY_UBINASCII (0)
  1049. #endif
  1050. // Depends on MICROPY_PY_UZLIB
  1051. #ifndef MICROPY_PY_UBINASCII_CRC32
  1052. #define MICROPY_PY_UBINASCII_CRC32 (0)
  1053. #endif
  1054. #ifndef MICROPY_PY_URANDOM
  1055. #define MICROPY_PY_URANDOM (0)
  1056. #endif
  1057. // Whether to include: randrange, randint, choice, random, uniform
  1058. #ifndef MICROPY_PY_URANDOM_EXTRA_FUNCS
  1059. #define MICROPY_PY_URANDOM_EXTRA_FUNCS (0)
  1060. #endif
  1061. #ifndef MICROPY_PY_MACHINE
  1062. #define MICROPY_PY_MACHINE (0)
  1063. #endif
  1064. // Whether to include: time_pulse_us
  1065. #ifndef MICROPY_PY_MACHINE_PULSE
  1066. #define MICROPY_PY_MACHINE_PULSE (0)
  1067. #endif
  1068. #ifndef MICROPY_PY_MACHINE_I2C
  1069. #define MICROPY_PY_MACHINE_I2C (0)
  1070. #endif
  1071. #ifndef MICROPY_PY_MACHINE_SPI
  1072. #define MICROPY_PY_MACHINE_SPI (0)
  1073. #endif
  1074. #ifndef MICROPY_PY_USSL
  1075. #define MICROPY_PY_USSL (0)
  1076. // Whether to add finaliser code to ussl objects
  1077. #define MICROPY_PY_USSL_FINALISER (0)
  1078. #endif
  1079. #ifndef MICROPY_PY_UWEBSOCKET
  1080. #define MICROPY_PY_UWEBSOCKET (0)
  1081. #endif
  1082. #ifndef MICROPY_PY_FRAMEBUF
  1083. #define MICROPY_PY_FRAMEBUF (0)
  1084. #endif
  1085. #ifndef MICROPY_PY_BTREE
  1086. #define MICROPY_PY_BTREE (0)
  1087. #endif
  1088. /*****************************************************************************/
  1089. /* Hooks for a port to add builtins */
  1090. // Additional builtin function definitions - see modbuiltins.c:mp_module_builtins_globals_table for format.
  1091. #ifndef MICROPY_PORT_BUILTINS
  1092. #define MICROPY_PORT_BUILTINS
  1093. #endif
  1094. // Additional builtin module definitions - see objmodule.c:mp_builtin_module_table for format.
  1095. #ifndef MICROPY_PORT_BUILTIN_MODULES
  1096. #define MICROPY_PORT_BUILTIN_MODULES
  1097. #endif
  1098. // Any module weak links - see objmodule.c:mp_builtin_module_weak_links_table.
  1099. #ifndef MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS
  1100. #define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS
  1101. #endif
  1102. // Additional constant definitions for the compiler - see compile.c:mp_constants_table.
  1103. #ifndef MICROPY_PORT_CONSTANTS
  1104. #define MICROPY_PORT_CONSTANTS
  1105. #endif
  1106. // Any root pointers for GC scanning - see mpstate.c
  1107. #ifndef MICROPY_PORT_ROOT_POINTERS
  1108. #define MICROPY_PORT_ROOT_POINTERS
  1109. #endif
  1110. /*****************************************************************************/
  1111. /* Miscellaneous settings */
  1112. // All uPy objects in ROM must be aligned on at least a 4 byte boundary
  1113. // so that the small-int/qstr/pointer distinction can be made. For machines
  1114. // that don't do this (eg 16-bit CPU), define the following macro to something
  1115. // like __attribute__((aligned(4))).
  1116. #ifndef MICROPY_OBJ_BASE_ALIGNMENT
  1117. #define MICROPY_OBJ_BASE_ALIGNMENT
  1118. #endif
  1119. // On embedded platforms, these will typically enable/disable irqs.
  1120. #ifndef MICROPY_BEGIN_ATOMIC_SECTION
  1121. #define MICROPY_BEGIN_ATOMIC_SECTION() (0)
  1122. #endif
  1123. #ifndef MICROPY_END_ATOMIC_SECTION
  1124. #define MICROPY_END_ATOMIC_SECTION(state) (void)(state)
  1125. #endif
  1126. // Allow to override static modifier for global objects, e.g. to use with
  1127. // object code analysis tools which don't support static symbols.
  1128. #ifndef STATIC
  1129. #define STATIC static
  1130. #endif
  1131. // Number of bytes in a word
  1132. #ifndef BYTES_PER_WORD
  1133. #define BYTES_PER_WORD (sizeof(mp_uint_t))
  1134. #endif
  1135. #define BITS_PER_BYTE (8)
  1136. #define BITS_PER_WORD (BITS_PER_BYTE * BYTES_PER_WORD)
  1137. // mp_int_t value with most significant bit set
  1138. #define WORD_MSBIT_HIGH (((mp_uint_t)1) << (BYTES_PER_WORD * 8 - 1))
  1139. // Make sure both MP_ENDIANNESS_LITTLE and MP_ENDIANNESS_BIG are
  1140. // defined and that they are the opposite of each other.
  1141. #if defined(MP_ENDIANNESS_LITTLE)
  1142. #define MP_ENDIANNESS_BIG (!MP_ENDIANNESS_LITTLE)
  1143. #elif defined(MP_ENDIANNESS_BIG)
  1144. #define MP_ENDIANNESS_LITTLE (!MP_ENDIANNESS_BIG)
  1145. #else
  1146. // Endianness not defined by port so try to autodetect it.
  1147. #if defined(__BYTE_ORDER__)
  1148. #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
  1149. #define MP_ENDIANNESS_LITTLE (1)
  1150. #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
  1151. #define MP_ENDIANNESS_LITTLE (0)
  1152. #endif
  1153. #else
  1154. #include <endian.h>
  1155. #if defined(__BYTE_ORDER)
  1156. #if __BYTE_ORDER == __LITTLE_ENDIAN
  1157. #define MP_ENDIANNESS_LITTLE (1)
  1158. #elif __BYTE_ORDER == __BIG_ENDIAN
  1159. #define MP_ENDIANNESS_LITTLE (0)
  1160. #endif
  1161. #endif
  1162. #endif
  1163. #ifndef MP_ENDIANNESS_LITTLE
  1164. #error endianness not defined and cannot detect it
  1165. #endif
  1166. #define MP_ENDIANNESS_BIG (!MP_ENDIANNESS_LITTLE)
  1167. #endif
  1168. // Make a pointer to RAM callable (eg set lower bit for Thumb code)
  1169. // (This scheme won't work if we want to mix Thumb and normal ARM code.)
  1170. #ifndef MICROPY_MAKE_POINTER_CALLABLE
  1171. #define MICROPY_MAKE_POINTER_CALLABLE(p) (p)
  1172. #endif
  1173. // If these MP_PLAT_*_EXEC macros are overridden then the memory allocated by them
  1174. // must be somehow reachable for marking by the GC, since the native code
  1175. // generators store pointers to GC managed memory in the code.
  1176. #ifndef MP_PLAT_ALLOC_EXEC
  1177. #define MP_PLAT_ALLOC_EXEC(min_size, ptr, size) do { *ptr = m_new(byte, min_size); *size = min_size; } while (0)
  1178. #endif
  1179. #ifndef MP_PLAT_FREE_EXEC
  1180. #define MP_PLAT_FREE_EXEC(ptr, size) m_del(byte, ptr, size)
  1181. #endif
  1182. // This macro is used to do all output (except when MICROPY_PY_IO is defined)
  1183. #ifndef MP_PLAT_PRINT_STRN
  1184. #define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
  1185. #endif
  1186. #ifndef MP_SSIZE_MAX
  1187. #define MP_SSIZE_MAX SSIZE_MAX
  1188. #endif
  1189. // printf format spec to use for mp_int_t and friends
  1190. #ifndef INT_FMT
  1191. #if defined(__LP64__)
  1192. // Archs where mp_int_t == long, long != int
  1193. #define UINT_FMT "%lu"
  1194. #define INT_FMT "%ld"
  1195. #elif defined(_WIN64)
  1196. #define UINT_FMT "%llu"
  1197. #define INT_FMT "%lld"
  1198. #else
  1199. // Archs where mp_int_t == int
  1200. #define UINT_FMT "%u"
  1201. #define INT_FMT "%d"
  1202. #endif
  1203. #endif //INT_FMT
  1204. // Modifier for function which doesn't return
  1205. #ifndef NORETURN
  1206. #define NORETURN __attribute__((noreturn))
  1207. #endif
  1208. // Modifier for weak functions
  1209. #ifndef MP_WEAK
  1210. #define MP_WEAK __attribute__((weak))
  1211. #endif
  1212. // Modifier for functions which should be never inlined
  1213. #ifndef MP_NOINLINE
  1214. #define MP_NOINLINE __attribute__((noinline))
  1215. #endif
  1216. // Modifier for functions which should be always inlined
  1217. #ifndef MP_ALWAYSINLINE
  1218. #define MP_ALWAYSINLINE __attribute__((always_inline))
  1219. #endif
  1220. // Condition is likely to be true, to help branch prediction
  1221. #ifndef MP_LIKELY
  1222. #define MP_LIKELY(x) __builtin_expect((x), 1)
  1223. #endif
  1224. // Condition is likely to be false, to help branch prediction
  1225. #ifndef MP_UNLIKELY
  1226. #define MP_UNLIKELY(x) __builtin_expect((x), 0)
  1227. #endif
  1228. #ifndef MP_HTOBE16
  1229. #if MP_ENDIANNESS_LITTLE
  1230. # define MP_HTOBE16(x) ((uint16_t)( (((x) & 0xff) << 8) | (((x) >> 8) & 0xff) ))
  1231. # define MP_BE16TOH(x) MP_HTOBE16(x)
  1232. #else
  1233. # define MP_HTOBE16(x) (x)
  1234. # define MP_BE16TOH(x) (x)
  1235. #endif
  1236. #endif
  1237. #ifndef MP_HTOBE32
  1238. #if MP_ENDIANNESS_LITTLE
  1239. # define MP_HTOBE32(x) ((uint32_t)( (((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | (((x) >> 8) & 0xff00) | (((x) >> 24) & 0xff) ))
  1240. # define MP_BE32TOH(x) MP_HTOBE32(x)
  1241. #else
  1242. # define MP_HTOBE32(x) (x)
  1243. # define MP_BE32TOH(x) (x)
  1244. #endif
  1245. #endif
  1246. // Warning categories are by default implemented as strings, though
  1247. // hook is left for a port to define them as something else.
  1248. #if MICROPY_WARNINGS_CATEGORY
  1249. # ifndef MP_WARN_CAT
  1250. # define MP_WARN_CAT(x) #x
  1251. # endif
  1252. #else
  1253. # undef MP_WARN_CAT
  1254. # define MP_WARN_CAT(x) (NULL)
  1255. #endif
  1256. #endif // MICROPY_INCLUDED_PY_MPCONFIG_H