Skip to content

Commit b51e7e9

Browse files
jimmodpgeorge
authored andcommitted
stm32: Disable computed goto on constrained boards.
Saves ~1kiB. Add comment to this effect to mpconfig.h. Signed-off-by: Jim Mussared <[email protected]>
1 parent 61d5a8b commit b51e7e9

File tree

5 files changed

+7
-1
lines changed

5 files changed

+7
-1
lines changed

Diff for: ports/stm32/boards/B_L072Z_LRWAN1/mpconfigboard.h

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#define MICROPY_EMIT_THUMB (0)
99
#define MICROPY_EMIT_INLINE_THUMB (0)
10+
#define MICROPY_OPT_COMPUTED_GOTO (0)
1011
#define MICROPY_PY_BUILTINS_COMPLEX (0)
1112
#define MICROPY_PY_GENERATOR_PEND_THROW (0)
1213
#define MICROPY_PY_MATH (0)

Diff for: ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.h

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#define MICROPY_EMIT_THUMB (0)
55
#define MICROPY_EMIT_INLINE_THUMB (0)
6+
#define MICROPY_OPT_COMPUTED_GOTO (0)
67
#define MICROPY_PY_USOCKET (0)
78
#define MICROPY_PY_NETWORK (0)
89
#define MICROPY_PY_STM (0)

Diff for: ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.h

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#define MICROPY_EMIT_THUMB (0)
99
#define MICROPY_EMIT_INLINE_THUMB (0)
10+
#define MICROPY_OPT_COMPUTED_GOTO (0)
1011
#define MICROPY_PY_BUILTINS_COMPLEX (0)
1112
#define MICROPY_PY_GENERATOR_PEND_THROW (0)
1213
#define MICROPY_PY_MATH (0)

Diff for: ports/stm32/mpconfigport.h

+2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@
5656
#define MICROPY_COMP_RETURN_IF_EXPR (1)
5757

5858
// optimisations
59+
#ifndef MICROPY_OPT_COMPUTED_GOTO
5960
#define MICROPY_OPT_COMPUTED_GOTO (1)
61+
#endif
6062
#define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (0)
6163
#define MICROPY_OPT_MPZ_BITWISE (1)
6264
#define MICROPY_OPT_MATH_FACTORIAL (1)

Diff for: py/mpconfig.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,8 @@
483483
/* Optimisations */
484484

485485
// Whether to use computed gotos in the VM, or a switch
486-
// Computed gotos are roughly 10% faster, and increase VM code size by a little
486+
// Computed gotos are roughly 10% faster, and increase VM code size by a little,
487+
// e.g. ~1kiB on Cortex M4.
487488
// Note: enabling this will use the gcc-specific extensions of ranged designated
488489
// initialisers and addresses of labels, which are not part of the C99 standard.
489490
#ifndef MICROPY_OPT_COMPUTED_GOTO

0 commit comments

Comments
 (0)