2626#ifndef MICROPY_INCLUDED_PY_MPCONFIG_H
2727#define MICROPY_INCLUDED_PY_MPCONFIG_H
2828
29+ // Is this a CircuitPython build?
30+ #ifndef CIRCUITPY
31+ #define CIRCUITPY 0
32+ #endif
33+
2934// In CircuitPython, version info is in genhdr/mpversion.h.
3035#if CIRCUITPY
3136#include "genhdr/mpversion.h"
5358// You can override any of the options below using mpconfigport.h file
5459// located in a directory of your port.
5560
56- // Is this a CircuitPython build?
57- #ifndef CIRCUITPY
58- #define CIRCUITPY 0
59- #endif
60-
6161// mpconfigport.h is a file containing configuration settings for a
6262// particular port. mpconfigport.h is actually a default name for
6363// such config, and it can be overridden using MP_CONFIGFILE preprocessor
540540#define MICROPY_OPT_COMPUTED_GOTO (0)
541541#endif
542542
543+ // CIRCUITPY
544+ // Whether to save trade flash space for speed in MICROPY_OPT_COMPUTED_GOTO.
545+ // Costs about 3% speed, saves about 1500 bytes space. In addition to the assumptions
546+ // of MICROPY_OPT_COMPUTED_GOTO, also assumes that mp_execute_bytecode is less than
547+ // 32kB in size.
548+ #ifndef MICROPY_OPT_COMPUTED_GOTO_SAVE_SPACE
549+ #define MICROPY_OPT_COMPUTED_GOTO_SAVE_SPACE (0)
550+ #endif
551+
543552// Optimise the fast path for loading attributes from instance types. Increases
544553// Thumb2 code size by about 48 bytes.
545554#ifndef MICROPY_OPT_LOAD_ATTR_FAST_PATH
597606#define MICROPY_HAS_FILE_READER (MICROPY_READER_POSIX || MICROPY_READER_VFS)
598607#endif
599608
609+ // CIRCUITPY
610+ // Number of VFS mounts to persist across soft-reset.
611+ #ifndef MICROPY_FATFS_NUM_PERSISTENT
612+ #define MICROPY_FATFS_NUM_PERSISTENT (0)
613+ #endif
614+
600615// Hook for the VM at the start of the opcode loop (can contain variable
601616// definitions usable by the other hook functions)
602617#ifndef MICROPY_VM_HOOK_INIT
@@ -1595,6 +1610,7 @@ typedef double mp_float_t;
15951610// TODO? CIRCUITPY_ZLIB instead
15961611#ifndef MICROPY_PY_ZLIB
15971612#define MICROPY_PY_ZLIB (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES)
1613+ #endif
15981614
15991615// Whether to provide "deflate" module (decompression-only by default)
16001616#ifndef MICROPY_PY_DEFLATE
@@ -1977,6 +1993,19 @@ typedef double mp_float_t;
19771993#define MP_WEAK __attribute__((weak))
19781994#endif
19791995
1996+ // CIRCUITPY
1997+ // Modifier for functions which should not be instrumented when tracing with
1998+ // -finstrument-functions
1999+ #ifndef MP_NO_INSTRUMENT
2000+ #define MP_NO_INSTRUMENT __attribute__((no_instrument_function))
2001+ #endif
2002+
2003+ // CIRCUITPY
2004+ // Modifier for functions which should ideally inlined
2005+ #ifndef MP_INLINE
2006+ #define MP_INLINE inline MP_NO_INSTRUMENT
2007+ #endif
2008+
19802009// Modifier for functions which should be never inlined
19812010#ifndef MP_NOINLINE
19822011#define MP_NOINLINE __attribute__((noinline))
@@ -1997,6 +2026,13 @@ typedef double mp_float_t;
19972026#define MP_UNLIKELY (x ) __builtin_expect((x), 0)
19982027#endif
19992028
2029+ // CIRCUITPY
2030+ // Modifier for functions which aren't often used. Calls will also be considered
2031+ // unlikely. Section names are `.text.unlikely` for use in linker scripts.
2032+ #ifndef MP_COLD
2033+ #define MP_COLD __attribute__((cold))
2034+ #endif
2035+
20002036// To annotate that code is unreachable
20012037#ifndef MP_UNREACHABLE
20022038#if defined(__GNUC__ )
0 commit comments